Search code examples
androidosmdroid

Offline StreetMap implementing using OSMDroid


I am trying to implement offline StreetMap using OSMDroid.

I am confused about how to implement it: How can we provide tiles to maps from zip files?

I read many tutorials but I don't understand how it can be done. I get zip files of tiles using Mobile Atlas Creator.

Can anyone help me with this?


Solution

  • I can make the map works offline. Here are the steps:

    1. Using MOBAC to create offline map (either Mbtiles or sqlite works for me) and copy it to your phone's sdcard /sdcard/osmdroid/
    2. Create a custom tile source for your map source which you use in MOBAC to create your map as:private final XYTileSource FourUMapsTileSource = new XYTileSource("4uMaps", 0, 18, 256, ".png", new String[ {"http://tileserver.4umaps.eu/"}); (here I used 4uMaps as my tile source)
    3. Change mapview setting: mapView.setUseDataConnection(false);, mapView.setTileSource(FourUMapsTileSource);

    You can look at this Guide for more detail.