-
Notifications
You must be signed in to change notification settings - Fork 143
/
prepublish
executable file
·75 lines (65 loc) · 3.22 KB
/
prepublish
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
#!/bin/bash
rm -rvf *-10m.json
mkdir -p build
if [ ! -f build/cb_2017_us_county_5m.shp ]; then
curl -o build/cb_2017_us_county_5m.zip 'https://www2.census.gov/geo/tiger/GENZ2017/shp/cb_2017_us_county_5m.zip'
unzip -od build build/cb_2017_us_county_5m.zip cb_2017_us_county_5m.shp cb_2017_us_county_5m.dbf
chmod a-x build/cb_2017_us_county_5m.*
fi
if [ ! -f build/cb_2017_us_state_5m.shp ]; then
curl -o build/cb_2017_us_state_5m.zip 'https://www2.census.gov/geo/tiger/GENZ2017/shp/cb_2017_us_state_5m.zip'
unzip -od build build/cb_2017_us_state_5m.zip cb_2017_us_state_5m.shp cb_2017_us_state_5m.dbf
chmod a-x build/cb_2017_us_state_5m.*
fi
if [ ! -f build/cb_2017_us_nation_5m.shp ]; then
curl -o build/cb_2017_us_nation_5m.zip 'https://www2.census.gov/geo/tiger/GENZ2017/shp/cb_2017_us_nation_5m.zip'
unzip -od build build/cb_2017_us_nation_5m.zip cb_2017_us_nation_5m.shp cb_2017_us_nation_5m.dbf
chmod a-x build/cb_2017_us_nation_5m.*
fi
geo2topo -q 1e5 -n counties=<( \
shp2json --encoding utf-8 -n build/cb_2017_us_county_5m.shp \
| ndjson-filter '!/000$/.test(d.properties.GEOID)' \
| ndjson-map '(d.id = d.properties.GEOID, delete d.properties, d)') \
| toposimplify -f -s 1e-7 \
| topomerge states=counties -k 'd.id.slice(0, 2)' \
| topomerge nation=states \
| node ./properties.js \
> counties-10m.json
geo2topo -q 1e5 -n counties=<( \
shp2json --encoding utf-8 -n build/cb_2017_us_county_5m.shp \
| ndjson-filter '!/000$/.test(d.properties.GEOID)' \
| ndjson-map '(d.id = d.properties.GEOID, delete d.properties, d)' \
| geoproject -n 'd3.geoAlbersUsa().scale(1300).translate([487.5, 305])') \
| toposimplify -f -p 0.25 \
| topomerge states=counties -k 'd.id.slice(0, 2)' \
| topomerge nation=states \
| node ./properties.js \
> counties-albers-10m.json
geo2topo -q 1e5 -n states=<( \
shp2json --encoding utf-8 -n build/cb_2017_us_state_5m.shp \
| ndjson-filter '!/000$/.test(d.properties.GEOID)' \
| ndjson-map '(d.id = d.properties.GEOID, d.properties = {name: d.properties.NAME}, d)') \
| toposimplify -f -s 1e-7 \
| topomerge nation=states \
> states-10m.json
geo2topo -q 1e5 -n states=<( \
shp2json --encoding utf-8 -n build/cb_2017_us_state_5m.shp \
| ndjson-filter '!/000$/.test(d.properties.GEOID)' \
| ndjson-map '(d.id = d.properties.GEOID, d.properties = {name: d.properties.NAME}, d)' \
| geoproject -n 'd3.geoAlbersUsa().scale(1300).translate([487.5, 305])') \
| toposimplify -f -p 0.25 \
| topomerge nation=states \
> states-albers-10m.json
geo2topo -q 1e5 -n nation=<( \
shp2json --encoding utf-8 -n build/cb_2017_us_nation_5m.shp \
| ndjson-filter '!/000$/.test(d.properties.GEOID)' \
| ndjson-map '(d.id = d.properties.GEOID, d.properties = {name: d.properties.NAME}, d)') \
| toposimplify -f -s 1e-7 \
> nation-10m.json
geo2topo -q 1e5 -n nation=<( \
shp2json --encoding utf-8 -n build/cb_2017_us_nation_5m.shp \
| ndjson-filter '!/000$/.test(d.properties.GEOID)' \
| ndjson-map '(d.id = d.properties.GEOID, d.properties = {name: d.properties.NAME}, d)' \
| geoproject -n 'd3.geoAlbersUsa().scale(1300).translate([487.5, 305])') \
| toposimplify -f -p 0.25 \
> nation-albers-10m.json