dinesh
dinesh

Reputation: 229

How can I merge multiple topojson files into single topojson file

I have US state topojson and Canada state topojson I want to merge them into single file. Can some one tell me how to merge two files into single topojson file. I'm using mercator projection while creating map

Upvotes: 7

Views: 4269

Answers (1)

Nobu
Nobu

Reputation: 10425

I was facing a similar issue, and ended up converting topojson files to geojson, merging them with geojson-merge, finally converting to topojson.

As Canada and the US share some boundaries (arcs in topojson), it should reduce the total file size.

for item in "us" "ca"
do
    topo2geo tracts=$item-geo.json < $item-topo.json
done
geojson-merge *-geo.json > combined-geo.json
geo2topo tracts=combined-geo.json > combined-topo.json

Upvotes: 7

Related Questions