See this query. The tilde (~) is necessary because there are several postcodes for this city, separated by semicolons. answered 03 Mar '20, 21:57 H_mlet Hello! Thanks for your answer. Unfortunately I get an empty result, tried several prominent zip codes from germany.
(03 Mar '20, 22:23)
vielhuber
it's normal that you get an empty result in Germany. The postal codes are not mapped on the city. They are mapped as separate boundaries.
(04 Mar '20, 04:06)
escada
Sorry, I forgot that on some tricky points, standards vary widely. You can use this query, to find the relation of a postcode, and in the note tag you have the name of the associated place (I guess, it's not documented anywhere). With this other query, you'll get all the place nodes inside the postal code area. Trouble is I don't understand how a city is tagged in Germany. And anyway a place=city node will be only in one postal code area, leaving the others empty. You could ask on the german forum for more localized help. Regards.
(04 Mar '20, 15:15)
H_mlet
Hello H_mlet, thanks for your help! This is very helpful and interesting. The thing is: Cities are big areas with postal code areas inside. I think this must be a complex query (because we can only go the other way around). Is this even possible with overpass turbo?
(17 Mar '20, 14:22)
vielhuber
|
Can you tell us more about what goal you're trying to reach? Do you have ZIP codes and you want to identify the city in which they're each located? Keep in mind that while some parts of the US may have more ZIP codes mapped, other parts might not have any.
Hello! That's exactly the goal: Provice a single zip code and get all cities that have that zip code. I don't mind if the results may vary (in Germany, I think the results are quite good). From a query standpoint I thing I need: Get the area A for that zip code and get all areas of type city where area A is inside.
You mean in the whole world ? Or find city names for a specific zip code ?
BTW Wikidata might be a better source for this. See for example this discussion.
I mean: "Find city names for a specific zip code". I would prefer openstreetmap with overpass.
Sorry I did not refresh, so I did see the previous comments ! ;-) I'll try to answer.