Sharing map tiles among different applications

I have a bunch of different OSM-based apps on my Android phone: Organic Maps, OSMAnd, Street Complete, Vespucci.

It occurred to me that each of these apps has its own storage where it likes to keep its map data. So, for example, OSMAnd has a copy of my hometown, and then OrganicMaps will separately download and store the exact same data in a different part of the phone. Of course, this means that I have to trigger map updates for each app, and wait around with the slow download speeds. It would be much more efficient to download the data once, and only have to refresh the maps one time to bring them up to date (also easier on OpenStreetMap’s tile servers, I imagine).

I’m not too familiar with Android file systems, or how the different apps know how old the tile data is. Perhaps there is a timestamp in the tile data itself. I notice that both OSMAnd and Organic Maps have settings that let you manually specify where to store the data.

Has anyone tried pointing different Android apps at the same folder to store the map tiles and were there any conflicts or race conditions or whatever it’s called among the different apps?

I have similar questions about desktop apps, but will probably make a separate thread about that at some point. Let’s confine discussion to Android for now.

The problem is that different apps have different needs from their map data. Organic Maps and OSMAnd might, in theory, be able to share map data, but the extensive routing and POI information they require is just wasted space for StreetComplete, which simply needs a basemap to act as a background, while Vespucci needs live OSM data in order to edit the map – but that live data needs extensive processing to turn into a useful routing graph for Organic Maps or OSMAnd.

6 Likes

Thanks for the reply. Since posting that I have been talking to the AI’s about something similar and I think when I made the OP I was misunderstanding the architecture of how we go from OSM data → a map displayed on my phone. I incorrectly thought that each android app was downloading raw data, then rendering it for display on the phone. The AI is telling me that the different apps have their own file format and the “tiles” are either raster or vector files, and that is what they are downloading. In other words, the apps are grabbing pre-compiled and rendered tiles, not raw OSM data from the database.

If that’s true, then the idea of having the apps all share the same cache is a non-starter.

Several of those apps don’t use map tiles at all.

1 Like

I can confirm that “not raw OSM data” part is right and correct and why it would not really work

1 Like

Yes and no. StreetComplete uses vector tiles for its basemap, and Vespucci uses raster tiles for background imagery. OSMAnd downloads large chunks of processed map data and uses that to render the map on an as-needed basis; presumably Organic Maps works the same way.

1 Like

Having a shared cache for satellite imagery across Vespucci, SCEE w/ aerials toggle, and the end use map apps would be interesting but I’m not sure you could do it properly on Android.

It could be done (and rudimentary was done on some early Android versions and apps), but there are all kind of complications (Android permission model, IPC size limitations) that make it IMHO not worth the trouble.

Actually for Vespucci we went from a semi-seperate Android Service to simply running the download and caching codes in threads a couple of years back because of those issues.

2 Likes