posm / OpenMapKitAndroid

http://openmapkit.org
BSD 3-Clause "New" or "Revised" License
128 stars 38 forks source link

Android based way to fetch OSM XML from Overpass #28

Closed hallahan closed 8 years ago

hallahan commented 9 years ago

We should have UI on the android phone to download OSM XML dynamically from the Overpass API:

This can be used instead of doing this:

https://github.com/AmericanRedCross/openmapkit/wiki/OSM-Data-from-the-Overpass-API

hallahan commented 9 years ago

For future reference, here's how we can resume downloads that have been stopped:

http://stackoverflow.com/questions/6237079/resume-http-file-download-in-java

Initial sprint will not include this.

hallahan commented 9 years ago

I'm thinking we might want to use DownloadManager instead:

http://developer.android.com/reference/android/app/DownloadManager.html

http://blog.vogella.com/2011/06/14/android-downloadmanager-example/ http://www.mysamplecode.com/2012/09/android-downloadmanager-example.html http://www.programcreek.com/java-api-examples/index.php?api=android.app.DownloadManager http://www.compiletimeerror.com/2013/11/download-manager-in-android-with-example.html#.VRH7aZPF8Wc

hallahan commented 9 years ago

After digging into DownloadManager - an excellent tool that does everything we need, there is one crucial part that it is missing. It does not do HTTP POSTs. Only HTTP GET. The usage of Overpass I am used to for getting data is via a POST. Two options are now:

  1. Find another way to download using HTTP in Android. Hopefully not having to implement all of the details that DownloadManager does.
  2. See if we can get what we need from Overpass via a GET request.
hallahan commented 9 years ago

Overpass API accepts GET requests just fine:

http://overpass-api.de/command_line.html

Looks like Apache can accept very long URLs (8190 bytes). I'm going to assume that Overpass will be fine as well. The URL limitation is a browser thing, which we don't have to worry about.

http://stackoverflow.com/questions/1289585/what-is-apaches-maximum-url-length

hallahan commented 9 years ago

Worked out an example showing how to dow downloads via Overpass:

https://github.com/hallahan/DownloadManagerTest

hallahan commented 9 years ago

Asked the Overpass folks why we aren't getting the file size in a response:

https://github.com/drolbr/Overpass-API/issues/204

dalekunce commented 9 years ago

This is awesome. The UI needs a little cleanup, I think you need something that confirms the user wants to get the osm for the bounding box. I would also have something similar to the overpass API that warns of large downloads, say over 2mb.

dalekunce commented 9 years ago

Based on some user tests this needs a confirm dialog. Users end up with lots of extraneous osm files on the phone. This would also be made better by tying the UI to issue #51