Work offline: keep an area, and cache what is viewed - #63
Merged
Merged
Conversation
The anchor group gains "Keep this area offline": the cell around the place, 200 km north to south, fetched as its 25 shards of the website's landmark archive and kept on the device, 84 kB around Toronto. There the anchor list works with no connection, and so does reading an anchored line, against the kept landmarks when it gives its region. A name on its own is still refused offline, since nothing on the device can show it is unique. An area is kept whole or not at all, so it never fails offline where it was promised not to. Only what the reader asked for is written or counted as kept; shards fetched while looking around stay in memory. A kept shard is read when it comes from the archive the site is serving, or when there is no connection to ask. When part of a point's box cannot be read, at the edge of a kept area, the list shows what it has and says places are missing. Forget gives everything back. The folder is kept out of the device's backup and out of the cache the system may empty.
The map is not downloaded ahead of being looked at: an area at full detail is about 17,000 tiles, and the tile provider's terms rule out collecting its data in automated ways without permission. Instead the map library's own cache grows from 50 MB to 200 MB, so the map draws offline wherever it has already been looked at, and the landmark shards met while looking around are cached too, in the app's cache and trimmed to 20 MB, never counted as kept. Forget empties that cache with the kept areas. With no connection to the name index, a name is found among the landmarks on the device, kept or seen, and the list says that is where it came from. The kept area is now the five by five block of shards around the place's own rather than the grid cell above it: the same 25 shards, but reaching 100 km every way. Around downtown Toronto the grid cell stopped 15 km east; the centred block takes in the east of the city and reaches Muskoka.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The app now works offline in two ways.
An area the reader keeps. "Keep this area offline" in the anchor group fetches the 25 landmark shards around the place and keeps them on the device: 184 kB around downtown Toronto. There, with no connection:
Wherever the app has already been used.
The map is not downloaded
An area's map at full detail is about 17,000 tiles, an estimated 50 to 150 MB from sampling each zoom level. OpenFreeMap's terms, updated 9 September 2026, rule out attempting "to collect data from the service in automated ways without permission". Fetching an area's tiles in the background would be exactly that. So offline the map is whatever the reader has already looked at, and the kept-area note says so.
The kept area is centred on the place
The website keeps the grid cell one level above the shards. It is the same size, but fixed to the grid: downtown Toronto sits in the corner of its cell (43.21 to 45.00 N, 81.60 to 79.21 W), which stops about 15 km east of downtown. The app keeps the five by five block of shards around the place's own shard instead. That reaches 100 km every way: the east of the city (
G3T9), Muskoka to the north, Niagara to the south.Rules
noBackupFilesDir: out of the device's backup, and out of the cache the system may empty.Checks
G3RJ, 25 shards and 184 kB, includingG3T9(east Toronto) andG3R5(Muskoka).nathanfound Nathan Phillips Square from the device, with the note, and picking it went there.