forked from topojson/us-atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepublish
executable file
·36 lines (31 loc) · 1.47 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
#!/bin/bash
rm -rvf us
mkdir -p build us
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
geo2topo -q 1e5 -n counties=<( \
shp2json -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(1280).translate([480, 300])') \
| toposimplify -f -p 0.25 \
| topomerge states=counties -k 'd.id.slice(0, 2)' \
| topomerge nation=states \
| node ./properties.js \
> us/10m.json
geo2topo -q 1e5 -n states=<( \
shp2json -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(1280).translate([480, 300])') \
| toposimplify -f -p 0.25 \
| topomerge nation=states \
> us/states-10m.json