2

I am new to mapbox android.I am able to place tiles from json. But How can i load tiles from internal storage/SD card of the mobile.

I am using below code for local storage - which is not working

RasterSource chicagoSource = new RasterSource("chicago-source", new TileSet("tileset", "asset://" + Environment.getExternalStorageDirectory().getAbsolutePath()
                        + "/OverlayTiles/{z}/{x}/{y}.png"));
                mapboxMap.addSource(chicagoSource);

                RasterLayer chicagoLayer = new RasterLayer("chicago", "chicago-source");
                mapboxMap.addLayer(chicagoLayer);

I am able to load from project assets folder - using below code, it might help someone

RasterSource chicagoSource = new RasterSource("chicago-source", new 
TileSet("tileset","asset://OverlayTiles/{z}/{x}/{y}.png"));
                        mapboxMap.addSource(chicagoSource); 
mapboxMap.addSource(chicagoSource);

                RasterLayer chicagoLayer = new RasterLayer("chicago", "chicago-source");
                mapboxMap.addLayer(chicagoLayer);
madhu527
  • 4,644
  • 1
  • 28
  • 29

0 Answers0