我在我的makefile中尝试了以下两个指令:
states_topojson.json: states.shp
node_modules/.bin/topojson
-o $@
states_topojson.json: states.shp
node_modules/.bin/topojson
-o $@
--projection='width = 960, height = 600, d3.geo.albersUsa()
.scale(1280)
.translate([width / 2, height / 2])'
--simplify=.5
--filter=none
我可以制作其他文件,所以我知道topojson是正确安装的节点。
我的状态。shp文件直接来自Bostock Us-Atlas,并使用:
make shp/us/states-unfiltered.shp
看到了当我尝试运行:
topojson -o output.json states.shp
我得到这个噪音:
Trace: { [Error: ENOENT, open 'states.dbf'] errno: 34, code: 'ENOENT', path: 'states.dbf' }
at output (/usr/local/lib/node_modules/topojson/bin/topojson:259:29)
at notify (/usr/local/lib/node_modules/topojson/node_modules/queue-async/queue.js:45:26)
at /usr/local/lib/node_modules/topojson/node_modules/queue-async/queue.js:35:11
at /usr/local/lib/node_modules/topojson/bin/topojson:236:23
at /usr/local/lib/node_modules/topojson/node_modules/shapefile/index.js:14:23
at /usr/local/lib/node_modules/topojson/node_modules/shapefile/read.js:26:29
at notify (/usr/local/lib/node_modules/topojson/node_modules/queue-async/queue.js:45:26)
at /usr/local/lib/node_modules/topojson/node_modules/queue-async/queue.js:35:11
at /usr/local/lib/node_modules/topojson/node_modules/shapefile/index.js:45:25
at /usr/local/lib/node_modules/topojson/node_modules/shapefile/dbf.js:16:30
将.dbf文件移动到根文件夹使topojson命令行工作。但是makefile仍然失败
这可能需要一些迭代。
Try this makefile (Make是一个工具;makefile是Make读取的文件,一种脚本):
output.json:
topojson -o output.json states.shp
告诉我们它是否有效,然后我们可以继续。