Why not ask your question on the new OpenStreetMap Community Forum?


I’m trying to extract admin boundaries (and all the relations in between) from country specific osm.pbf file. I have tried using OsmSharp (c# lib) and PyOsmium (python lib) to do the extraction, but I can’t seem to figure out how to do it properly. I don’t get expected relations and osm.pbf file contains info on neighbouring countries as well so I can’t just do “get all admin_level=4” or similar.

I worked around neighbouring countries by first querying admin_level=2 with known country osm id and getting relations from there, I get relations of admin_level=4 which are fine, but from there on, relations are not found (for deeper levels).

Expected output would be something like you can find here OSM-Boundaries 1 where it would be few admin levels deep with relations to one another. I would later store that data in my database for future use.

Can somebody point me in the right direction on how to do it? with either OsmSharp/PyOsmium or just an guide I could try to translate in to code, I would really appreciate it.


asked 13 Nov, 16:13

anopen123's gravatar image

accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 13 Nov, 16:13

question was seen: 113 times

last updated: 13 Nov, 16:13

powered by OSQA