OsmDroid + Mobile Atlas Creator tutorial

As you may know, Mobile Atlas Creator (from now on, MOBAC) was blocked due to producing high stress on OSM servers, since mid-2013.

So MOBAC can’t generate Mapnik tiles now, and most of the OsmDroid Apps use Mapnik.

What we’re gonna do in this tutorial is to use MapQuest tiles, the ones that MOBAC actually support, instead of Mapnik tiles.

In MOBAC:

Select “Atlas > New Atlas”

Select the “OSMDroid ZIP” option

Now on the atlas, select “Map Source: OpenStreetMaps mapquest”

mapsource

Mark the “Recreate/adjust map tiles (CPU intensive)” checkbox

tileformat

Choose “Tile format: PNG”. To make sure this is correctly done, select another one (like JPEG) and then switch back to PNG.

Drag the area you wish to select and mark the Zoom Levels you want to include in your atlas

dragdrop

Click on atlas name (mine is “Unnamed atlas”), then click on Add Selection. A new layer must be created.

addselection

Then on the upper menu, click Atlas > Create atlas

Now you’ll find a .zip file inside your MOBAC folder. Extract it into a temporary folder.

Rename the “MapQuest” folder inside the zip to “MapquestOSM”, and zip it again (pay attention to the caps). Don’t worry about the name of the zip. “MapquestOSM.zip” would be OK, but its not strictly necessary.

copy the new zip file to /sdcard/osmdroid/ (not inside /sdcard/osmdroid/tiles!, just osmdroid folder)

Android code to load the atlas:

public class MyMapActivityBasic extends Activity
  protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   MapView mapView = new MapView(this, 256); //constructor
   mapView.setClickable(true);
   mapView.setBuiltInZoomControls(true);
   setContentView(mapView); //displaying the MapView
   mapView.setTileSource(TileSourceFactory.MAPQUESTOSM);
   mapView.getController().setZoom(15); //set initial zoom-level, depends on your need
   mapView.getController().setCenter(new GeoPoint(mLat, mLon));
   mapView.setUseDataConnection(true); 
   mapView.setMultiTouchControls(true);
 }
}

12 thoughts on “OsmDroid + Mobile Atlas Creator tutorial

    • Hi tomas
      well, with
      mapView.setUseDataConnection(true)
      your smartphone will download PNG tiles as long as you explore the map (a tile is a square portion of a map). The tiles are stored in your sdcard. So if the user has an internet connection, he will be able to download the region while he is exploring it.
      Is that what you mean?

      • You can develop a simple mobile atlas creator in Android if you download the tiles from a Tile Source Serve :

        and you store them to /sdcard/osmdroid/tiles/13/3896/3040.png

        See osmdroid source for transforming latititude-longitude box to z/y/x tiles.

      • I exactly followed your tutorial but my smartphone is not downloading png images in exploring it is just showing the images i stored in sdcard in zip format. What should i do?

  1. Both my app and the official osmdroid app can read tiles if I place them inside the tiles folder UNZipped. But neither can read the zip file.

    • Hi, I’ve followed this tutorial (and many others I found online), but still I get nothing but blanck tiles (I set mapView.setUseDataConnection to false since I wish to implement an offline mao service). I couldn’t even get the app to load the unzipped files. could you please describe how exactly did you manage to do this?

      • If you get a blank map, it means that for some reason OsmDroid is not able to load your map file. Pay special attention to the pathnames, print out (Log.d) all the path names where you are trying to find the tiles, and check in the device if the files are present in the exact same location.

        Hope it helps

  2. Pingback: [iOS SDK] Offline-Mapping first conclusions | Mobile Dev Stories

  3. I just realized only Google Earth / Map that could render my area (in indonesia)
    perfectly. But then I wonder Why the MObile Atlas Creator just remove that options from its source?

    So how could I make the offline map that could be read by osmdroid ?
    If i choose another source from the Mobile Atlas Creator….
    My area is not shown by them!

    Please help.

    • Hi,

      have you selected OpenStreetMaps Mapquest as Map Source? and it does not display your area? Post me an example latitude/longitude, i’ll check if my MOBAC installation can display it.

      • i just know these coordinates:

        Fmt
        North: -6.911303
        West : 107.68919
        East: 107.718415
        South : -6.939378

        that value is taken from the map,
        but seems nobody make the map (the road, etc) till now yet.

Leave a reply to tomasbarrios Cancel reply