问题标签 [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 投票
0 回答
546 浏览

topojson - toposon 没有安装

要安装我正在运行的拓扑子

在命令提示符下

它抛出错误'run' is not recognized as an internal or external command, operable program or batch file.

我也安装了GDAL

请帮助我在 Windows 7 上安装 toposon

提前致谢。

0 投票
1 回答
14530 浏览

javascript - 我在哪里可以获得印度的 .geojson 文件,而不是每个州/地区或任何其他区别的单独文件?

印度有.geoJSON文件吗?我想使用d3.js州、城市进行数据可视化,因此需要代表印度的 GEOJSON 文件。我应该从哪里开始,或者我的方法应该是什么?

此外 ,对于第一次处理地理数据转换的Windows 人员来说, Mike 的教程也没有多大帮助。

请帮忙。

谢谢,

0 投票
1 回答
306 浏览

javascript - 叠加层未显示在数据生成的 d3 形状之上

我是 d3.js 的菜鸟。我正在使用 topoJSON 数据来渲染地图,到目前为止它运行良好。现在我想在每个国家/地区的顶部覆盖一些数据,例如文本或圆圈,我正在碰壁。我有类似这样的代码:

正确呈现我的地图。为了在上面覆盖一些圆圈,我执行以下操作:

这非常麻烦(特别是它访问国家数组的方式),但它成功地为代表一个国家的每条路径附加了一个圆圈。问题是圆圈存在于 SVG 标记中,但根本没有出现在文档中。我显然做错了什么,但我不知道是什么。

0 投票
0 回答
1107 浏览

gdal - Library not loaded - ogr2ogr - topojson (Mike Bostock's d3.js map tutorial)

I'm trying to use ogr2ogr to filter a shapefile. I'm working through Mike Bostock's Let's Make a Map tutorial. A bit of googling - including here - hasn't led to any solutions yet. I'm also VERY new to topojson (and shapefiles in general; my background is in economics/statistical software like Stata), so I'm not sure what I'm doing and where things are going wrong. Either way - here's the error result I'm getting:

No idea what liblwgeom-2.1.1.dylib is, what it does, where I get it, etc. Google hasn't helped much on defining it either.

FWIW, I'm on a Mac, I brew installed npm and gdal, and then npm installed topojson.

Thanks,

a

Edited to add: I just brew reinstalled gdal, because I remembered getting a warning (Caveats). See below:

I actually tried to run export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH literally as-is, and it returned nothing. (Not sure if something happened in the background?) Basically fumbling in the dark!

0 投票
1 回答
1975 浏览

d3.js - d3 topojson 放大城市地图

我正在处理带有 topojson 格式数据的 d3 地图。我可以绘制国家形状,缩放和窗格效果很好。

问题是当我尝试在地图上绘制城市时。我不知道如何用这些点管理缩放:点大小必须相同,但点必须正确平移。

这是一个示例,当我缩放地图时,这些点会从地图中平移出来:

0 投票
1 回答
8454 浏览

d3.js - D3 - 如何在手动缩放和平移到国家路径后获得正确的比例和翻译原点

我有一个具有平移和缩放功能的拓扑图。

点击国家,我放大/平移到国家,使用这个:

但是,如果我继续拖动平移,地图会在点击发生之前猛拉回到初始位置,然后再平移。平移/缩放的代码在这里:

换句话说,在通过单击放大一个点,然后通过重绘功能拖动后,重绘不会选择正确的平移+缩放以继续。

0 投票
1 回答
767 浏览

topojson - 如何使用 topojson API 进行简化?

topojson所以我使用标志从命令行简化使用没有问题-s,但是,我不知道如何从node模块中做到这一点。

我看到了一种topojson.simplify()方法,但由于没有文档,我无法弄清楚它是如何工作的。

有没有人有任何见解?

0 投票
1 回答
2581 浏览

json - 将数据 (.csv/json) 与 topojson 组合

我正在尝试将 topojson (从形状文件生成)和数据结合起来,以便我可以在地图上显示相关选择的数据,但还没有运气。

形状文件特征/属性:id、代码、名称

数据文件(我有 .csv 和 josh)文件 1 列:year1、year2、year3、....标识符、%change。(数据文件中的“标识符”列等于形状文件中的“代码”)

我有 5 个 json 文件中的数据。

我希望通过结合这两个文件,得到一个带有属性、id、代码、名称、year1、year2、year3、...%change 的 topojson 文件。

想法是,我可以只使用一个 topojson 文件来显示地图以及相关数据。

这是我到目前为止所尝试的,

生成topojson: 1. ogr2ogr -f GeoJSON geojsonoutput.json shpefile.shp 2. topojson -o final.json -e *.json --id-property=identifier -p -- geojsonoutput.json

}

我可以使用以下内容访问地图信息,

topojson.feature(data, data.objects.geojsonoutput).features

但是,不确定如何访问数据..例如在(“file1”或“file2”)键中。

实际上..我走对了方向吗?到目前为止我所做的是否正确?有没有更好的方法来实现我想要做的事情?

任何指导都会很棒。我对 D3 还是有点陌生​​,但到目前为止我很享受使用它。

干杯

0 投票
1 回答
1219 浏览

node.js - 使用 node npm 在 OSX Mavericks 上安装 topojson

我无法通过节点 npm(使用 sudo)在 Mavericks 上安装 topojson。我安装了 Xcode 命令行工具并尝试了各种解决方案但没有运气。这是我的输出:

有任何想法吗?

0 投票
2 回答
1369 浏览

node.js - node.js 中的 Geojson 到 Topojson

我的 postGIS 数据库中有一个形状文件。我已使用以下代码将其检索到 node.js 中的 geojson 中。

工作正常..但我的要求是我必须将此geojson文件转换为“ TOPOJSON”。

所以我有这个代码:

但我仍然在检索geojson文件作为输出..所以请指导我实现这一点..提前致谢。

另外,当我用谷歌搜索时,我得到了这个代码:

但我完全无法理解这一点..我必须放弃功能[..]和收藏品..