3

I would like to combine three geojson files into one topojson file. two of these files are pretty straightforward shapefiles. they need no simplifying.

one of them is the 10m cultural natural earth vector file. it's geojson is 24.8mb. I need the 10m because i need small islands to remain on the map (though i'll likely simplify them out but retain them with --allow-empty).

is it possible to simplify the 10m cultural file with topojson, then combine it with the other two geojson files using topojson but without simplifying?

or is this a totally crooked approach, and i should be approaching in another way?

thanks for any help

4

1 回答 1

5

您可以分别简化它们并将它们合并。

鉴于您的文件夹中有 3 个 shapefile,您可以使用这样的 makefile:

#Merge:
final.json: map1.json map2.json world10m.json
  topojson --id-property none --allow-empty -o final.json -- map1.json map2.json world10m_s.json

# Simplify:
world10m_s.json -- world10m.json
  topojson --id-property none --allow-empty --simplify 0.5 -p name=Name -o world10m_s.json -- world10m.json

# SHP2JSON
world10m.json: world10m.shp
  ogr2ogr -f GeoJSON world10m.json world10m.shp
map1.json: map1.shp
  ogr2ogr -f GeoJSON map1.json map1.shp
map2.json: map2.shp
  ogr2ogr -f GeoJSON map2.json map2.shp

注意:为什么使用 Make有很多充分的理由

注意 2:由于 topojson 脚本也接受 .shp 作为输入,我们可以跳过 #SHP2JSON 任务。

于 2013-08-27T08:03:21.860 回答