Skip to content

Instantly share code, notes, and snippets.

@sruf
Created January 6, 2023 08:02
Show Gist options
  • Save sruf/d70e1a633c82607d3ef51d4c22718668 to your computer and use it in GitHub Desktop.
Save sruf/d70e1a633c82607d3ef51d4c22718668 to your computer and use it in GitHub Desktop.
Administrative boundaries for SSD from OpenStreetMap

Administrative boundaries for SSD from OpenStreetMap

1) Extract relevant relations from OpenStreetMap

https://overpass-turbo.eu/ Copy+paste the below Overpass QL statement into the editor and press run. You will have to confirm a warning that the response size is large. Then export the generated data as GeoJSON.

2) Extract relevant shape layer

Load the data into the Editor on https://mapshaper.org/ Remove all unwanted layers (e.g. administrative centers) and only keep the polygon shapes. Reduce GeoJSON size through the "Simplify" option. 3% still maintains decent accurracy. Export to GeoJSON again.

3) Edit the GeoJSON

Load the data into the Editor on https://geojson.io/ and remove unwanted relations (e.g. states in Sudan) Export to GeoJSON again.

4) Remove unwanted metadata to reduce the filesize (optional)

Load the GeoJSON into a code editor, automatically format the file as JSON, manually remove @relations and other unwanted metadata (name translations in unneeded languages) Then remove unnecessary whitespace automatically and save.

[out:json]
[timeout:90]
;
( area[name="South Sudan"]; )->.searchArea;
relation
["admin_level"~"^[2,4,5]$"]
["type"="boundary"]
(area.searchArea);
(._;>;);
out geom;
/*out skel qt;*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment