Search code examples
openstreetmapnominatim

OpenStreetMap not returning postcode for certain queries


I am using https://nominatim.openstreetmap.org/search and it seems that some queries aren't returning postcode inside of address object for some reason and others do.

For example:

https://nominatim.openstreetmap.org/search?countrycodes=us&addressdetails=1&format=json&q=47711

returns the postcode, but this does not:

https://nominatim.openstreetmap.org/search?countrycodes=us&addressdetails=1&format=json&q=evansville


Solution

  • Evansville has more than one postcode. Which one should nominatim return? 47711 is just one part of Evansville, but Evansville has many more postcodes.

    A postcode can only be returned if it is exact as in one postcode for the query.

    So e.g. if you query the North High School in Evansville as in here: https://nominatim.openstreetmap.org/search?countrycodes=us&addressdetails=1&format=json&q=north%20high%20school%20evansville you'll get a postcode.