Skip to content

Consider GADM as source for admin module #24

@hugolpz

Description

@hugolpz
  • inspect data in QGIS
  • adapt makefile
  • change loop data / frames ?

Sources

Npm toolchain

Former:

  • topojson: see #api-reference for equivalence of ancient options with recent modules.

  • shapefile for converting ESRI shapefiles to GeoJSON

    • shp2json -n input.shp > output.geojson
    • shp2json --encoding utf8
  • topojson-server for converting GeoJSON to TopoJSON

    • geo2topo --quantization count
  • topojson-simplify for topology-preserving simplification and filtering for TopoJSON.

    • toposimplify -s value
    • toposimplify --filter-all
  • topojson-client for manipulating TopoJSON and converting it back to GeoJSON

    • topo2geo [options…] <name=file>… : Converts one or more TopoJSON objects from an input topology to one or more GeoJSON features.
      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.json
    • topo2geo --list : List the names of the objects in the input topology, and then exit. For example topo2geo -l < administrative.topo.json returns admin_0 admin_1 places disputed.
    • topoquantize [options…] [file] : quantized number of possible coordinates on any axis, usually either 1e4, 1e5 or 1e6.
  • d3-geo-projection for manipulating GeoJSON,

  • ndjson-cli for operating on newline-delimited JSON streams.

    • ndjson-map [expression]
ndjson-map 'd.properties = {prop1: d.properties.prop1, p2: d.properties.prop2}, d' \
  < myfile.ndjson \
  > myfile-filtered.ndjson

Output can be chained:

  • -o file
  • -out file
    Specify the output TopoJSON file name. Defaults to “-” for stdout.
# 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

Shapefile

Screenshot_2020-10-09_14-21-30
Screenshot_2020-10-08_23-16-21
Screenshot_2020-10-08_23-18-20

Topojson

Command

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

Screenshot_2020-10-09_14-24-28

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions