question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Offline first for tile download

See original GitHub issue

Issue Type

  • Improvement
  • Performance

Description and/or steps/code to reproduce the problem

The process in order to get the tiles works more or less that way:

  • we have an ordered list of providers
  • some are embedded (zip files, SQLite)
  • some are on the internet
  • at least one provider is an approximation (MapTileApproximater)
  • and we try to find the tile bitmap from this ordered list of providers - and when we find it we don’t check the following providers

Problem: assuming we don’t have the tile in our embedded providers and assuming we have a low connectivity, we will be waiting during the tile downloading, and in the meanwhile we display nothing. If we had no connectivity at all, then we would immediately skip the download provider and display the tile provided by the approximation provider.

The solution would be something like:

  • putting the embedded and approximation providers first in MapTileProviderBasic (as “offline”)
  • when we find the tile in those providers, if the tile is up to date, this is it
  • if we found a downgraded version of the tile (expired or approximated), we display it but we keep looking for it in the next providers of the list (presumably “online”)
  • doing so we display immediately an approximation of the tile, while searching for a better version online

Environment

Version of osmdroid the issue relates to:

6.0.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:27 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
monsieurtanukicommented, Apr 24, 2018

@InI4 I’ll work on that after the next release (6.1.0). Btw:

  • it’s already potentially a patchwork if you have several providers
  • it’s already async
  • I think the tile downloads are already on FIFO or LIFO
  • I note your idea of download cancel - I’m not sure it’s implemented now

What I had in mind is:

  • either we respect the user’s provider order
  • or the user asks us to reorder relevancy-wise
  • or the user asks us to reorder speed-wise

And regardless of that initial order or reorder aspect, the process will be:

  • to loop on the provider list
  • to display the first available tile, regardless of its status
  • to keep looking until we find an up-to-date version of the tile
1reaction
monsieurtanukicommented, Apr 24, 2018

@InI4 More or less, but it don’t know if we can be specific about “in database” or not: we’ll let the user set its own tile providers list order. The order is currently “best providers” first; the goal is “fastest providers first”, while still looking for an up-to-date tile. Can we enforce the provider list order? To do that we’ll need to know for each provider its tile relevancy (expired / scaled / up-to-date) and its access speed (local database / local file / network / notoriously slow server). Then we can add a method in the provider array, something like “reorder according to relevancy or speed”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to download tiles to use offline - GIS Stack Exchange
First you need to figure out how this map tiles need to be organized. There is the Tile map service standard that describes...
Read more >
Build an offline-first app - Android Developers
An offline-first app is an app that is able to perform all, or a critical subset of its core functionality without access to...
Read more >
Download an offline map (ahead of time) - ArcGIS Developers
Users can download the offline maps quickly and with minimal interaction. ... This creates a set of data files such as tile packages,...
Read more >
Offline maps | Help - Mapbox docs
The offline tile update process is the same process as with regular map tiles: The map tile's only downloaded if there's a new...
Read more >
Individual Offline Map Tile Limits - Gaia GPS
Thanks for the tip, @Nathan . The suggestion you provided was my first process. However, in order to download all the necessary Maps...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found