forked from g0v/twgeojson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (49 loc) · 1.73 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#config simplify factor for each topojson
twVillage1982.topo.json.simplify=0.00000008
twTown1982.topo.json.simplify=0.00000005
twCounty2010.topo.json.simplify=0.00000008
twVote1982.topo.json.simplify=0.0000001
all: twVillage1982.topo.json twTown1982.topo.json twCounty2010.topo.json twVote1982.topo.json
clean:
rm -f tw*.geo.json tw*.topo.json
rm -rf tmpdir
tmpdir:
mkdir -p tmpdir
tmpdir/tw-town.rar: | tmpdir
curl -o $@ http://www.iot.gov.tw/public/Attachment/71018174871.rar
tmpdir/tw-village.rar: | tmpdir
curl -o $@ http://www.iot.gov.tw/public/Attachment/7101817115371.rar
tmpdir/tw-county.rar: | tmpdir
curl -o $@ http://www.iot.gov.tw/public/Attachment/7101816594871.rar
tmpdir/TWN_VILLAGE.shp: tmpdir/tw-village.rar
(cd tmpdir && unrar x ../$<)
touch $@
tmpdir/TWN_TOWN.shp: tmpdir/tw-town.rar
(cd tmpdir && unrar x ../$<)
touch $@
tmpdir/TWN_COUNTY.shp: tmpdir/tw-county.rar
(cd tmpdir && unrar x ../$<)
touch $@
# original command: ogr2ogr -f geojson $@ $<
twCounty2010.geo.json: tmpdir/TWN_COUNTY.shp
./bin/shp2geojson.py $< $@
twTown1982.geo.json: tmpdir/TWN_TOWN.shp
./bin/shp2geojson.py $< $@
twVillage1982.geo.json: tmpdir/TWN_VILLAGE.shp
./bin/shp2geojson.py $< $@
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} $< > $@
vote: twVote1982.topo.json
village: twVillage1982.topo.json
town: twTown1982.topo.json
county: twCounty1982.topo.json
clean-topo:
rm tw*.topo.json
nlsc:
lsc cleanup-nlsc.ls > villages.json
ogr2ogr -f 'ESRI Shapefile' tmpdir/tw-fixed/ villages.json -lco ENCODING=UTF-8