labexp / osmtracker-android

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

Change GPX format to 1-line-per TRKPT/WPT #262

Open icrf2000 opened 4 years ago

icrf2000 commented 4 years ago

Up for discussion... Would it be better to use a shorter, one-line-per-TRKPT/WPT format for the GPX? Like this example extract:

<wpt lat="49.2222222" lon="6.2222222"><ele>292.5177487349743</ele><time>2020-07-13T05:52:22Z</time><name><![CDATA[strange thing]]></name><cmt><![CDATA[Accuracy: 4.0m]]></cmt><sat>0</sat></wpt>

<trkpt lat="49.1111111" lon="6.1111111"><ele>401.0680689362131</ele><time>2020-07-13T16:11:46Z</time><extensions><accuracy>4.0</accuracy><speed>6.1111111</speed></extensions></trkpt>
<trkpt lat="49.1111111" lon="6.1111111"><ele>400.2452699656739</ele><time>2020-07-13T16:12:31Z</time><extensions><accuracy>4.0</accuracy><speed>0.0</speed></extensions></trkpt>

Instead of the current, rather chatty, multi-line format:

<wpt lat="49.2222222" lon="6.2222222">
        <ele>350.5442492790497</ele>
        <time>2020-07-13T15:53:59Z</time>
        <name><![CDATA[strange thing]]></name>
        <cmt><![CDATA[Genauigkeit: 4.0m]]></cmt>
        <sat>0</sat>
</wpt>

<trkpt lat="49.1111111" lon="6.1111111">
        <ele>369.5771920897871</ele>
        <time>2020-07-13T15:58:22Z</time>
        <extensions>
                <speed>14.983394622802734</speed>
        </extensions>
</trkpt>
<trkpt lat="49.1111111" lon="6.1111111">
        <ele>362.5912822529774</ele>
        <time>2020-07-13T15:58:30Z</time>
        <extensions>
                <speed>4.170810222625732</speed>
        </extensions>
</trkpt>

Advantages I see:

I can provide a PR for this.

jamescr commented 4 years ago

Keeping the discussion, and what if the format of the GPX could be value to be selected in the GPX settings, with options: human readable (like it is now, and default option) or machine readable (your proposal).

Besides the advantages you mention, I think some people feel comfortable with the actual format.

(Just an idea).

icrf2000 commented 4 years ago

Hi @jamescr ,

you are right, we could offer the user the choice. I did so in #264. The only slight downside is that it means future enhancements will need to be done in two places, in the short versions of the functions and in the long ones. But that's acceptable, a one-time effort. And better than breaking user experience of those who love the current long format.

I made long the default.