mapbox / mapbox-plugins-ios

Experimental plugins to supercharge your maps ⚡️
ISC License
7 stars 8 forks source link

MBTiles #19

Open 1ec5 opened 6 years ago

1ec5 commented 6 years ago

An MBTiles source could be implemented as a plugin to the map SDK.

Although MBTiles is a Mapbox-supported tile container format, the Mapbox Maps SDK doesn’t support it out of the box as a way to sideload offline maps. https://github.com/mapbox/mapbox-gl-native/issues/6862#issuecomment-287484550 explains the situation in more detail.

Fortunately, iOS map SDK v4.0.0 will introduce MGLComputedShapeSource for supplying tiles to the rendering engine on demand. It should therefore be possible to implement MBTiles support in a plugin that adds a computed shape source to the map.

See mapbox/mbxmapkit#3 for tips on how this feature was implemented in the legacy Mapbox iOS SDK (source code no longer publicly accessible).

/ref mapbox/mapbox-gl-native#9983 /cc @mapbox/maps-ios

1ec5 commented 6 years ago

Note that this plugin request pertains only to the use of MBTiles as a container for vector tiles. Using MBTiles as a container for static tiles would be blocked by mapbox/mapbox-gl-native#7471.

1ec5 commented 6 years ago

https://github.com/mapbox/mapbox-gl-native/issues/10494#issuecomment-359569163 discusses the challenges involved in implementing MBTiles support atop mbgl. On iOS, we aren’t normally quite as concerned about overhead converting between C++ and platform-specific data types, but converting vector data from MVT to MGLShape to mbgl’s representation is a pretty roundabout approach. Leaving this issue open for now, because we could still use a plugin to prototype MBTiles support for non-performance-critical use cases.