如何将 Mapbox 自动完成搜索结果自定义为用户位置接近度?
How to customize Mapbox Autocomplete search results to user location proximity?
我正在尝试使用 Mapbox 制作 Android activity(在 Java 中)。我使用 Mapbox Places 插件的搜索结果目前在国际范围内显示自动完成建议,我不知道如何将这些结果限制在用户附近(例如:50 英里)。
我当前的实现基本上是 Mapbox 为这个例子提供的所有代码:https://docs.mapbox.com/android/plugins/examples/global-location-search/
我想做他们在这里展示的事情,但是这个例子在Java脚本中:https://docs.mapbox.com/help/tutorials/local-search-geocoding-api/#optional-parameters
我怎样才能做到这一点?
谢谢!
这取决于您希望如何为您的 Java/Android 项目实施搜索。 https://docs.mapbox.com/android/plugins/overview/places/#search-options.
中列出了您的最佳选择
https://docs.mapbox.com/android/plugins/examples/global-location-search/ is an example which uses the Mapbox Places Plugin for Android。
The Plugin's PlaceOptions
class features a builder method to pass a proximity Point
.
如果您不想使用插件,the MapboxGeocoding
class (via the .builder()
has a proximity method as well. Here's a Mapbox demo app example that uses the MapboxGeocoding
wrapper。
我正在尝试使用 Mapbox 制作 Android activity(在 Java 中)。我使用 Mapbox Places 插件的搜索结果目前在国际范围内显示自动完成建议,我不知道如何将这些结果限制在用户附近(例如:50 英里)。
我当前的实现基本上是 Mapbox 为这个例子提供的所有代码:https://docs.mapbox.com/android/plugins/examples/global-location-search/
我想做他们在这里展示的事情,但是这个例子在Java脚本中:https://docs.mapbox.com/help/tutorials/local-search-geocoding-api/#optional-parameters
我怎样才能做到这一点?
谢谢!
这取决于您希望如何为您的 Java/Android 项目实施搜索。 https://docs.mapbox.com/android/plugins/overview/places/#search-options.
中列出了您的最佳选择https://docs.mapbox.com/android/plugins/examples/global-location-search/ is an example which uses the Mapbox Places Plugin for Android。
The Plugin's PlaceOptions
class features a builder method to pass a proximity Point
.
如果您不想使用插件,the MapboxGeocoding
class (via the .builder()
has a proximity method as well. Here's a Mapbox demo app example that uses the MapboxGeocoding
wrapper。