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

Hello!

Is there a way to get all city names by zip codes?

Thanks in advance for your help.

asked 03 Mar '20, 16:46

vielhuber's gravatar image

vielhuber
11223
accept rate: 0%

edited 04 Mar '20, 15:16

H_mlet's gravatar image

H_mlet
5.4k1781

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.

(03 Mar '20, 20:58) alester

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.

(03 Mar '20, 21:07) vielhuber

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.

(03 Mar '20, 21:31) H_mlet

I mean: "Find city names for a specific zip code". I would prefer openstreetmap with overpass.

(03 Mar '20, 21:46) vielhuber

Sorry I did not refresh, so I did see the previous comments ! ;-) I'll try to answer.

(03 Mar '20, 21:53) H_mlet

See this query.

The tilde (~) is necessary because there are several postcodes for this city, separated by semicolons.

permanent link

answered 03 Mar '20, 21:57

H_mlet's gravatar image

H_mlet
5.4k1781
accept rate: 13%

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

I think that you can use is_in. If the cities have a admin_level and a name attributes, they should be included in the Area definition of overpass.

(17 Mar '20, 17:34) H_mlet

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:

×483
×362
×20

question asked: 03 Mar '20, 16:46

question was seen: 5,417 times

last updated: 17 Mar '20, 17:34

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