Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tile Cache Overview when zoomed out in offline mode. #3133

Closed
InsertUser opened this issue Aug 8, 2021 · 12 comments
Closed

Tile Cache Overview when zoomed out in offline mode. #3133

InsertUser opened this issue Aug 8, 2021 · 12 comments

Comments

@InsertUser
Copy link
Contributor

Use case

I often map with automatic upload off due to a lack of mobile data connection. For this I pre-download quests in the area I expect to be. StreetComplete caches map tiles for these areas at the same time, but the quest expiry and tile expiry often don't align. This has lead to situations where the map tiles run out while mapping even though quests are visible. This is difficult to spot when setting out because quests are shown over less detailed map tiles when zoomed out and it is only when mapping that it becomes clear that building level tiles aren't available.
Screenshot showing location and quests over a blank map

Proposed Solution

Give the option to display shading or hatching for areas missing detailed tiles when zoomed out. This would preferably be a separate option in settings but could be turned on when automatic upload is set to off or WiFi only. To my mind this would look a bit like JOSM's shading for regions outside the downloaded map area. This could also be used to influence a route when no internet connection is available (stay within the cache).

@smichel17
Copy link
Member

I think instead of an option, it would make sense to always do this when offline. That way you can download and then go offline to quickly check that you got everything you wanted.

@westnordost
Copy link
Member

Well, the tiles are actually all downloaded together with the map data. So usually, if you download an area, you will be able to zoom in and out of that area from zoom 0 to zoom 19 without problem.

Actually, the deletion is timed to be at the same time: The downloaded OSM map data and the downloaded tiles are considered "fresh" for 12 hours. And they are deleted (if not refreshed in between) after 14 days.
Though, the mechanisms how the data is deleted is different.

The background map is a HTTP cache, meaning that exactly after 24*14 hours, a tile is considered "too stale" to be used. (It is managed by OkHttp).
The map data (i.e. the quest pins) are managed by the app itself and cleaned on startup of the app. So, data that is older than 14 days is cleared then but what may happen is that then, during use of the app on the 14th day, the map starts to disappear. If you restart the app, the quests should be gone too.

In any case, since both data comes from different data sources and is managed by different systems, I am not so keen in worring about synchronizing the clean-up too much.

@InsertUser
Copy link
Contributor Author

Actually, the deletion is timed to be at the same time: The downloaded OSM map data and the downloaded tiles are considered "fresh" for 12 hours. And they are deleted (if not refreshed in between) after 14 days.

So the cached tiles are always refreshed if the tiles are older than 12hrs? I thought I was seeing tiles that have been discarded because they were a few day old when the quests were refreshed and ended up expiring first. My pan and download technique must be flawed.

@Helium314
Copy link
Collaborator

Maybe you hit the tile cache limit? Not sure what happens then, but I guess the oldest tiles would be deleted.

@InsertUser
Copy link
Contributor Author

I might have hit the limit? I do have it set to the maximum, is there a way to check utilisation?

@mnalis
Copy link
Member

mnalis commented Aug 9, 2021

I might have hit the limit? I do have it set to the maximum, is there a way to check utilisation?

Not in the app as far as I know; but you can go into Android system Settings / Apps / Apps / StreetComplete / Storage which should tell you how much data is app using (and also give you the option to clear it -- which would lose all app data, including non-uploaded quests and login/password)

@westnordost
Copy link
Member

So the cached tiles are always refreshed if the tiles are older than 12hrs?

Yes, if you have an internet connection at the time.

Usually the cache limit is unecessarily large, a max cache is possible, but unlikely (from experience).

Anyway, I will close this.

@peternewman
Copy link
Collaborator

I must be the exception then @westnordost . My map cache is set to 250MB in the app, but the Android storage report shows:
User data: 313MB
Cache: 399MB

I'm assuming the database is in one of those (user data), but it's certainly possible to more than surpass the configured cache limit!

@westnordost
Copy link
Member

westnordost commented Aug 13, 2021 via email

@InsertUser
Copy link
Contributor Author

For what it's worth StreetComplete was using ~200MB (currently 207MB with 72.45 MB user data and 84.58 MB cache) around the time this issue was marked closed¹. I don't know how close to the cache limit I was when I had the disappearing map issue.

1: I thought commenting after closure might reopen, but it seems it doesn't.

@mnalis
Copy link
Member

mnalis commented Aug 16, 2021

I can also confirm strangeness when running StreetComplete v33.2 when not having Internet connection.
For example on 16.8.2021. it would not show any tiles, no matter how far or close do I zoom in/out, while showing the quests.
That city where it happened was not visited before 13.8.2021., when it and all the tiles and quests were downloaded at the same time.
Screenshot_20210816_104845_de westnordost streetcomplete debug_s

The Android claims:

Total 171 MB
App 97.98 MB
Data 73.50 MB
Cache 471 kB

After enabling a data connection for just a second or two suddenly all tiles appeared (and while possible, it seems strange that they could've been downloaded that fast. It looked more like all tile display was waiting for some lock, and that lock suddenly got released when data connection was enabled).

That is with 50MB MapCacheSize limit in settings. BTW, should that Settings limit count against Cache or Data ?

@westnordost
Copy link
Member

Cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants