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

feat(mapbox): update to mapbox api v6 #5

Merged
merged 5 commits into from
Nov 4, 2024

Conversation

Mathieu-R
Copy link
Contributor

@Mathieu-R Mathieu-R commented Oct 30, 2024

This changes aim to update the mapbox geocoder to the API v6.
In particular, it allows us to retrieve informations about the confidence level of the geocoding that we put in the extra field of the return formatted object.

...
extra: {
  id,
  bbox: properties.bbox ?? undefined,
  confidence: properties.match_code ? isTrustableMapboxResult(properties.match_code) : 0
}

Note we do not have informations about the category in the extra field since it is related to POI and these have been seperated from the Geocoding API. They are now part of the Search Box API and it will also be soon deprecated from the v5 Geocoding API (see Geocoding v5 POI deprecation: https://docs.mapbox.com/api/search/geocoding-v5/).
I guess anyway that POI is not relevant to geocoding so it makes sense to not have this category property in the returned object.

@spurreiter
Copy link
Owner

Hi @Mathieu-R,
Thanks for your PR, which is highly appreciated. Can you please check on the failing tests?

@Mathieu-R
Copy link
Contributor Author

Hi @Mathieu-R, Thanks for your PR, which is highly appreciated. Can you please check on the failing tests?

Yes, it is fixed.

@@ -0,0 +1,9 @@
export function isTrustableMapboxResult(matchCode) {
console.log(matchCode)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please move this to src/geocoder/mapbox.js as this is a function solely for the mapbox geocoder.
Would you also mind, removing the console.log() statment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sure

@spurreiter spurreiter merged commit db7a593 into spurreiter:main Nov 4, 2024
2 checks passed
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.

2 participants