OSMdroid : How to load offline map from zip archive - MapTileFileArchiveProvider

10,288

The files in your ZIP need to be in the form of:

Z/X/Y.png

If you rename your Y.tile files to Y.png, zip them up and put the zip file in /sdcard/osmdroid/, that should work.

Share:
10,288

Related videos on Youtube

epiGR
Author by

epiGR

Updated on June 13, 2022

Comments

  • epiGR
    epiGR almost 2 years

    I really need some help with the OSMdroid library. It is useful to have maps stored in sdcard as zip files. Also, maps can be unzipped and the image files may be used directly for faster rendering.

    I managed to load tiles from my sdcard when the tiles are unziiped, have .tile extension and are stored in the folder /sdcard/osmdroid/tiles/Mapnik/... To create my map I used the Mobile Atlas Creator and OSMAND tile storage format.

    I read some tutorials on the web that claim storing zip files containing tiles are stored in /sdcard/osmdroid then the offline map will be loaded from the zip. But it does not work for me.

    1. Did anybody managed to make it work? If so how?

    2. Do I need to instantiate my own MapTileFileArchiveProvider? If so, how can I do that? Any examples?

    • ofirbt
      ofirbt over 12 years
      Hey, can u post 2 simple samples - 1 for storing the map and 1 for retrieving it?
    • M. Usman Khan
      M. Usman Khan almost 10 years
      can you provide the sample code :)
  • epiGR
    epiGR over 12 years
    Sorry my hasty asnwer. I am doing further testing and I 'll share the results.
  • epiGR
    epiGR over 12 years
    Thanks a lot. The map tiles are rendered properly. If anyone is interested, the OSMdroid ZIP format of the Mobile Atlas Creator can be used to create such a zipped map.
  • David Doria
    David Doria over 10 years
    @user976933 - Doesn't the zip need to go in /sdcard/osmdroid/tiles? I have actually tried it in both places and I still get a blank map.
  • Arjun Issar
    Arjun Issar over 4 years
    @DavidDoria could you manage to solve this?? I'm stuck exactly here
  • Arjun Issar
    Arjun Issar over 4 years
    @epiGR Could you show the snippet to set the tile source.
  • David Doria
    David Doria over 4 years
    @ArjunIssar sorry, this was a long time ago. If I had figured it out I would have replied back then :(