i am reading pbf files of OSM using the binary library for Java.
I am interested in administrative level 2, 4, 8, 9 data.
So i managed to find those information - The particular relations contain all those information. So in the next step I need to understand the multi-polygon creation for those areas.
The relation contains mostly references to ways and some nodes. For example for germany if I remember correctly I have 670+ ways defining the border.
I need a second and third parse on the data since I am using a stream approach and I am not creating a database out of the information.
What I miss are information what the roleSid is and how it is translating towards the convult. I understand for instance that there are parts defining different polygones and that there are positive and negative polygones. One that needs to be unified with other polygones whereas others have to be substracted.
An example would be a big city like DC or NY forming its own administrative area then the surrounded state. Therefore there must exist a posibility to add a ‘hole’ to an area.
So the question goes what the roleSid is and how I translate the ids.
Also I would love to know how the ways and nodes must be combined and how I can detect if I have an multipolygon area. So any help in any direction would be great.
PS: I try to come up with an extract of all polygones to answer questions like what city part a mobile user is in and when he is outside of it and whats the next closest city / state or whatever. Currently one has mostly only the point of a imaginare center and one has closest match. But I need a solution based on the actual borders.
PSS: One thing that I find interesting is that level 1 is missing. Would be fine if we had unions like the EU or other entities being mapped towards level 1 since this would be an administrative super power to the states. Same goes for the common wealth and the russian federation etc. Wouldnt be hard to calculate the boundaries using the state boundaries.