-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
Recording and Uploading of GPX Traces #3573
Recording and Uploading of GPX Traces #3573
Conversation
Can hold click on map to start recording a GPX. Then the "stop" button can be clicked to stop. This will then create a note (next step is to write uploader and add link to the GPX path in the note).
- will record partial image uploads into the database (incase the GPX upload fails) - now serializes the tracks into the database and the note when created - include the osm-track plugin (will be used to create valid GPX)
I have completed the initial uploader, and am open to feedback / review. I am not sure why the filename is not what is specified, but I think what it is now is pretty good. It needs to have additional permissions requested from the OSM api so that it can upload and get info about the GPX track. Here is an application I created to test with (
|
First off, thank you for the effort so far, the PR and the nice demo video! There are some points to clarify first, as if I remember correctly, some problems where talked about in prior issues. If I recall correctly, the main pain points were:
Further, the question is what (additional) use cases the recording of tracks should cover. Two come to my mind:
What use case should this feature cover? |
I am not sure I agree. Maybe I qualify as "advanced", but I have no interest in using iD or JOSM to add new ways. However, I would be happy to walk down a path that is not mapped and upload a trace so that some armchair mapper can add it later. That said,
|
@westnordost I think the purpose is very specific to SC and is what you mentioned:
SC also allows for uploading of a photo along to provide more context also, which is a big advantage compared to other thirdparty apps. I personally have not used another app, and would rather just use SC instead of having to switch between apps. Some example use cases I can think of if you need motivation for this feature:
Re: Only for advance users. I am not sure I agree with this. I don't see why adding more information to the note would not be appreciated by someone online. Might me just being naïve here since I have not really used the online editor at all. @smichel17 I agree that adding more to the UI would be a bad idea, thus I hid this away in the long-press menu where a user can create a note already. Also the user can only record one trace at a time (and can still answer quests while recording), so this simplifies and only adds a single button to the screen to stop the recording. I understand the google play issues, and will read up on this, but right now if the user leaves the app, no location information is recorded in the track. This causes a "jump" in the recording, but I think it is a bit of work to require background location access and since the traces are so short I am not sure if it is worth it. I think maybe adding a popup when the user first clicks could help inform the user about where their location information is being sent? Should I add this? |
I was very sceptic about this feature. |
We might need some text to explain this. And/or, maybe putting the app into the background (for more than a few seconds) should automatically end the trace, since at this point it is no longer accurate. There are probably other options, too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My fundamental problem with this is:
-
this is not a critical feature
-
in my opinion (which is a guess) there is decent chance that Googlebot will go berserk and ban StreetComplete again once this is added. Lets say 10% chance for immediate ban. It can also cause ban in the future.
Given that I am scared and would prefer to avoid adding this.
IIRC Google bot removed the app because it claimed that the app used background location and hence, stricter policies applied to the app that the app did not comply with. The solution, in the end, was to comply with the stricter policies even though the app does not use background location. The other Google bot issue I mentioned was related to "sharing user's location", which the app also doesn't do, but as we all agreed, does so indirectly by 1. downloading map tiles at the position of the user and 2. inherently by requiring that solving quests is done on-site and the user's OSM history is public. We solved this by simply stating that "yes it does share location" in the questionaire. It was just a questionaire, apparently this information is shown to the user somewhere on google play or whatever. So, as long as a GPX track feature works the way as @goldbattle described, I think nothing should change from the viewpoint of Google. Anyway, I can agree with the others here that it sounds like a really useful feature. Especially outside cities where footpaths are not well recorded yet, this can be a really handy method to let other users know of an unmapped footpath and conveniently already supply the (exact) path with it. I'll review the code now, maybe I have some more questions then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks quite good! I didn't do a complete review yet because I found a few things on the way that should be changed.
In general, stuff that is exclusively related to GPS tracks (API wrapper, data classes) should go into an own package. Also, the naming is off (as explained in one comment).
I did not read the code about the upload yet in detail but the "upload data map" data structure strikes me as odd. But as I wrote, I did not look into this in detail yet.
Also, it may be preferrable to have the GPS traces upload in a separate class, like it is done for the image upload.
app/src/main/java/de/westnordost/streetcomplete/data/StreetCompleteSQLiteOpenHelper.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/osmnotes/NotesApi.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/user/LoginFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/map/components/TracksMapComponent.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/osmnotes/Note.kt
Outdated
Show resolved
Hide resolved
Great, thanks for the specific feedback, was a bit unfamiliar so wasn't sure where best put things in some case (just created a proof of concept). I will find some time later this week or weekend to make the requested changes, thanks! |
app/src/main/java/de/westnordost/streetcomplete/map/LocationAwareMapFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/map/LocationAwareMapFragment.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's another small review of the things you moved to the new package
app/src/main/java/de/westnordost/streetcomplete/data/osmtracks/TracksApiImpl.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/osmtracks/TracksApiImpl.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/osmtracks/TracksApiImpl.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/osmtracks/TracksApiImpl.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/osmtracks/TracksApiImpl.kt
Outdated
Show resolved
Hide resolved
…/TracksApiImpl.kt Co-authored-by: Tobias Zwick <newton@westnordost.de>
…/TracksApiImpl.kt Co-authored-by: Tobias Zwick <newton@westnordost.de>
You made some changes. Let me know when it is ready for another review. |
I need to make a few more based on the first set of comments. Will request a review once I am able to make the changes, thanks! |
app/src/main/java/de/westnordost/streetcomplete/data/osmtracks/TracksApiImpl.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/map/MainFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/map/components/TracksMapComponent.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed this for coding style and for bugs (didn't find any 🎉), but only at the surface level (each change locally within that file).
In other words, I have not considered how these changes interact with each other or the rest of the app. I think westnordost already did that, anyway. Also, I did this review entirely here on GitHub, so my bug-hunting was limited :).
There's a bunch of comments but they're all both pretty minor & easy to address— overall, it looks good!
app/src/main/java/de/westnordost/streetcomplete/data/osmnotes/edits/NoteEdit.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/osmnotes/edits/NoteEditsController.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/osmnotes/edits/NoteEditsController.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/osmnotes/edits/NoteEditsController.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/quest/QuestController.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/map/MainFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/map/MainFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/map/components/TracksMapComponent.kt
Outdated
Show resolved
Hide resolved
It still works as expected when I have this enabled. @FloEdelmann I have made the requested changes, let me know if anything else. |
app/src/main/java/de/westnordost/streetcomplete/screens/main/map/LocationAwareMapFragment.kt
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/screens/main/map/LocationAwareMapFragment.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/screens/main/map/LocationAwareMapFragment.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now (still only code review, no extensive testing) :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed just a few tiny things
app/src/main/java/de/westnordost/streetcomplete/data/osmtracks/TracksApi.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/de/westnordost/streetcomplete/data/osmtracks/TracksApiImpl.kt
Outdated
Show resolved
Hide resolved
Going to merge this now. The PR is really of excellent quality, great work! After merge, I am going to add/change a few things:
|
Great, thanks so much, sorry it took so long! Make sure the OSM API permissions get updated for the application before you release otherwise it will get into an infinite loop asking for permissions. |
Right, thanks for the hint! |
See the bottom of this comment: It needs to have additional permissions requested from the OSM api so that it can upload and get info about the GPX track. |
Fuck... I accidentally deleted the OAuth1 profile because I first created a new profile under the same name with the new permissions but only then noticed I could also just edit the old profile to include the new permissions. So then I deleted the "old" profile (the second in the list). But it looks like the newest profile is displayed first in the list :-| So, for damage control, gotta create a update for v43 now that uses the new profile because the old profile is irrevocably gone, looks like. |
Though before I hastily do this, better test what exactly happens code-/api-wise in the app if it uses an unknown oauth key... |
Okay, the hotfix v43.2 is deployed. It logs out the user automatically on first start so that the user needs to login again with the new OAuth profile. 😥 On the plus side, I could remove the permission upgrade request dialog, check and strings, see 31ebb42 becaue this upgrade plan obviously failed (my fault). |
Yeah that seems the cleanest now since all users will have the new oauth (with track perms) so no need for the added complexity. Sorry for the all the trouble :( |
Thanks, but I caused the trouble onto myself, should have been more cautious when editing/deleting the profile. |
I committed matkoniecz@06704ea to unbreak tests, hopefully without breaking anything new |
Hi, thanks again for the project.
This is trying to address the following issues:
Here is an example user experience idea of how to start recording a track, and then composing a note. Right now I am able to record the history of gps points, and have it stored in the NoteEdits database object for later uploading to the server. I also changed to visualization to highlight these recorded segments in red.
bandicam.2021-12-08.00-15-26-335.mp4
The idea is that the GPX track will be linked to the note (same as how images are currently) so this can provide additional information for editors and can be a part of the online "Public GPS Traces" overlay. The next step is for me to implement uploading to the gps trace server (I was looking at using some of this code), so any feedback is much appreciated.