2016-01-18 2 views
0

У меня есть файл mbtiles, и мне нужно реализовать его в моем представлении карт Google в Android. Я не могу найти подходящий учебник для этого, так что, если у кого есть что предложить, пожалуйста, поделитесь со мной ...Оффлайн google maps с .mbtiles

ответ

0

Эта библиотека является то, что вам нужно https://github.com/cocoahero/android-gmaps-addons

использовать этот сниппет после добавления библиотеки к вам проект:

// Retrieve GoogleMap instance from MapFragment or elsewhere 
GoogleMap map; 

// Create new TileOverlayOptions instance. 
TileOverlayOptions opts = new TileOverlayOptions(); 

// Get a File reference to the MBTiles file. 
File myMBTiles; 

// Create an instance of MapBoxOfflineTileProvider. 
MapBoxOfflineTileProvider provider = new MapBoxOfflineTileProvider(myMBTiles); 

// Set the tile provider on the TileOverlayOptions. 
opts.tileProvider(provider); 

// Add the tile overlay to the map. 
TileOverlay overlay = map.addTileOverlay(opts); 

// Sometime later when the map view is destroyed, close the provider. 
// This is important to prevent a leak of the backing SQLiteDatabase. 
provider.close(); 
+0

Я пробовал это и не имел никакого успеха сам. –