androidosmdroidmapnik

Best method of deliverying OSMDroid Mapnik zipped tileset to user in live


I am developing an Android app in Java using OSMDroid to deliver offline maps in Mapnik tile format in a .zip file.

My question is about how to deliver these maps to users who download the app from the Play Store.

I don't know the exact size of my finished tileset but it will be a .zip file of about 100MB.

In protyping I am including a smaller tileset in my project's /assets folder, and on first run copying it to the user's external storage directory using the getExternalStoragePublicDirectory(Environment.MEDIA_SHARED) folder and replacing /shared with /osmdroid (on my phone it is /storage/emulated/0/osmdroid) and creating the directory if necessary. It's a bit of a hack but it works.

The problems with this are that the tileset (about 100MB) remains attached to the application while a copy is created in external storage. Which is kinda wasteful of space. I may also encounter problems with the APK being too big.

I thought of allowing the user to download the .zip file from an FTP server after they're finished installing the app (prompting them that it's a biggish download and to use WiFi if possible). I haven't looked at the technicalities in detail but this strikes me as being fairly straightforward to implement. However, I can't find any descriptions of people using this method.

So, my questions are:

  1. Is there a standard or recommended way of delivering Mapnik tiles to users in live for offline use?

  2. If so, what is it? (preferably with links to examples if possible)

Thank you to everybody in advance for your help!


Solution

  • In the end I downloaded the zip from an FTP server. This has been tested with a group of test users in a real-life environment and it seems to work well.

    The zip file is downloaded to the directory returned by the method getExternalFilesDir. This returns the app's data storage directory which gives the advantage over a hard-coded path that when the app is uninstalled the zip files are also deleted.