maplibre-native icon indicating copy to clipboard operation
maplibre-native copied to clipboard

Offline MBTiles support?

Open carlos-mg89 opened this issue 4 years ago • 5 comments

I haven't been able to find in the repository and/or documentation if there's support for offline vector (and raster too) MBTiles?

I admit I don't know if that was possible in the original Mapbox implementation, so if it wasn't there, it's quite likely it isn't in this project at the moment.

Aside from this, is there any documentation for how to use the library? So far I've seen how to set it up, but not how to interact with it. E.g.: add markers, draw paths, etc.

Thank you in advance and apologies if this isn't the proper place where to ask about this. I'd more than happy to move this question somewhere else.

carlos-mg89 avatar Feb 12 '21 12:02 carlos-mg89

Support for other protocols besides https are in the code, but I agree it could use some upgrades in the documentation. Pull requests for documentation and test samples are welcome.

Protocols asset://, file://, and mbtiles:// are listed in the MapLibre code. mbtiles:// is new to MapLibre since its donation by MapTiler. The asset and file protocols were in Mapbox GL native.

https://github.com/maplibre/maplibre-gl-native/blob/cd8d56467962cfb4c99418b0226d9ea2adb48c30/include/mbgl/util/constants.hpp#L62-L65


Here is a list of published apps which mention using MapLibre. A future Wiki should list the published apps that make use MapLibre.

roblabs avatar Feb 12 '21 15:02 roblabs

Thanks for the info @roblabs I'd definitely give it a try!

carlos-mg89 avatar Feb 12 '21 15:02 carlos-mg89

So far I've seen how to set it up, but not how to interact with it. E.g.: add markers, draw paths, etc.

Hi, can you please share how you were able to set it up? Is there any documentation?

SpeedFire0 avatar Jul 17 '21 11:07 SpeedFire0

So far I've seen how to set it up, but not how to interact with it. E.g.: add markers, draw paths, etc.

@SpeedFire0 I have my first try on mbtiles protocol yesterday, and it works fine. Here is my related code (maybe it is not clear): https://github.com/typebrook/mapstew-android/blob/3c6190b401/app/src/main/java/io/typebrook/mapstew/map/MaplibreFragment.kt#L125

Anyway, the format for each mbtiles source should be looks like:

{
  "id": "mbtilesSource",
  "tiles": [
    "mbtiles://{PATH_TO_YOUR_MBTILES}"
  ]
}

In my case, I put mbtiles in my app's interal storage for database. So PATH_TO_YOUR_MBTILES is context.getDatabasePath("test.mbtiles")

typebrook avatar Jul 21 '21 04:07 typebrook

Am I right to understand that this is for shipping tiles with an apk. This is not about downloading tiles in-app and using later when offline as in this sample?

tir38 avatar Mar 22 '22 03:03 tir38