Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Lookup with postalcode fails #5259

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 3 comments
Closed

Lookup with postalcode fails #5259

openstreetmap-trac opened this issue Jul 23, 2021 · 3 comments

Comments

@openstreetmap-trac
Copy link

Reporter: pmiller.live[at]gmail.com
[Submitted to the original trac issue database at 12.37am, Saturday, 20th December 2014]

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

@openstreetmap-trac
Copy link
Author

Author: lonvia
[Added to the original trac issue at 12.39pm, Tuesday, 23rd December 2014]

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.

@openstreetmap-trac
Copy link
Author

Author: pmiller.live[at]gmail.com
[Added to the original trac issue at 10.22pm, Wednesday, 24th December 2014]

Thanks. I want to look for <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!

@openstreetmap-trac
Copy link
Author

Author: lonvia
[Added to the original trac issue at 12.14pm, Thursday, 25th December 2014]

I noticed the problem with country as well. I've created a separate ticket about that there: osm-search/Nominatim#218.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant