chiranjeevigk
chiranjeevigk

Reputation: 1666

osmdroid offline map not loading the tiles

I need to see the offline tile in App

i have downloaded the tiles using "Mobile Atlas Creator 2.0.0 beta 1" configurations as below

enter image description here

The tile zip file is in the

/mnt/sdcard/osmdriod/tiles.zip

MyActivity code as below

MapView mapView = new MapView(this); //constructor

    mapView.setTileSource(new XYTileSource("MapQuest", 0, 10, 256, ".png", new String[] {}));

    mapView.setClickable(true);
    mapView.setBuiltInZoomControls(true);
    mapView.getController().setZoom(1); //set initial zoom-level, depends on your need
    mapView.getController().setCenter(new GeoPoint(52.516667, 13.383333)); //This point is in Enschede, Netherlands. You should select a point in your map or get it from user's location.
    mapView.setUseDataConnection(false); //keeps the mapView from loading online tiles using network connection.
    setContentView(mapView);

and the AndriodManifest.xml has these permissions

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

But the tiles are not shown on the map

enter image description here Note:

osmdroid version compile 'org.osmdroid:osmdroid-android:5.1@aar'

Upvotes: 0

Views: 943

Answers (1)

Worm Ripper
Worm Ripper

Reputation: 11

Try to open your osm zip file and check tiles folder name. The tiles folder name in this file must be same with XYTileSource constructor first parameter. If folder will have name "OpenStreetMap MapQuest" e.g. you probably need to write this:

mapView.setTileSource(new XYTileSource("OpenStreetMap MapQuest", 0, 10, 256, ".png", new String[] {}));

Upvotes: 1

Related Questions