androidgoogle-mapsmbtiles

Loading a MBtiles on Google Map V2


I have created a MBtile file using MapTiler https://www.maptiler.com/

I can load this MBtile fine with OpenStreetMap

map.setTileSource(new XYTileSource("MyMap", 0, 18, 256, ".jpg", new String[] {}));

But I cannot load it using google map (with the only library I found, https://github.com/cocoahero/android-gmaps-addons)

Does someone know a better library to load Mbtiles with Google Map ?


Solution

  • You may want to take a look at my MapUtils project on GitHub (https://github.com/antoniocarlon/MapUtils).

    You can use it to read MBTiles format into Google Maps API Android v2 expanding the available zoom levels to the lowest one (interpolating lower zoom levels from higher ones). An example:

    TileProvider tileProvider = new ExpandedMBTilesTileProvider(new File("/sdcard/mydatabase.mbtiles"), 256, 256);
    TileOverlay tileOverlay = mMap.addTileOverlay(
         new TileOverlayOptions()
            .tileProvider(tileProvider));