mapbox / mapbox/mapbox-search-android

Offline Search did not support coordinates form HK, Japan, China mainland.

Open
#245 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Kotlin
Stars
39
Forks
10
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Search SDK Component (check at least one)
- [ ] Core Search SDK (`SearchEngine` class, and etc.)
- [X] Offline Search SDK (`OfflineSearchEngine` class, and etc.)
- [ ] Address Autofill SDK
- [ ] Search UI SDK
- Android OS version: Android 14
- Devices affected: All
- Search SDK Version: 2.1.0
- Included in project Maps SDK, Nav SDK versions if available:

## Code examples

private val tileRegionId = "Washington DC"
private val tileStore = TileStore.create()
private val descriptors = listOf(OfflineSearchEngine.createTilesetDescriptor())
// Working if coordinates are in US, UK, Mexico, e.g:
// private val dcLocation Point.fromLngLat(-77.0339911055176, 38.899920004207516)

// Not working if coordinates are in HK, Japan, China Mainland
private val dcLocation = Point.fromLngLat(127.024612, 37.532600)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

searchEngine = OfflineSearchEngine.create(
OfflineSearchEngineSettings(
tileStore = tileStore
)
)

searchEngine.addEngineReadyCallback(engineReadyCallback)

searchEngine.addOnIndexChangeListener(object : OfflineSearchEngine.OnIndexChangeListener {
override fun onIndexChange(event: OfflineIndexChangeEvent) {
if (event.regionId == tileRegionId && (event.type == EventType.ADD || event.type == EventType.UPDATE)) {
logI("SearchApiExample", "$tileRegionId was successfully added or updated")

searchRequestTask = searchEngine.reverseGeocoding(
OfflineReverseGeoOptions(center = dcLocation),
searchCallback
)
}
}

override fun onError(event: OfflineIndexErrorEvent) {
logI("SearchApiExample", "Offline index error:", event)
onFinished()
}
})
}
## Observed behavior and steps

In [OfflineSearchKotlinExampleActivity.kt](https://github.com/mapbox/mapbox-search-android/blob/main/MapboxSearch/sample/src/main/java/com/mapbox/search/sample/api/OfflineReverseGeocodingKotlinExampleActivity.kt) the IndexChangeListener will not be invoked if change the coordinates to HK, Japan, China Mainland, e.g:

private val dcLocation = Point.fromLngLat(114.1547347, 22.2846202) <== HK
private val dcLocation = Point.fromLngLat(127.024612, 37.532600) <== Japan

https://github.com/mapbox/mapbox-search-android/assets/18628246/034aaeb5-93ba-45fe-a248-bd467cea9bd8

But the orginal coordinates provided by sample works, and tried GPS in Maxico and UK also works.

## Expected behavior

The IndexChangeListener should be invoked, and tile should be able to load, and then can perform offline search.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with MapboxSearch/sample/src/main/java/com/mapbox/search/sample/api/OfflineReverseGeocodingKotlinExampleActivity.kt and reproduce the issue using the Hong Kong, Japan, and China Mainland coordinates instead of the working US, Mexico, or UK examples. Trace OfflineSearchEngine's index change and tile-loading behavior for those locations. Done means the listener is invoked, the tile loads, and offline reverse geocoding can run for the affected coordinates.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.