Projected Massachusetts town-by-town Geojson

Following along with Mr. Bostock and I have to write this down or will forget…

Massachusetts Town by Town map can be found here, as and town data that I wanted to use is here towns.ndjson.

$ geoproject 'd3.geoConicConformal().parallels([41 + 43 / 60, 42 + 41 / 60]).rotate([71 + 30 / 60], 0).fitSize([960, 600], d)' < ma.json > ma-nad83.json

$ ndjson-join 'd.mapid' ma-mapid.ndjson towns.ndjson > ma-joined.ndjson

$ ndjson-map 'd[0].properties = {id: d[1].id, town: d[1].town, fips:d[1].fips, name:d[1].name, mapid:d[1].mapid, consubfp:d[0].properties.COUSUBFP, geoid:d[0].properties.GEOID}, d[0].id = d[1].id, d[0]' < ma-joined.ndjson >ma-joined-out.ndjson

$ ndjson-reduce < ma-joined-out.ndjson | ndjson-map '{type: "FeatureCollection", features: d}' >ma-towns.json

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>