"Clear map cache" for online maps not working

Georg D shared this problem 12 months ago
Solved

In Locus 4.16.0 the "clear map cache" action for online maps is not working in the sense after the action, Locus still shows outdated map tiles. Stock Android 10 on Fairphone 3. Seems a regression of https://help.locusmap.eu/topic/map-cache-cleaning-not-working


Context and reproduction steps:

  1. 2023-05-08 16:34 I committed the changeset https://www.openstreetmap.org/changeset/135860909#map=15/48.7869/5.5438
  2. In Locus, I opened menu > map manager > online > OSM Classic and moved to 48.78904 5.54145 and did a screenshot for before my changes, as I wanted to do a before and after comparision.
  3. The day after, I opened menu > map manager > online > OSM Classic > map's 3 dot menu > clear map cache. I expected to see a map with my changes but saw the update only in one zoom level. I assumed the tile server is quite busy and I need to come back in a few days.
  4. 2023-05-11 09:30 I retried clearing & loading and still, only some tiles got updated tiles:
    7120f5bcf517e565c46727f707adcd66
    I wondered for the unusual big delay and opened https://www.openstreetmap.org/query?lat=48.78936&lon=5.54306#map=17/48.78730/5.53780 where my changes were visible on all zoom levels:
    576d8d7f793a790f5644a7acc83914fd
    So the OSM tile server was up to date but Locus did not fetch these updated tiles. Hence, I also tried to move map view away from that area, then delete the cache, end Locus, start Locus, but also no update. As I assumed Locus 3+4 could use the same cache and clearing in one is not sufficient, I cleared cache and killed both Locus 3 and 4, but no success.
  5. 2023-05-14 12:30 after clearing the cache again, the view is still the old for some zooms:
    updated: 13
    some tiles updated, some old: 14+15+17+18
    completely updated: 16


BTW, in the manual page https://docs.locusmap.app/doku.php?id=manual:user_guide:maps_online#action_menu the text and screenshot show different context menu entries' text than the actual application.

Best Answer
photo

Hello Georg,

appreciate your precise tests!! I think I've found one another possible reason for this. The library I use for downloading of map tiles uses its own small cache that may do this. I've tested it and it seems to work as expected now. So give a try next (Beta) version, thanks!

Replies (9)

photo
1

Hello Georg,

this is really weird.

"OSM - Other: Classic" map is cached into the app file Locus/mapsOnline/OSM - Other_Classic.sqlitedb file. Mentioned the "Clear map cache" button to delete this whole file so you may easily verify that this function really works. It is possible that app still displays the last visible map without the reload, but simple zoom in/out should reload all data. I'm testing it and seems to work correctly. May you check if the file is deleted for you? Thanks

photo
1

Hi Menion, also on my device, the file exists and – according to total commander search – exactly once across internal and SD card storage. It is deleted by "clear map cache". After that, moving around and zooming in/out causes more tiles to be updated but not all tiles (now LM 4.17.0). Judged by feeling (I did not count), for this change set, a lower percentage of tiles stays outdated – but the modified area was around 3-4 times bigger, so also the total amount of tiles is bigger.

Based on 2 last points, IMHO

  • a starting point for analysis could be: Why do I need to move around or zoom in/out at all to update tiles? This means there must be some other cache, which seems to have quite limited capacity (bigger region = less % of tiles outdated), so it could e.g. be display/rendering cache in RAM. Another point speaking for this other cache is, after clearing cache, LM4 does successfully display the map but not not re-create the file until I move / zoom.
  • for reproduction, it makes sense to observe a changeset affecting only few tiles


Best regards, Georg

photo
2

Hello Georg,

agree that some "move & zoom" should not be necessary. Seems I was lazy to do it properly years ago ...

I'll improve it to the next version, so "Clear map cache" will also clear map tiles from memory and refresh/reload the map. Thanks for the "push"!

photo
1

Hi Menion, thank your for refining the cache updating logic, :-) Sadly, 4.17.1 does still show the described behavior:

https://www.openstreetmap.org/search?query=wertheim#map=17/49.77732/9.50938 as of 20230530 09:10 shows all added ways (e.g. the horizontal street on top and the playground & red steps in the middle):

df48425618a437714d8fbaa4a4f01601

Locus Zoom 16 as of 20230530 09:11 also shows all added ways

64edee062215877c2b6380cabd205214

Locus Zoom 17 as of 20230530 09:11 shows added ways only in some of the tiles (bottom) while some stay old (top):433b12539dbc263722d967d8cc6baad5

I did try several different ways, all with the same result.

  • I opened toom 15 and it's outdated, so there's no clear correlation between zoom level and updating.
  • I switched to another map, cleared the cache, checked the sqlitedb-file is really removed, switched to classic.
  • I cleared the map and instantly killed Locus 4 and 3 (pushed away from recent app list), checked the file is removed, and startet Locus 3.
  • I switched to zoom 16, cleared the map, zoomed to 17.
  • I moved to another location, cleared the map, moved bay to the campground.
  • I set cache timeout to 0 hours

On the one hand, the behavior is affecting users, as "Classic" is the usually the map that is updated most quickly (minutes or hours instead of days) and also offering high zoom levels, hence I often use it after I did bold edits to check & use them in Locus. On the other hand, it's not severe as bold edits are not frequent and I can also use Vespucci to view OSM Classic tiles. All in all, it shows cache logic is not working as expected, which may be the reason for other "weird" behaviors.

Best regards,

Georg

photo
2

Hello Georg,

appreciate your precise tests!! I think I've found one another possible reason for this. The library I use for downloading of map tiles uses its own small cache that may do this. I've tested it and it seems to work as expected now. So give a try next (Beta) version, thanks!

photo
1

Dear Menion, in 4.17.2 and 3.68.2 after "clear map cache", the updated tiles showed up instantly 🙂 Thank you for your endurance in fixing this bug!

photo
1

Perfect, thanks a lot too.

Tis "minor" fix has generally a positive effect on the online map performance, perfect!

photo
1

Hi Menion,

FYI, in v4.18.1 I encountered an incomplete removal of tiles, leading to ways with gaps in some zoom levels (at right):

674dc385a26dc7495616aae71d536dd3

After repeating "clear map cache" 2-3 times, display was all right – this is sufficiently easy to do, thus IMHO no action required, but I wanted to let you know there is still something not fully reliable in case you consider it more relevant. I think I shall mention because it's a little odd that I did not encounter the issue in Locus 3 despite using it way more often than v4.

Best regards, Georg

photo
1

Hi,

interesting. Locus Classic and Locus Map use identical map cores so there should be no difference. I currently have no other idea what to improve anyway if it happens more often, let me know and we may do something with it (probably some special version). Thanks.

Leave a Comment
 
Attach a file