OSMdroid : How to load offline map from zip archive - MapTileFileArchiveProvider
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.
Related videos on Youtube
epiGR
Updated on June 13, 2022Comments
-
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.
Did anybody managed to make it work? If so how?
Do I need to instantiate my own MapTileFileArchiveProvider? If so, how can I do that? Any examples?
-
ofirbt over 12 yearsHey, can u post 2 simple samples - 1 for storing the map and 1 for retrieving it?
-
M. Usman Khan almost 10 yearscan you provide the sample code :)
-
epiGR over 12 yearsSorry my hasty asnwer. I am doing further testing and I 'll share the results.
-
epiGR over 12 yearsThanks 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 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 over 4 years@DavidDoria could you manage to solve this?? I'm stuck exactly here
-
Arjun Issar over 4 years@epiGR Could you show the snippet to set the tile source.
-
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 :(