Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mapbox result to use place_name as address #1656

Merged

Conversation

tmh-dev
Copy link
Contributor

@tmh-dev tmh-dev commented Jun 3, 2024

Follow up to #1655

Non-nil values are now being returned (when appropriate) for the city, state, state_code, postal_code, country, country_code, and neighborhood methods. However, as a result the Geocoder::Result::Mapbox#address method needs to be updated otherwise the returned value will contain duplicated text.

Example: Given that the city method now returns a value for "place" type results, a search result for "Chicago, IL" will return "Chicago, Chicago, Illinois, United States". This is because .place_name and .city return the same value, and both are being used to build the address.

To solve this, we can simply use the place_name property on the Mapbox payload as the address rather than building our own.

Specs and fixtures have been added to test the different types of results you can get with Mapbox.

@tmh-dev tmh-dev marked this pull request as ready for review June 3, 2024 18:47
@alexreisner alexreisner merged commit 7467752 into alexreisner:master Jun 9, 2024
5 checks passed
@alexreisner
Copy link
Owner

Excellent, thanks!

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

Successfully merging this pull request may close these issues.

3 participants