Opened 3 years ago

Last modified 3 years ago

#5261 new defect

Lookup with postalcode fails

Reported by: pmiller.live@… Owned by: geocoding@…
Priority: minor Milestone:
Component: nominatim Version:
Keywords: Cc:

Description

Hi,

I am using nominatim to lookup some zip codes.

http://nominatim.openstreetmap.org/search?postalcode=8005&city=Z%C3%BCrich&countrycodes=CH&format=json

This yields no results.

Removing the city yields valid results.
http://nominatim.openstreetmap.org/search?postalcode=8005&countrycodes=CH&format=json

What is the correct way to combine postalcode and city parameters?

Regards,
Paul

Change History (3)

comment:1 Changed 3 years ago by lonvia

It's actually not quite clear what the query means. Are you looking for a city called Zurich with postcode 8005 or for postcode 8005 within Zurich. It may sound similar but it changes how Nominatim looks for the result. Currently it does the first and that doesn't work because there is no such object (with Zurich having more than one postcode and all).

If you are looking for the second then you should leave out the city parameter. Postal codes are assumed to be unique per country. So, this will work:

http://nominatim.openstreetmap.org/search?postalcode=8005&country=ch&format=json

In any case, postalcode + city should yield some sensible result. Probably by just looking for the postcode with the city.

comment:2 Changed 3 years ago by pmiller.live@…

Thanks. I want to look for <zip> <town/city> and get coordinates.

It used to work until a couple of weeks ago with my first query from the ticket.

If you look at your query, you can see that the results are not restricted to the country (CH for Switzerland) and results are coming also from the US, South Africa etc. You need to use countrycodes instead of country.

For now, I'll stick to that then.

Thanks!

comment:3 Changed 3 years ago by lonvia

I noticed the problem with country as well. I've created a separate ticket about that there: https://github.com/twain47/Nominatim/issues/218.

Note: See TracTickets for help on using tickets.