feat: add country-aware OpenStreetMap ZIP lookup#817
Open
anonymoususer72041 wants to merge 3 commits into
Open
feat: add country-aware OpenStreetMap ZIP lookup#817anonymoususer72041 wants to merge 3 commits into
anonymoususer72041 wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the ZIP code lookup implementation with OpenStreetMap Nominatim instead of the previous Google Maps Geocoding XML endpoint.
The lookup now uses Nominatim’s JSON API, sends an identifying
User-Agent, scopes postal-code searches by the selected country when available and maps returned address fields back into the existing street, city and state response structure used by the current AJAX ZIP lookup flow.The frontend now includes the selected country in ZIP lookup requests and only updates address fields when the lookup actually returns values, preserving user-entered data when Nominatim does not return a matching street, city, or state.
Motivation
The existing ZIP lookup depended on the legacy Google Maps Geocoding endpoint. Google now requires API keys for Maps Platform geocoding requests, which makes the old unauthenticated lookup path unsuitable for the current OpenCATS setup.
Moving this lookup to OpenStreetMap Nominatim removes that dependency while keeping the existing OpenCATS ZIP lookup flow intact.
Postal codes are not globally unique, so passing the selected country helps avoid incorrect matches from other countries. Preserving existing field values when no lookup result is returned also prevents the ZIP lookup from accidentally clearing information the user already entered manually.
This keeps the change focused on the existing ZIP lookup path while improving provider independence, lookup accuracy and user experience.