user3589211
user3589211

Reputation: 99

Osmdroid, use of different offline maps

I have an application with an Osmdroid-MapView, whose data is stored in an off-map on the device: /mnt/sdcard/osmdroid/tiles.zip

Structure of the zip file:

+-- MapquestOSM
+-- 10
¦ +-- 550
¦ +-- 335.png
...

My goal: I want to store different offline maps and a certain then can be selected in the program.

My problem: in what form do I have to store the maps in the osmdroid folder and how can I tell Osmdroid my choice?

Part of source:

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.MAPQUESTOSM);

  IMapController mapViewController = mapView.getController();
  mapViewController.setZoom(15);
  mapViewController.setCenter(BERLIN);
}

Please help !

Regards Wicki

Upvotes: 0

Views: 1085

Answers (1)

MKer
MKer

Reputation: 3450

Unfortunately, you can't really force osmdroid to load one specific zip.

What you can do is play with the XYTileSource name, as it must match with your root directory name inside the zip file:

map.setTileSource(new XYTileSource("Map_1",
    ResourceProxy.string.mapquest_osm, 0, 18, 256, ".png", new String[] {
        "http://otile1.mqcdn.com/tiles/1.0.0/map/",
        "http://otile2.mqcdn.com/tiles/1.0.0/map/",
        "http://otile3.mqcdn.com/tiles/1.0.0/map/",
        "http://otile4.mqcdn.com/tiles/1.0.0/map/"}));

will only use zip files structured like this:

+-- Map_1
+-- 10
¦ +-- 550
¦ +-- 335.png
...

Also refer to: Download maps for osmdroid

Upvotes: 1

Related Questions