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

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

Open
1 of 4 tasks
gongdao123 opened this issue May 31, 2024 · 0 comments
Open
1 of 4 tasks
Labels
bug Something isn't working

Comments

@gongdao123
Copy link

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.

@gongdao123 gongdao123 added the bug Something isn't working label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant