osm-search / Nominatim

Open Source search based on OpenStreetMap data
https://nominatim.org
GNU General Public License v3.0
2.99k stars 701 forks source link

U.S. ZIP Code 5 Plus 4 (also known as ZIP+4) Broken/Misunderstood #3324

Open OdinVex opened 5 months ago

OdinVex commented 5 months ago

What did you search for?

Any address using ZIP+4 instead of ZIP. Example: https://nominatim.openstreetmap.org/ui/search.html?q=901+South+Stewart+Street%2CCARSON+CITY%2C+NEVADA+89701-5267%2CUS

What result did you get?

"No search results found"

What result did you expect?

"901 South Stewart Street, CARSON CITY, NEVADA 89701-5267,US"

Further details

The US (of America) uses ZIP and ZIP+4 codes when referring to a location. It is common practice to use ZIP, but ZIP+4 is mostly used for accelerating processing/delivery of items. You can probably offer a suggestion with the zip code converted to ZIP instead of ZIP+4 such as "901 South Stewart Street, CARSON CITY, NEVADA 89701,US"

lonvia commented 5 months ago

This used to work in the PHP frontend. I dropped it in Python because it seemed such a niche application. Maybe we should find a proper solution for #1011 instead of hacking ZIP+4 codes back in.

OdinVex commented 5 months ago

I think it will be fine to detect zip+4 and query for both types, returning both as a single response (or a "did you mean?" response).