Reputation: 347
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
Upvotes: 3
Views: 1790
Reputation: 18258
You may simplify them separately and merge them.
Given you have your 3 shapefiles in your folder, you could use a makefile a bit such :
#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
Note: There are plenty of good reasons Why Use Make
Note2: Since topojson script also accept .shp for input, we could skip the #SHP2JSON task.
Upvotes: 5