Overpass api get all streets with postal code and town of an area

hi,

i search for a solution to get a list of all streets in an area and its also necessary that every street get its postal code and its town/city/whatever.

i have already tired much but i dont get a good result, someone an idea?:confused:

Please tell us exactly what you have tried so far!

Postal codes are normally on the buildings, or address nodes, rather than on the streets.

Maybe try that search?

As trigpoint wrote, postal codes are not on streets, but depending on the country on buildings or in their own polygons. (postal code boundaries). The latter method is used in e.g. Germany and Belgium

Overpass is not a geocode, and while it has an is_in function, a normal Overpass query only returns the information that is mapped directly on the object. You have then have to iterate over all your objects to get the all the information you need via is_in.

Using a geocoder like Nominatim might be faster. I’m not too familiar with other techniques like downloading an extract and using postgis or qgis to do the work.

i tired something like do it in more steps and save what i choose before, for example choose a postalcode bondary → save postalcode and id.

with the the id i search now for for lvl 8 or lvl9 admin boundaries inside relation of the postal code, so i get the cities/villages relations → save name and id.

now i search the relation of the city for all its streets and add the saved data to it so i get all what i need, not so bad so far but its works not always,if i start higher with admin lvl6, it seems if the relation of the city with admin lvl6 and the relation of the postalcode are exactly laying on each other it dont find the postalcode relation inside the cityarea relation, so that i lose the postalcode in that chain

my querys for that steps look like this

1.[out:csv(“name”,::id;false)];relation(2145268);map_to_area;relation[“boundary”=“administrative”]“admin_level”=“6”;out;

2.[out:csv(“note”,“postal_code”,::id;false)];relation(62636);map_to_area;relation"boundary"=“postal_code”;out;