forked from camshaft/world-json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
78 lines (67 loc) · 1.93 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
69
70
71
72
73
74
75
76
77
78
EXTRACT = bin/extract
TOPOJSON = node_modules/.bin/topojson
TOPOMERGE = node_modules/.bin/topojson-merge
CDN=http://static.quattroshapes.com
NATURAL_EARTH_CDN = http://naciscdn.org/naturalearth
#COUNTRY_GENONAME = http://download.geonames.org/export/dump/countryInfo.txt
ADM0=qs_adm0_region.zip
ADM1=qs_adm1_region.zip
SHP0=shp/qs_adm0_region.shp
SHP1=shp/qs_adm1_region.shp
GEOS = $(wildcard geojson/*.geojson)
TOPOS = $(patsubst geojson/%.geojson,topojson/%.topojson,$(GEOS))
topojson.tar.gz: $(TOPOS) geojson
@tar -zcvf $< topojson
topojson/WORLD.topojson: geojson/WORLD.geojson
mkdir -p $(dir $@)
$(TOPOJSON) \
--simplify-proportion=.1 \
--quantization 1e5 \
--id-property=+id \
-- regions=$< \
| $(TOPOMERGE) \
-o $@ \
--io=regions \
--oo=land \
--no-key
topojson/%.topojson: geojson/%.geojson
mkdir -p $(dir $@)
$(TOPOJSON) \
--quantization 1e5 \
--id-property=+id \
-- regions=$< \
| $(TOPOMERGE) \
-o $@ \
--io=regions \
--oo=land \
--no-key
geojson: shp/ne_10m_admin_0_countries.shp tsv/country_info.tsv shp/ne_10m_admin_1_states_provinces.shp
@mkdir -p $@
@$(EXTRACT) $@ shp/ne_10m_admin_0_countries.shp tsv/country_info.tsv shp/ne_10m_admin_1_states_provinces.shp
shp/qs_%.shp: zip/qs_%.zip
@mkdir -p $(dir $@)
@unzip -d shp $<
@touch $@
shp/ne_%_admin_0_countries.shp: zip/ne_%_admin_0_countries.zip
@mkdir -p $(dir $@)
@unzip -d shp $<
@touch $@
shp/ne_%_admin_1_states_provinces.shp: zip/ne_%_admin_1_states_provinces.zip
@mkdir -p $(dir $@)
@unzip -d shp $<
@touch $@
zip/$(ADM0):
@mkdir -p $(dir $@)
@curl $(CDN)/$(ADM0) -o $@
zip/$(ADM1):
@mkdir -p $(dir $@)
@curl $(CDN)/$(ADM1) -o $@
## TODO remove the comments at the top of the file
tsv/country_info.tsv:
@mkdir -p $(dir $@)
@curl $(COUNTRY_GENONAME) -o $@
zip/ne_10m_%.zip:
@mkdir -p $(dir $@)
@curl "$(NATURAL_EARTH_CDN)/10m/cultural/ne_10m_$*.zip" -o $@.download
@mv $@.download $@
.PHONY: topojson