labexp / osmtracker-android

GPS tracking tool for OpenStreetMap
GNU General Public License v3.0
498 stars 234 forks source link

Missing metadata in exported .gpx file #206

Open soniok opened 5 years ago

soniok commented 5 years ago

Hi Osmtracker Android Team,

When I finish recording a hike, I enter name, description and tags meta data. Then I export it to .gpx file. When I review the gpx file with editor, I can't find the name, description and tags meta data. Is that info not written to the gpx file? I was hoping to use that meta data to sort through all my gpx files.

I guess I could always get this data from the app database with the new feature to export database.

Thanks for the app.

Setup: Nexus 5 OsmTracker: v0.7.1 from play store. LineageOS

icrf2000 commented 5 years ago

For the tags, this is done by my PR #166.

soniok commented 5 years ago

Excellent nice to see that will be hopefully merged. What about name and description? Why don't I see the info in the exported GPX files?

icrf2000 commented 5 years ago

I modified my PR #166 to export the description too. For the name, I have currenly no good idea how it could be done consistently. Currently, the app uses the static string Tracked with OSMTracker for Android™ for the GPX <name> tag, the NAME field in the GUI is not used at all for the GPX (as far as I can see). I must say I wouldn't like to see the default content of it (track start time in a crappy format, e.g. "May 29, 2019 17:50:49" - grmpf...) appear in the GPX. So if at all, the whole logic how the name field in the GUI is handled would need to be adjusted.

The code contains a comment regarding the GPX <name>:

// TODO: Maybe we should be pulling the track name instead?
// We'd need to consider the possibility that two tracks were given the same name
// We could possibly disambiguate by including the track ID in the Folder Name 
// to avoid overwriting another track on one hand or needlessly creating additional             
// directories to avoid overwriting.

Maybe the project maintainers have a solution in mind and will implement it some day.

aton1698 commented 5 years ago

The PR #166 is a very good improvement, just one thing, what do you think about changing <extensions> <tags>...</tags> </extensions> and use <keywords> ... </keywords> instead?

The gpx structure described here, says that the keywords are used in search engines or databases to classify the data.

About the issue with the name, we don't know what could be the best way to fix it, we are open to suggestions.

icrf2000 commented 5 years ago

I changed the PR, is it like you meant? If I read the GPX specs, right<keywords> must be within <metadata> and multiple tags represented by multiple <keywords>tags. Export looks now about like this

<metadata>
<keywords>bike</keywords>
<keywords>usa</keywords>
<keywords>private</keywords>
</metadata>
soniok commented 5 years ago

When entering tags in the android app gui, how am I suppose to seperate words? Should I use a comma "," or semicolone ";" or just leave a space between each word?

Anyway, nice to see progress, I can't wait for this to be deployed and updates my app. I have many tracks waiting to be exported using the descriptions and tags I've already entered.

icrf2000 commented 5 years ago

comma

EmmanuelAB commented 5 years ago

We consider that a possible solution should match the following:

soniok commented 5 years ago

Any update on this?

We consider that a possible solution should match the following:

  • The root tag gpx will have an creator attribute that indicates the software that created the gpx file. It could be "Tracked with OSMTracker for Android vX.X.X" (including the app version).
  • As child of the track the name tag will have the name of the track
  • Inside metadata section the link tag will have the url to the app's repository along with the corresponding text (The content of the text track can be "OSMTracker") tag,

I agree that the GPX metadata should have an attribute with the app name and also an attribute for link towards this git. Once properly implemented, this will allow better publicity for the app.

As for the name field in OsmTracker GUI, for me that should at least be the name of the GPX file. I suggest that the default value should be a date. But as @icrf2000 stated above, it mustn't be some shitty "May 29, 2019 17:50:49" format, but rather ISO 8601 format (2019-12-31T24:59:59). This will allow the file be properly sorted by file managers and readable by scripts. From there the user can either completely replace that default date value by anything they want (eg: BikeTrip_YosemiteNorthTrail) or append their text to the default date.

I do think though, that this file name should still be also written into the GPX metadata. The reason for this is that some online sites may rename the file once uploaded to the site. This will loose the name if it was only set into the filename, where as if it was also written to metadata inside the GPX file, then it can still be read and recognised. As per the GPX 1.1 standards #https://www.topografix.com/gpx/1/1/gpx.xsd :

The name of the GPX file.

The app OsmAnd has been also working on implementing metadata for GPX files. Maybe this could inspire who ever will be coding this.

https://github.com/osmandapp/Osmand/issues/6942

What do you guys think? Shouldn't we just implement as per GPX1.1?

EmmanuelAB commented 5 years ago

Something like in #221 ?

soniok commented 5 years ago

Yeah that seems good to me. Thanks for the contribution. 👍

EDIT: Any update on this? Is #221 ready to be merge to master?

soniok commented 5 years ago

I was very happy to see I got an update for OsmTracker v0.7.2-beta3. :) I guess that was because I'm a beta user.

The only issue is there is no gpx name written to metadata element. Keywords and Description are properly written thought, which is wonderful!!

Please can we have the name also? Isn't #221 ready for pull? @aton1698

Thanks in advance, and thanks for the previous work.