Skip to content

Instantly share code, notes, and snippets.

@slattery
Last active March 6, 2020 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slattery/06cf43828b87c0a6ddaba344539e396b to your computer and use it in GitHub Desktop.
Save slattery/06cf43828b87c0a6ddaba344539e396b to your computer and use it in GitHub Desktop.
topojson with regions, subregions, and countries from 50m natural earth source

Source: https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_50m_admin_0_countries.geojson Clues: https://medium.com/@mbostock/command-line-cartography-part-2-c3a82c5c0f3 Commands:

ndjson-split 'd.features' \
 < ne_50m_admin_0_countries.geojson \
 | ndjson-filter 'd.properties.ISO_A3 !== "ATA"' \
 | ndjson-filter 'd.properties = {ISO_A3: d.properties.ISO_A3, ISO_N3: d.properties.ISO_N3, REGION_UN: d.properties.REGION_UN, SUBREGION: d.properties.SUBREGION, NAME: d.properties.GEOUNIT, REGION_WB: d.properties.REGION_WB, CONTINENT: d.properties.CONTINENT }' \
 | geo2topo -n countries=- \
 > ne_50m_6f_countries.topo.json

topomerge subregions=countries -k 'd.SUBREGION' < ne_50m_6f_countries.topo.json > ne_50m_6f_countries_subs.topo.json
topomerge regions=subregions   -k 'd.REGION_WB' < ne_50m_6f_countries_subs.topo.json > ne_50m_6f_countries_subs_regs.topo.json

toposimplify -p .1 -f < ne_50m_6f_countries_subs_regs.topo.json > nes_50m_6f_countries_subs_regs.topo.json
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment