You're supposed to use the tile packager to create your zip, or mobile atlas creator. However, if you rename all the *.tile files in your zip to *.png, it should work (not tested).
How to prepare a map tiles archive for osmdroid for offline maps?
Frage
I prepared this simple project to test the offline map functionality of osmdroid. In the first step I use the Internet connection to download tiles. Everything works as expected. The following code snippet shows the settings for the activity containing the map view.
public class MainActivity extends Activity {
public static final GeoPoint BERLIN = new GeoPoint(52.516667, 13.383333);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setClickable(true);
mapView.setBuiltInZoomControls(true);
mapView.setMultiTouchControls(true);
mapView.setUseDataConnection(true);
mapView.setTileSource(TileSourceFactory.MAPNIK);
IMapController mapViewController = mapView.getController();
mapViewController.setZoom(15);
mapViewController.setCenter(BERLIN);
}
}
Now I want to manually supply a archive file containing the tile bitmaps. These are the steps I did to prepare for offline mode:
- I zip the existing folders on the sdcard which can be found in
/mnt/sdcard/osmdroid/tiles/
. - I place the resulting
Mapnik.zip
one level above in/mnt/sdcard/osmdroid/
. - I delete all the cached tiles in
/mnt/sdcard/osmdroid/tiles/Mapnik
.
Now I turn off the wireless connection on the phone and restart the application. No map tile shows up. Why?
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow