问题标签 [topojson]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
388 浏览

map - shp 到 topojson 的转换:无输出

Topojson 的文档状态

您可以指定 ESRI shapefile 作为输入:

我的.shp文件有效,npm并且topojson已安装,并且我在输入文件的目录 ( cd) 中。这个topojson命令在我这边根本不起作用,没有输出,也没有产生反馈。

你如何转换shptopojson你身边的人?


which topojson/usr/local/bin/topojson

which ogr2ogr/usr/bin/ogr2ogr

在 ubuntu 13.04 上,但我认为我的问题与 ubuntu 无关。

0 投票
2 回答
2133 浏览

d3.js - 如何知道 topojson 是否已安装并正常工作?

如何知道 topojson 是否安装良好并正常工作?

要转换的示例小文件将不胜感激。具有源和预期结果

0 投票
1 回答
682 浏览

d3.js - D3.js解析错误-正交地图投影的旋转

我有一个世界地图的正交投影,在 D3 中并使用 TopoJSON。我通过调用此代码为每次加载数据的国家/地区着色。地球在不停地旋转。

我的问题是,在旋转过程中我收到错误消息:

错误

>> 错误:在 d3.v3.min.js:1 中解析 d="" >> 时出现问题

对于每个:

首先,我认为它取决于 topojson 脚本,因为有不同的版本。但它没有。

javascript代码:

初始化地球/投影的属性:

从 json 和 tsv 读取数据并附加土地和国家:

地球自转:

0 投票
1 回答
1840 浏览

json - Topojson:v0 和 v1 之间的差异列表?

我正在合并代码,依赖 v0 的代码在 v1 上中断。

topojson.v0.min.js 和 topojson.v1.min.js 之间的语法变化是什么?*

--

可疑语法列表:

  • V0 > V1
  • .object > .feature
  • .geometries > .features(在某些情况下或总是?)
  • *.coordinates > *.geometry.coordinates
  • 其他的 ?
0 投票
5 回答
31886 浏览

d3.js - D3js: Automatic labels placement to avoid overlaps? (force repulsion)

How to apply force repulsion on map's labels so they find their right places automatically ?


Bostock' "Let's Make a Map"

Mike Bostock's Let's Make a Map (screenshot below). By default, labels are put at the point's coordinates and polygons/multipolygons's path.centroid(d) + a simple left or right align, so they frequently enter in conflict.

enter image description here

Handmade label placements

One improvement I met requires to add an human made IF fixes, and to add as many as needed, such :

The whole become increasingly dirty as the number of labels to reajust increase :

Need for better solution

That's just not manageable for larger maps and sets of labels. How to add force repulsions to these both classes: .place-label and .subunit-label?

This issue is quite a brain storming as I haven't deadline on this, but I'am quite curious about it. I was thinking about this question as a basic D3js implementation of Migurski/Dymo.py. Dymo.py's README.md documentation set a large set of objectives, from which to select the core needs and functions (20% of the work, 80% of the result).

  1. Initial placement: Bostock give a good start with left/right positionning relative to the geopoint.
  2. Inter-labels repulsion: different approach are possible, Lars & Navarrc proposed one each,
  3. Labels annihilation: A label annihilation function when one label's overall repulsion is too intense, since squeezed between other labels, with the priority of annihilation being either random or based on a population data value, which we can get via NaturalEarth's .shp file.
  4. [Luxury] Label-to-dots repulsion: with fixed dots and mobile labels. But this is rather a luxury.

I ignore if label repulsion will work across layers and classes of labels. But getting countries labels and cities labels not overlapping may be a luxury as well.

0 投票
1 回答
2410 浏览

maps - 如何为乌干达生成正确的 GeoJSON 和 TopoJSON 文件

我已经按照互联网上的所有说明进行操作,但暂时没有结果,我想探索 D3 的 choropleth 地图,此时无法使用 d3 am 堆栈在浏览器中呈现正在生成的 topojson,

到目前为止,我已经下载并安装了 ogr2ogr , Nodejs

正在运行以生成拓扑 json 的命令是

ogr2ogr -f GeoJSON -s_srs EPSG:4199 -t_srs EPSG:4199 Districts.json "乌干达 distriscts.shp"

