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

Updated offline mapping download(s) #156

Open
jf1 opened this issue Oct 4, 2016 · 9 comments
Open

Updated offline mapping download(s) #156

jf1 opened this issue Oct 4, 2016 · 9 comments
Assignees

Comments

@jf1
Copy link

jf1 commented Oct 4, 2016

Please update the UK offline map-pack download, or enable the app to use third-party map-packs such as those found here.

@mvl22
Copy link
Member

mvl22 commented Oct 5, 2016

@oliverlockwood
Copy link
Member

Following on from some experimentation in 1b43b05, and digging around in the separate map-packs app, I believe we should go for an in-app solution. I believe the technical hurdles can be overcome and the overall solution would be better.

Here's my approximate proposal:

Under "Settings"->"Maps display"

  • Replace "Map style" with "Map source/style" or similar. I think we should then change the behaviour here to enumerate all the currently-downloaded offline maps, and allow choosing between these.
  • Replace "Vector mapfile" setting with "Offline maps". This will probably be a separate Activity (like e.g. LocationsActivity)

Under "Offline maps"

  • Show all supported maps. This requires knowing:
    1. which conceptual mapping areas (e.g. Great Britain, Czech Republic, Germany) are supported. As a first pass I'll probably hardcode this; it'll need to have some way to correlate with the next item.
    2. the latest available map downloads. For each, we'll need a correlation to the above (so we know which ones to show), plus path, size (to nearest MB probably sufficient) and last-updated date (so people can know whether any updates are available).
      - As a starting point, I've been hitting the Apache index page for "Europe" and then parsing the HTML that comes back.
      - @mvl22 has suggested creating a server URL to support this, and to proxy the relevant actual downloads to reduce load on the origin. Ideally I'd like to be involved in specifying this URL (the needs of which may evolve as I dig further on this feature).
  • We'll only want to ping the API (Apache server or CycleStreets API) a maximum of once a day; so we'll need to persist this data somewhere in the app. Due to the complexity of the data, a DB table seems to me to be the most likely candidate.
  • The view here should use the above information to:
    • allow downloads
    • make it clear which maps you already have downloaded
    • allow downloading of new versions if available
    • allow deleting of no-longer-needed or corrupt (failed-download) mapfiles.
  • For downloading itself:
    • as a first pass, I propose:
      • a simple, but cancelable, operation which populates a progress bar. (I anticipate handling of pause/resume/navigation away in the app to be the most complex issue here.)
      • popping up an "it's big" warning dialog to users before commencing download.

Subsequent enhancements to consider:

  • checking the wifi / 4G state etc prior to download
  • incorporating a library to provide pause/resume functionality
  • Allowing configurable storage locations (as per Configurable offline map location  #101).

Feedback welcomed - particularly @jezhiggins and @mvl22.

@mvl22
Copy link
Member

mvl22 commented Oct 10, 2018

All sounds sensible.

creating a server URL to support this,

I'm planning to write a proper API call - we are trying to move to the scenario where every request to get resources, other than tiles and Photomap images, is properly supported via the API. At present there remain some odds and ends like KML files and elevation charts which clients are getting by working out URLs rather than being told them explicitly in an API response.

Essentially this API call will be very similar to the JSON in Oliver's prototype - just a listing. But it will have the download URLs in them, rather than the client having to construct that.

@oliverlockwood
Copy link
Member

FYI, the work-in-progress branch is manage-offline-maps-inside-main-app.

@mvl22
Copy link
Member

mvl22 commented Oct 13, 2018

There is now a work-in-progress API, which emits a GeoJSON listing of the areas and their corresponding download file URL, at:

https://api.cyclestreets.net/v2/mapdownloads.list
https://api.cyclestreets.net/v2/mapdownloads.list?fullgeometries=1

This will show the centroid of each download, unless fullgeometries=1 is added, in which case the full polygons are shown, but that naturally increases the retrieval size of this GeoJSON file considerably.

Obviously please add in the usual way &key=... (or clicking on the links will prompt you for the key as the username, no password).

There are unimplemented aspects, which I am still to work through:

  • Top-level entries like all of Africa don't actually exist
  • Download size is not yet present
  • Latest update date is not yet present

Feedback/suggestions very welcome.

@mvl22
Copy link
Member

mvl22 commented Apr 22, 2020

FYI, the work-in-progress branch is manage-offline-maps-inside-main-app.

OOI, how far off is this one? Would be good to progress this as it's still a rather bad set up of using the separate UK map 'app'.

@oliverlockwood
Copy link
Member

@mvl22 quite a long way off, I'm afraid. I am intending to try to pick this up again after doing the various higher priority bug fixes and getting a new release out. I had to pause my contributions a couple of years ago due to other commitments (paid work & family) leaving me insufficient time available for hobby coding.

@mvl22
Copy link
Member

mvl22 commented Jun 26, 2020

There is now a work-in-progress API, which emits a GeoJSON listing of the areas and their corresponding download file URL

This API is now stable and published:
https://www.cyclestreets.net/api/v2/mapdownloads.list/

There are unimplemented aspects, which I am still to work through:
Top-level entries like all of Africa don't actually exist
Download size is not yet present
Latest update date is not yet present

All these and other known bugs are now resolved.

The API will only the map packs that actually exist (not all Geofabrik areas as before). Date and download size are also shown.

The download URL given will be a cyclestreets.net subdomain. Currently this is a mirror from the upstream, but I am implementing caching (as it should be us bearing the traffic obviously) - which will be transparent to the results you get.

@mvl22
Copy link
Member

mvl22 commented Jun 27, 2020

Currently this is a mirror from the upstream, but I am implementing caching (as it should be us bearing the traffic obviously)

Caching now in place.

So this API is now fully production-ready.

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

No branches or pull requests

3 participants