ndjson-map 'd.properties = {prop1: d.properties.prop1, p2: d.properties.prop2}, d' \
< myfile.ndjson \
> myfile-filtered.ndjson
# download data
# source: https://gadm.org/download_country_v3.html
curl \
-L -C - 'https://biogeo.ucdavis.edu/data/gadm3.6/shp/gadm36_KHM_shp.zip' \
-o ./KHM_adm.zip \
unzip -n ./KHM_adm.zip -d ./
topojson \
--bbox \
--id-property none \
-p name=NAME_1 \
-p code=ID_1 \
-p L0=NAME_0 \
-q 1e4 \
--filter=small \
-o KHM_adm.topo.json \
-- admin_1=KHM_adm1.shp admin_2=KHM_adm2.shp
npx topojson --bbox --id-property none -p name=NAME_1 -p code=ID_1 -p L0=NAME_0 -q 1e4 --filter=small -o KHM_adm.topo.json -- admin_1=gadm36_KHM_1.shp admin_2=gadm36_KHM_2.shp
Sources
Npm toolchain
Former:
topojson: see #api-reference for equivalence of ancient options with recent modules.
shapefile for converting ESRI shapefiles to GeoJSON
topojson-server for converting GeoJSON to TopoJSON
topojson-simplify for topology-preserving simplification and filtering for TopoJSON.
topojson-client for manipulating TopoJSON and converting it back to GeoJSON
topo2geo states=us-states.geo.json < US-input.topo.json # `states` is a feature collection within input topojson, copied and expanded in us-states.geo.jsontopo2geo -l < administrative.topo.jsonreturnsadmin_0 admin_1 places disputed.1e4,1e5or1e6.d3-geo-projection for manipulating GeoJSON,
ndjson-cli for operating on newline-delimited JSON streams.
Output can be chained:
Specify the output TopoJSON file name. Defaults to “-” for stdout.
Shapefile
Topojson
Command