Skip to content

Commit

Permalink
Use mapshaper(https://github.com/mbloch/mapshaper) to convert .shp to…
Browse files Browse the repository at this point in the history
… .topojson.
  • Loading branch information
yllan committed Apr 19, 2014
1 parent b983515 commit eed8b63
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
23 changes: 8 additions & 15 deletions Makefile
Expand Up @@ -36,24 +36,17 @@ tmpdir/TWN_COUNTY.shp: tmpdir/tw-county.rar
touch $@

# original command: ogr2ogr -f geojson $@ $<
twCounty2010.geo.json: tmpdir/TWN_COUNTY.shp
./bin/shp2geojson.py $< $@
twCounty2010.topo.json: tmpdir/TWN_COUNTY.shp
mapshaper -p 0.01 $< -f topojson --encoding big5 -o $@

twTown1982.geo.json: tmpdir/TWN_TOWN.shp
./bin/shp2geojson.py $< $@
twTown1982.topo.json: tmpdir/TWN_TOWN.shp
mapshaper -p 0.01 $< -f topojson --encoding big5 -o $@

twVillage1982.geo.json: tmpdir/TWN_VILLAGE.shp
./bin/shp2geojson.py $< $@
twVillage1982.topo.json: tmpdir/TWN_VILLAGE.shp
mapshaper -p 0.01 $< -f topojson --encoding big5 -o $@

twVote1982.geo.json: tmpdir/TWN_VILLAGE.shp
./vote/shp2geojson-vote.py $< $@

.SUFFIXES: .geojson .topojson

%.topo.json: %.geo.json
$(eval simplify=${${@}.simplify})
$(eval simplify=$(if ${simplify},${simplify},0.00000001))
./node_modules/.bin/topojson -p -s ${simplify} $< > $@
twVote1982.topo.json: tmpdir/TWN_VILLAGE.shp
mapshaper -p 0.01 $< -f topojson --encoding big5 -o $@

vote: twVote1982.topo.json
village: twVillage1982.topo.json
Expand Down
2 changes: 1 addition & 1 deletion twCounty2010.topo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion twTown1982.topo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion twVillage1982.topo.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion twVote1982.topo.json

Large diffs are not rendered by default.

0 comments on commit eed8b63

Please sign in to comment.