This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Nominatim wrong order when searching for postal code + city

0
1

Hello,

I got a tool that detects longitude and latitude of specific cities with postal code + city name in the query. I took the first place that is returned automatically, because there are many requests I had to do one time for our database.

Unfortunately, when I search for München in Germany, the first result is not the correct city, even when I request it with the right postal code and the first result got another postal code:

http://nominatim.openstreetmap.org/search?q=81660+M%C3%BCnchen+DE&format=xml&addressdetails=1

Can anybody provide me any solution?

asked 19 Sep '13, 14:19

modiX's gravatar image

modiX
16113
accept rate: 0%


One Answer:

3

If you know that you are looking for a postcode + city, it is better to use structured requests (see search parameters in the Nominatim docs for details). So your example should be:

http://nominatim.openstreetmap.org/search?postalcode=81660&city=M%C3%BCnchen&country=de&format=xml&addressdetails=1

Although this specific postcode seems to be missing in OSM, so the query does not give any results at all. A word of warning at this point: support for postcodes in Nominatim is very rudimentary still, so results should always be taken with a grain of salt.

answered 19 Sep '13, 15:07

lonvia's gravatar image

lonvia
6.2k25789
accept rate: 40%

I wished this would solve my problem :/

(20 Sep '13, 11:46) modiX
3

hey modiX,

Please check your postalcode: 81660 is NOT a geographical postalcode in Germany. It is more a Postalcode for big institutions like companies, banks or authorities inside Germany, a so called "Großkunden-Postleitzahl" in German.

Thus you can address an institution without mentioneing a street name.

These special postalcodes should NOT be stored in OSM. So you will not find it there. Please retry with a postalcode that covers a kind of area like a suburb of Munich or similar.

(22 Sep '13, 10:32) stephan75

You are right, thanks. the real postal code 81671 results the correct München in Bayern at both cases (full query and OSM). So my only work-around would be to replace the industry postal code with the geographic postal code. Unfortunately I cannot find any list in the web, but this is another problem case. Thanks so much! :)

(23 Sep '13, 07:45) modiX

Source code available on GitHub .