mapbox / mapbox/mapbox-maps-android
Offline mode has very low resolution for `Style.SATELLITE_STREETS` tiles. Does `TilesetDescriptorOptions` ignore `.maxZoom()`?
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 578
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
Environment
- Android OS version: 14
- Devices affected: Google Pixel 7, Samsung Galaxy Tab 8
- Maps SDK Version: 11.4.1
Observed behavior and steps to reproduce
I'm trying to implement offline mode for my app. User can draw a polygon which will be downloaded and displayed when there is no internet connection. I'm using code from Mapbox's documentation to download Style.SATELLITE_STREETS tiles.
The problem is unless I zoom to max before downloading Style.SATELLITE_STREETS map the quality of downloaded tiles is very low.
private fun downloadPolygon() {
val polygon = Polygon.fromLngLats(listOf(points)) // Polygon that user drawn
val stylePackLoadOptions = StylePackLoadOptions.Builder()
.glyphsRasterizationMode(GlyphsRasterizationMode.IDEOGRAPHS_RASTERIZED_LOCALLY)
.build()
val tilesetDescriptor = offlineManager.createTilesetDescriptor(
TilesetDescriptorOptions.Builder()
.styleURI(Style.SATELLITE_STREETS) // <-- Trying to download SATELLITE_STREETS tiles
.pixelRatio(2f)
.minZoom(12)
.maxZoom(16) // <-- This isn't working for SATELLITE_STREETS
.build()
)
val tileRegionLoadOptions = TileRegionLoadOptions.Builder()
.geometry(polygon)
.descriptors(listOf(tilesetDescriptor))
.acceptExpired(true)
.networkRestriction(NetworkRestriction.NONE)
.build()
offlineManager.loadStylePack(
Style.SATELLITE_STREETS,
stylePackLoadOptions,
{ progress -> },
{ expected -> }
)
tileStore.loadTileRegion(
UUID.randomUUID().toString(), // Random id for region
tileRegionLoadOptions,
{ progress -> }
) { expected -> }
}
After download I disconnect phone from internet and try to view map but the quality of map is very bad. If I connect to internet again map quality increases.
I tried to test with different values for maxZoom() but quality is still bad when no internet
Expected behavior
Map's quality in offline mode must be the same as in online mode
Quality without internet
Quality with internet
Additional links and references
I found similar issue for iOS: https://github.com/mapbox/mapbox-maps-ios/issues/1056
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Mapbox Android offline-mode documentation and reproduce the report on Android 14 with Maps SDK 11.4.1 using the shown TilesetDescriptorOptions values for Style.SATELLITE_STREETS. Inspect how minZoom(), maxZoom(), and offline tile-region loading interact; done means the downloaded map retains comparable quality offline and changing maxZoom affects the result as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100