其次是

topojson --id-property District_i -p District=DIST_2010 -p AREA -p HECTAREAS -o ug.json Districts.json

我对 D3 和 TopoJSON 完全陌生,也不是 GIS 专家。请帮助我克服附加的这个问题,我想生成 topojson 并使用 d3 在 choropleth 地图上渲染它的 shapefile。如果有人可以为我提供有关如何为乌干达生成正确的 topojson 格式的指示,我将很高兴,因为大多数示例都与美国和其他地区有关。您的帮助将不胜感激

0 投票
0 回答
595 浏览

topojson - 将外部属性添加到 TopoJSON 文件

我有 TopoJSON 文件,并希望通过 id 在其中添加一些外部字段(并保留旧的),而不进行任何其他更改(如简化或量化)。所以我使用了TopoJSON wiki中的示例中的命令。命令就像:

topojson -o world-110m_ext.json -e world-country-names.tsv --id-property +id -p nameENG=name world-110m.json.

但是我得到的文件比源文件小并且没有任何 id 属性。我试图像这样保留id:

topojson -o world-110m_ext.json -p -e world-country-names.tsv --id-property +id -p nameENG=name world-110m.json.

它对我和许多其他方式都不起作用。我究竟做错了什么?

对于输入,我正在使用来自此 gist的 Mike 文件。

0 投票
2 回答
1504 浏览

map - 对 TopoJSON 格式的困惑

我正在尝试在此处遵循 mbostock 的“让我们制作地图”教程:http: //bost.ocks.org/mike/map/。在教程的某一点,他写道:

如果没有看到他的 topoJSON 文件的格式,很难确定我的代码对应的“uk.objects.subunits”行是什么(我的 topoJSON 可以在这里查看:https ://gist.github.com/jcahan/e1772766f01b68b00dc9 )。

有人可以帮助澄清我(和未来的读者)如何确定我的 topojson 文件的内部属性(例如 uk.objects.subunits)吗?

谢谢你的时间!

0 投票
1 回答
1567 浏览

topojson - 在 Mac OSX 上安装 topojson 时遇到问题

受 d3 的诱惑,我还在学习“让我们绘制地图”教程 ( http://bost.ocks.org/mike/map/ ),并在使用命令 npm install -g topojson 安装 topojson 时遇到问题。我安装了自制软件并安装了节点,并且都检查了。GDAL 是在 python 安装期间安装的,版本 1.10.0。

这是一些错误日志(我希望相关部分):

44 愚蠢的 gunzTarPerm 模式 ['755', '644'] 45 错误错误:EACCES,mkdir '/usr/local/lib/node_modules/topojson' 45 错误 { [错误:EACCES,mkdir '/usr/local/lib/node_modules /topojson'] 45 错误
errno: 3, 45 错误代码: 'EACCES', 45 错误路径: '/usr/local/lib/node_modules/topojson', 45 错误 fstream_type: '目录', 45 错误 fstream_path: '/usr /local/lib/node_modules/topojson', 45 错误 fstream_class: 'DirWriter', 45 错误 fstream_stack: 45 错误 ['/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36 :23', 45 错误
'/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53', 45 错误'Object.oncomplete (fs.js:107:15)'] }

我已经查看了有关具有“类似”问题的人的讨论,但似乎没有任何内容明确提到这个问题。我还检查了 /usr/local/lib/node_modules 目录的所有者和权限,发现它们没问题,但所有者是 24561。不确定这是否正确,我觉得很奇怪。

提前感谢您的帮助!弗朗西斯

0 投票
2 回答
1064 浏览

topojson - 将外部属性添加到县的 TopoJSON 文件

相关问题

我正在尝试将外部属性添加到 topojson 文件中(us-counties.json使用us-atlasmake topo/us-counties.json制作)。我正在处理这个例子。但是我生成的 topojson 文件us-counties-with-population.json根本没有任何属性

我的电话看起来像:

我的数据看起来像(head -n5 data.csv):

我正在使用 topojson v1.2.2。我想我可能遗漏了一些与 id 匹配方式相关的内容,但我不确定它是什么。