Author Topic: Map cache "valid for"  (Read 124 times)

Offline john_percy

  • Padavan of Locus
  • ***
  • Posts: 479
  • Thanked: 44 times
    • View Profile
  • Device: MotoG
Map cache "valid for"
« on: April 28, 2018, 18:26:10 »
I am attempting to use an overlay to display traffic delays and road closures and I can't get it to display reliably..

I have some questions regarding the time validity of the map cache.
1. If I "Set valid for" to 0, does that mean the map is not cached, or that the cache does not expire?
2. Does the same validity apply when the map is used as an overlay rather than a base map?
3. Regardless of the expiry time, is the map cached anyway within the same session of Locus. That is, is the validity of the cached copy only tested when Locus is restarted? To put it a different way, once the map is accessed once in a session, is the same image used until Locus is closed?

Much the same questions apply if I attempt to use an online map with traffic conditions.
 

Offline menion

  • Administrator
  • Professor of Locus
  • *****
  • Posts: 10535
  • Thanked: 139 times
    • View Profile
    • http://www.asamm.com
  • Device: SGS7
Re: Map cache "valid for"
« Reply #1 on: April 29, 2018, 09:10:04 »
Hello John,
1. time value "0" means = no caching at all. By default, maps have defined an infinite positive number, which say that cache never expires.
2. Yes, same value should be used for overlays as well. It is an exactly same map with exactly same parameters, just placed as the second layer.
3. cache validity should be tested every time, app try to load map tile from cache (SQLite file). In app is also small in-memory cache so a few tiles is stored in memory in case, they will be immediately needed, anyway when you scroll a screen to the side and return back, data are again loaded from SQLite file (so again validated against "valid for" time).

If you have an online map with traffic conditions, simply try to set there 0 (no caching) or 1 (one hour caching) and you will see. Hope it will work. I've never used it in practice so feel free to write me if there will be any problem.
Ideas, wishes, problems
Advanced topics, public discussion, sharing of knowledges, testing beta versions: you're here!
 

Offline john_percy

  • Padavan of Locus
  • ***
  • Posts: 479
  • Thanked: 44 times
    • View Profile
  • Device: MotoG
Re: Map cache "valid for"
« Reply #2 on: April 29, 2018, 11:42:29 »
Thanks for that info, helpful.
I think there may a problem with a totally transparent tile (which is most likely to occur in an overlay and would occur in my traffic overlay where there are no traffic delays) failing to clear the previous tile and displaying old information, using SRC OVER. I have encountered this when zooming in or out, rather than the data changing but I guess the same would apply with changing traffic.
Where I know this happens is with a vector theme to overlay roads etc on to a satellite map. The background is generally pale white but over the sea the tiles were empty and transparent. Zooming in or out left the previous tile displayed in areas of transparent tiles. In this case I remedied it by drawing an off white background over the whole map first.
I think this may be a problem with my traffic project.