Created
November 4, 2022 18:01
get country borders from planet-latest.osm.pbf openstreetmap export using osmium into a geojson file
This file contains 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
# on a Mac: brew install osmium-tool | |
# get relations with boundary=administrative tag, use -t to throw away unneeded tag info | |
# (otherwise a bunch of unneeded objects remain) | |
osmium tags-filter -t -o bound.osm.pbf planet-latest.osm.pbf r/boundary=administrative | |
# same, but filtering futher for admin_level=2 | |
osmium tags-filter -t -o admin_level_2.osm.pbf bound.osm.pbf r/admin_level=2 | |
#convert to geojson for further processing | |
osmium export admin_level_2.osm.pbf -o admin_level_2.geojson | |
# note: disputed territories might be a part of _both_ countries in this dataset. | |
# note2: this ran in a couple of minutes (for the whole planet!) on a machine with an M1 Pro processor. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment