Last active
February 5, 2023 20:14
-
-
Save johnjreiser/57394932506541f772e0b6d53c56565a to your computer and use it in GitHub Desktop.
New Jersey counties in TopoJSON
This file contains hidden or 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
#!/bin/bash | |
# get us topojson file | |
curl -o us.topojson https://gist.githubusercontent.com/cmdoptesc/4714c586f69425043ae3/raw/d534aba169207548a8a3d670c9c2cc719ff05c47/us.json | |
# extract NJ counties to GeoJSON | |
ogr2ogr -f GeoJSON nj.geojson us.topojson counties -where "id like '34%'" -lco COORDINATE_PRECISION=7 | |
# install topojson-server (if not already installed) | |
npm install topojson-server | |
# convert the GeoJSON to TopoJSON | |
npx geo2topo nj.geojson > nj.topojson | |
# make pretty if desired (using https://stedolan.github.io/jq/) | |
jq . nj.topojson > nj.topojson.pretty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment