mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
462 stars 131 forks source link

Offline feature unable to download tiles for custom Styles #1789

Open Guimareshh opened 1 year ago

Guimareshh commented 1 year ago

Environment

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.

ZiZasaurus commented 1 year ago

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

Guimareshh commented 1 year ago

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

ZiZasaurus commented 1 year ago

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

Guimareshh commented 1 year ago

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

ZiZasaurus commented 1 year ago

@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

Guimareshh commented 1 year ago

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?

ZiZasaurus commented 1 year ago

@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.

Guimareshh commented 1 year ago

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?

ZiZasaurus commented 1 year ago

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

Guimareshh commented 1 year ago

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

VahanLab commented 10 months ago

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

davenquinn commented 6 months ago

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?

weifageo commented 5 months ago

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.

davenquinn commented 2 months ago

@ZiZasaurus or others at Mapbox, some guidance on this would be appreciated. We are considering implementing our own parallel caching approach for several geology-focused apps (Rockd, StraboSpot, and Mapboard GIS), because of the limitations of Mapbox's system for our hosted data layers. Unfortunately, the Host your tiles with Mapbox solution is not aligned with our business goals and application design.

Given the engineering involved, it would be fantastic if we would be able to continue working with Mapbox's tile caching system instead. This would also keep us more firmly tied to Mapbox's ecosystem/tools than charting our own path.