Skip to content

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

@gongdao123

Description

@gongdao123

Environment

  • Search SDK Component (check at least one)
    • Core Search SDK (SearchEngine class, and etc.)
    • 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 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

Screenrecorder-2024-05-31-15-17-36-98.mp4

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions