Please tell me how to match osm streets and villages without areas from PBF file
Here is the example street: Way: Słupska (240777479) | OpenStreetMap
If I search it via OSM panel it will give me the hierarchy with city “Dobra”
Buti it is only a node and there is not relation between them
Welcome to the forum!
A .pbf file is a raw dump of nodes, ways and relations and I guess the only way to find the village closest to this Słupska is find all place=village nodes in the .pbf and see which on is the closest by.
What are you searching for the village of or the municipality?
You could (but that doesn’t mean that you should or would want to) examine address objects (that is building polygons or address nodes), and extract addr:street and addr:city. If this works well depends on
- having good address coverage (a given in Poland)
- addr:city being added to the addresses (local mapping practice dependent)
- addr:city being an actual place and not a postal city (this depends on how your addresses are regulated)
Hey, thank you for reply!
I use osmium + geopandas for processing but the closest lookup approach can be misleading as it seems to me
My initial aim was to collect all streets for all villages, so matching them became a problem when there is no valid area for the village
And I noticed that OSM search can associate streets with a single node villages
In Nominatim I found distances to different objects for such villages, so maybe you are right that I need just to select the closest place
Hi! Thank you for attention!
Maybe I needed to add a context:
Sorry, but I misunderstood that you explained. I use ways to retrieve streets information
The approach I suggested would be, to 1st extract all addresses for a village and then generate a list of streets from that, then extract the streets.
Alternative approach would be to generate the convex hull (Convex hull - Wikipedia) of the addresses for one village and use that to extract the streets, but that is more suited to a situation in which you have the data in a geospatial database.
My expectation would be that this would give far better results than just a distance based approach.
Okay, I got it! Thanks for idea!
Before I forget: what you are going to retrieve from OSM as a street, regardless of method, is often not going to be one continuos geometry from beging to end. The OSM data model requires the way elements to be split when attributes (tags) and relation membership change, so typically you will retrieve multiple ways for one “street” that you will have to combine to get a single geometry (or multiple in the case of dual carriageways).
Sorry to bother you
Here I found the children of “Dobra” that contain streets
Maybe you know how to get them from osm data?
Also I started to use addr:street, but addr:city is not ID while addr:city:simc is quite rare tag