NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi,

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.

Thanks

asked 13 Nov '23, 16:13

anopen123's gravatar image

anopen123
11112
accept rate: 0%

Follow this question

By Email:

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

By RSS:

Answers

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:

×38
×6
×6

question asked: 13 Nov '23, 16:13

question was seen: 446 times

last updated: 13 Nov '23, 16:13

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum