【发布时间】:2017-04-14 18:00:10
【问题描述】:
我在命令行制图 1 上执行 @mbostock 的 tutorial。这是我所做的:
1) 下载压缩包
wget https://www.arb.ca.gov/ei/gislib/gislib.htm/ca_air_basins.zip
(来自California Air Resources Board site)
2) 通过单击.zip 文件手动解压缩(unzip 命令不起作用,因为下载的文件没有'End-of-central-directory signature')
2) 将 shapefile 转换为 GeoJSON
shp2json CaAirBasin.shp -o ca.json
3) 使用 California Albers 制作 GeoJSON 投影(在 CaAirBasin.prj 文件中指定):
geoproject 'd3.geoConicEqualArea().parallels([34, 40.5]).rotate([120, 0]).fitSize([960, 960], d)' < ca.json > ca-albers.json
结果:
我得到的 ca-albers.json (223M) 比 ca.json (6.3M) 大得多。在教程中使用的人口普查区 shapefile 中,文件大小从 10 增加到 14 M。
更新:
似乎问题在于shp2json 步骤而不是geoProject 步骤。查看CaAirBasin.shp.xml, 有两组边界,bounding 和lbounding. 在我的情况下,lbounding 和在 100,000s 范围内的坐标值用于与教程中的 (-180, 180) 相反,使投影失败。
下一步有什么好的 - shp2json 的替代品是否适用于我的情况?或者如何将我的边界/坐标转换为适当的(-180,180)?
谢谢。
【问题讨论】: