Created
July 19, 2018 16:44
-
-
Save cjdd3b/f31e93c06827be09e0467198fb6c47c3 to your computer and use it in GitHub Desktop.
Make a Minnesota precinct map with 2014 turnout data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget ftp://ftp.gisdata.mn.gov/pub/gdrs/data/pub/us_mn_state_sos/bdry_votingdistricts/shp_bdry_votingdistricts.zip && \ | |
unzip shp_bdry_votingdistricts.zip && \ | |
shp2json bdry_votingdistricts.shp | \ | |
ndjson-join --left 'd.properties.COUNTYCODE + d.properties.PCTCODE' 'd.county_id + d.precinct_num' <(ndjson-split 'd.features') <(csv2json -n precincts_2014.txt -r ";") | \ | |
ndjson-map 'Object.assign(d[0].properties, d[1]), d[0]' | \ | |
ndjson-reduce 'p.features.push(d), p' '{type: "FeatureCollection", features: []}' | \ | |
geoproject 'd3.geoIdentity().reflectY(true).fitSize([960, 960], d)' | \ | |
geo2topo precincts=- | \ | |
toposimplify -f -p 0.05 | \ | |
topoquantize 1e5 > ./mn-precincts-albers-d3.json && \ | |
rm bdry_votingdistricts.* && | |
rm -rf ./metadata && | |
rm shp_bdry_votingdistricts.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment