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 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.