Search code examples
datasourceosmdroid

Osmdroid - from offline folder


I am using OSMdroid to display both online and offline data in my app. The offline data are stored in a .zip file with the required structure.

Is it possible to have these offline tiles stored in a directory (extracted .zip file with the same structure)? Could somebody please tell me how could I achive this?

Thank you.


Solution

  • Well, as far as I understand what you are trying to get... this is more or less what the standard XYTileSource is already doing.

    So if you simply use a ready-to-use tile source like this one:

    map.setTileSource(TileSourceFactory.MAPNIK);
    

    you will see downloaded tiles files stored in /sdcard/osmdroid/tiles/Mapnik/

    The main difference is that it adds a ".tile" extension at the end of each tile file (probably to prevent tools like Android gallery to index all those images).

    If you have a ZIP file with tiles ready to use, you could extract them in this directory, and add .tile extension to each tile (355.png => 355.png.tile)

    And TileSourceFactory.MAPNIK will be able to use them.