mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

Offline feature unable to download tiles for custom Styles

Open Guimareshh opened this issue 2 years ago • 14 comments

Environment

  • Android OS version: all
  • Devices affected: all
  • Maps SDK Version: 10.9.0

Observed behavior and steps to reproduce

Moving from legacy SDK (9.7.2) to new SDK (10.9.0) I reworked the Offline feature of my app to use the new APIs as stated on the official documentation. Offline is working fine for Outdoor and Satellites styles, but for custom styles (we are using IGN and SwissTopo for instance) the SDK behaves as it's working but no tiles have been downloaded.

Indeed all properties from TileRegionLoadProgress are set to 0 and TileRegionCallback.run is set with region.error null and TileRegion not null as seen on this screenshot:

Screenshot 2022-11-01 at 14 21 31

Expected behavior

Tiles from custom styles should be properly downloaded.

Guimareshh avatar Nov 01 '22 13:11 Guimareshh

@Guimareshh thank you for reaching out. When you reference custom styles, are these styles you are loading locally?

ZiZasaurus avatar Nov 02 '22 12:11 ZiZasaurus

@ZiZasaurus Custom styles are loaded from an URL (https://example.com/custom-style.json)

Guimareshh avatar Nov 02 '22 12:11 Guimareshh

Ah, understood. Do your those custom styles rely on Mapbox tilesets?

ZiZasaurus avatar Nov 02 '22 13:11 ZiZasaurus

Those custom styles don't rely on Mapbox tilesets. Is that an issue with this SDK?

Guimareshh avatar Nov 02 '22 14:11 Guimareshh

@Guimareshh, ah yes, thank you for clarifying. The tile pack API can only work with Mapbox tilesets. https://docs.mapbox.com/android/maps/guides/offline/#supported-tiled-sources

ZiZasaurus avatar Nov 03 '22 14:11 ZiZasaurus

Ah thanks for pointing to the documentation, I didn't saw it.

Unfortunately, it's a huge drawback for us, as the offline feature with custom styles is a huge part of our app. Is this being work out and will be supported any time soon?

Guimareshh avatar Nov 03 '22 14:11 Guimareshh

@Guimareshh I definitely understand your concern due to it being a major part of your app. While this is not currently on the team's roadmap, I'd be happy to provide your use case to them to help them prioritize this for a future update.

ZiZasaurus avatar Nov 03 '22 14:11 ZiZasaurus

Our use case is the following: we allow our users to view a hike path on a mapview. They can switch between styles including custom ones not using Mapbox tilesets. And they can download these information offline (hike path, map styles ...). In some European countries it's a common use case to use map styles from national mapping agencies (for instance in France we have IGN, in Switzerland SwissTopo etc...).

Can we safely use the deprecated OfflineManager in the SDK v10 until this feature is supported with the new APIs?

Guimareshh avatar Nov 03 '22 16:11 Guimareshh

@Guimareshh, yes the legacy tile-based offline system, which remains available in v10, will allow you to accomplish this use case.

ZiZasaurus avatar Nov 03 '22 19:11 ZiZasaurus

Is there an official issue following a support for custom styles being download with the new offline APIs? Otherwise this issue shouldn't be closed imo

Guimareshh avatar Nov 15 '22 09:11 Guimareshh

I'm also interested in this use case @ZiZasaurus. @Guimareshh are you really able to download an IGN raster layer using the deprecated API? As far I can see, the OfflineRegionGeometryDefinition class used in the OfflineRegionManager also uses a styleURI, so I guess it can only work with mapbox custom styles as well

VahanLab avatar Nov 03 '23 13:11 VahanLab

Similar to many organizations, Macrostrat maintains its own tile services. We'd like to use Mapbox's caching system for these tiles, and we hope to avoid supporting both the "legacy" and modern caching systems (currently, we stick entirely with the legacy system).

Is there a way that we can move in this direction by exposing a "tile packs" API in our system (presuming we could replicate the packaging format)? Or is tile pack provision explicitly limited to Mapbox's own servers?

davenquinn avatar Mar 05 '24 16:03 davenquinn

I have run into the same issue after migrating from Maps SDK v9 up to v10. Following the examples provided, I was only able to download the Style Pack information, but no Tile Store data was ever downloaded. I contacted support to clarify and they confirmed from v10 the new OfflineManager only supports Mapbox-hosted tilesets.

Here are a few options to consider:

Use the Legacy Offline Manager: If the offline functionality is crucial for your app, and you need support for custom tiles, you might consider sticking with the legacy Offline Manager(it's still there in V10 being named OfflineRegionManager)for the time being.

Host Your Tiles with Mapbox: If possible, consider hosting your custom tiles on Mapbox's infrastructure. This would allow you to use the new Offline Manager and take advantage of the improved performance and features in SDK v10.

I wanted to show my support for this item as I think many developers in this community would benefit from Mapbox supporting custom tilesets within the new Offline Manager as @Guimareshh and other contributors were expecting.

weifageo avatar Apr 03 '24 18:04 weifageo