<filename>package.json
{
  "name": "state-geo",
  "type": "module",
  "description": "US Census based maps.",
  "author": {
    "name": "<NAME>"
  },
  "version": "1.0.0",
  "license": "MIT",
  "private": true,
  "scripts": {
    "fetch:ma-school-districts": "./getData.sh GENZ2020/shp/cb_2020_25_unsd_500k.zip",
    "fetch:ma-tracts": "./getData.sh GENZ2020/shp/cb_2020_25_tract_500k.zip",
    "fetch:ma-population-by-tract": "pushd data; curl -o cb_2019_25_tract_B01003.json 'https://api.census.gov/data/2019/acs/acs5?get=B01003_001E&for=tract:*&in=state:25'; popd",
    "attempt1:shp": "npx shp2json data/GENZ2020/shp/cb_2020_25_unsd_500k.shp -o ma1.json",
    "attempt1:project": "npx geoproject 'd3.geoConicEqualArea().parallels([41, 42]).rotate([71.5, 0]).fitSize([800, 500], d)' < ma1.json > ma1-albers.json",
    "attempt1:svg": "npx geo2svg -w 800 -h 500 < ma1-albers.json > ma1-albers.svg",
    "attempt2:shp": "npx shp2json -n data/GENZ2020/shp/cb_2020_25_unsd_500k.shp | npx ndjson-filter 'd.properties.NAME !== \"Nantucket School District\"' > ma2.ndjson",
    "attempt2:shpjoin": "npx ndjson-reduce 'p.features.push(d), p' '{type: \"FeatureCollection\", features: []}' < ma2.ndjson > ma2.json",
    "attempt2:project": "npx geoproject 'd3.geoConicConformal().parallels([41 + 43 / 60, 42 + 41 / 60]).rotate([70 + 30 / 60, 0]).fitSize([800, 500], d)' < ma2.json > ma2-albers.json",
    "attempt2:svg": "npx geo2svg -w 800 -h 500 < ma2-albers.json > ma2-albers.svg",
    "attempt3:shp": "npx shp2json data/GENZ2020/shp/cb_2020_25_tract_500k.shp > ma3.json",
    "attempt3:project": "npx geoproject 'd3.geoConicConformal().parallels([41 + 43 / 60, 42 + 41 / 60]).rotate([70 + 30 / 60, 0]).fitSize([800, 500], d)' < ma3.json > ma3-albers.json",
    "attempt3:svg": "npx geo2svg -w 800 -h 500 < ma3-albers.json > ma3-albers.svg",
    "attempt4:shp": "shp2json data/GENZ2020/shp/cb_2020_25_tract_500k.shp > ma4.json",
    "attempt4:project": "geoproject 'd3.geoConicConformal().parallels([41 + 43 / 60, 42 + 41 / 60]).rotate([70 + 30 / 60, 0]).fitSize([800, 500], d)' < ma4.json > ma4-albers.json",
    "attempt4:nd-split": "ndjson-split 'd.features' < ma4-albers.json > ma4-albers.ndjson",
    "attempt4:nd-id": "ndjson-map 'd.id = d.properties.GEOID.slice(2), d' < ma4-albers.ndjson > ma4-albers-id.ndjson",
    "attempt4:nd-population": "ndjson-cat data/cb_2019_25_tract_B01003.json | ndjson-split 'd.slice(1)' | ndjson-map '{id: d[2] + d[3], B01003: +d[0]}' > ma4-population.ndjson",
    "attempt4:join-population": "ndjson-join 'd.id' ma4-albers-id.ndjson ma4-population.ndjson > ma4-albers-join.ndjson",
    "attempt4:map-population": "ndjson-map 'd[0].properties = {density: Math.floor(d[1].B01003 / d[0].properties.ALAND * 2589975.2356)}, d[0]' < ma4-albers-join.ndjson > ma4-albers-density.ndjson",
    "attempt4:map-population-color": "ndjson-map -r d3 '(d.properties.fill = d3.scaleSequential(d3.interpolateViridis).domain([0, 4000])(d.properties.density), d)' < ma4-albers-density.ndjson > ma4-albers-color.ndjson",
    "attempt4:population-debug": "ndjson-reduce 'p.features.push(d), p' '{type: \"FeatureCollection\", features: []}' < ma4-albers-density.ndjson > ma4-albers-density.json",
    "attempt4:svg": "geo2svg -n --stroke none -p 1 -w 800 -h 500 < ma4-albers-color.ndjson > ma4-albers-color.svg",
    "test": "echo nope"
  },
  "dependencies": {
    "d3": "^6.7.0",
    "d3-geo-projection": "^4.0.0",
    "ndjson-cli": "^0.3.1",
    "shapefile": "^0.6.6"
  }
}
