Helium314 / SCEE

OpenStreetMap surveyor app for experienced OSM contributors
GNU General Public License v3.0
154 stars 12 forks source link

Exported tracks have malformed XML (in `<hdop>`) #683

Open GideonBear opened 1 month ago

GideonBear commented 1 month ago

Example of exported track:

<?xml version="1.0" encoding="UTF-8"?>
<gpx 
 xmlns="http://www.topografix.com/GPX/1/1" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
  <trk>
    <name>track_1</name>
    <trkseg>
     <trkpt lon="snip" lat="snip">
       <time>"snip"</time>
       <ele>"73.0"</ele>
       <hdop>"1.3">
     </trkpt>
     <trkpt lon="snip" lat="snip">
       <time>"snip"</time>
       <ele>"73.2"</ele>
       <hdop>"1.4">
     </trkpt>
    </trkseg>
  </trk>
</gpx>

Note the <hdop>"1.3"> line.

How to Reproduce

  1. Enable GPX notes
  2. Start a track
  3. Walk a bit
  4. Stop the track
  5. Press the GPX button
  6. Export all notes
  7. Unzip the notes.zip file
  8. The resulting track_1.gpx file is malformed.

I think the problem lies in the app/src/main/java/de/westnordost/streetcomplete/data/osmnotes/edits/NoteEditsController.kt file, which contains the exact wrong string that is output. I think the fix is as simple as:

-                            "       <hdop>\"${it.accuracy}\">\n"
+                            "       <hdop>\"${it.accuracy}\"</hdop>\n"

I can make a PR if necessary.

Expected Behavior

A valid GPX file to be exported

Does it happen in normal StreetComplete? The code I mentioned and the functionality for exporting GPX files do not exist in normal StreetComplete

Versions affected

Android 14 SCEE 59.2

HolgerJeromin commented 1 month ago

Yes, please make a pr