[Marble-devel] Review Request: GeoData KML and GPX Parser: parse ExtendedData in gx:Track

Guillaume Martres smarter at ubuntu.com
Sun Nov 20 14:36:40 UTC 2011



> On Nov. 20, 2011, 1:43 p.m., Guillaume Martres wrote:
> > src/lib/geodata/data/GeoDataTrack.cpp, line 62
> > <http://git.reviewboard.kde.org/r/103191/diff/1/?file=41540#file41540line62>
> >
> >     I guess this change (and others related) are because GPX trkpt can be without a time value (see http://www.topografix.com/GPX/1/1/#type_wptType) but it's rather ugly and means you lose information when converting to the KML format. It'd be better to do something like track.addPoint(QDateTime.invalid(), coord) in GPXtrkptTagHandler (which should translate to empty <time> tags in KML and nothing in GPX) and modify the last point added to the track instead of using appendWhen in GPXtimeTagHandler
> 
> Niko Sams wrote:
>     Ok, I'll change that.
> 
> Niko Sams wrote:
>     ...but m_pointMap is a QMap<QDateTime, GeoDataCoordinates> and so can story only a single coordinate for QDateTime::invalid()) :/

Yes, this complicates things. We should either discard the points without a time or if we want to fully support the kml and gpx specs, we may need to use another data structure to preserve order, for example, the following is valid:
    <gx:Track>
      <when>2010-05-28T02:02:09Z</when>
      <when></when>
      <when>2010-05-28T02:02:44Z</when>
      <when></when>
      <when>2010-05-28T02:02:54Z</when>
      <gx:coord>-122.207881 37.371915 156.000000</gx:coord>
      <gx:coord>-122.205712 37.373288 152.000000</gx:coord>
      <gx:coord>-122.204678 37.373939 147.000000</gx:coord>
      <gx:coord>-122.203572 37.374630 142.199997</gx:coord>
      <gx:coord>-122.203451 37.374706 141.800003</gx:coord>
    </gx:Track>

And I'm not familiar with GPX but the following is probably valid:
      <trkpt lat="47.644548" lon="-122.326897">
        <ele>4.46</ele>
        <time>2009-10-17T18:37:26Z</time>
      </trkpt>
      <trkpt lat="47.644548" lon="-122.326897">
        <ele>4.94</ele>
      </trkpt>
      <trkpt lat="47.644548" lon="-122.326897">
        <ele>6.87</ele>
        <time>2009-10-17T18:37:34Z</time>
      </trkpt>

In both cases, simply putting the points without a time in a list is not enough, we need to know the time value of the point before and the one after.
Or we could just discard points without a time if supporting this is too much work for too little benefit.


- Guillaume


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103191/#review8338
-----------------------------------------------------------


On Nov. 20, 2011, 12:46 p.m., Niko Sams wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103191/
> -----------------------------------------------------------
> 
> (Updated Nov. 20, 2011, 12:46 p.m.)
> 
> 
> Review request for Marble.
> 
> 
> Description
> -------
> 
> gx:Track can contain ExtendedData used for embedding eg. heartrate data to a track:
> http://code.google.com/intl/de-DE/apis/kml/documentation/kmlreference.html#gxtrack
> 
> This patch implements:
> - the data structure in GeoDataTrack
> - the kml parser for this structure (supporting example files in kml specs)
> - the gpx parser for this structure (supporting files created by garmin devices)
> 
> Gpx parser also now handles elevation data.
> 
> Gpx parser now creates a GeoDataTrack object (instead of GeoDataLineString)
> (I'm not sure if this change could cause problems)
> 
> 
> Diffs
> -----
> 
>   src/lib/.TracksModel.cpp.kate-swp PRE-CREATION 
>   src/lib/geodata/data/GeoDataExtendedData.h f095cdb 
>   src/lib/geodata/data/GeoDataExtendedData.cpp 4011240 
>   src/lib/geodata/data/GeoDataExtendedData_p.h 361e894 
>   src/lib/geodata/data/GeoDataSimpleArrayData.h PRE-CREATION 
>   src/lib/geodata/data/GeoDataSimpleArrayData.cpp PRE-CREATION 
>   src/lib/geodata/data/GeoDataTrack.h 2f0e0c3 
>   src/lib/geodata/data/GeoDataTrack.cpp c8b5ccf 
>   src/lib/geodata/data/Serializable.h cfa4b74 
>   src/lib/geodata/handlers/kml/KmlCoordinatesTagHandler.cpp dce7679 
>   src/lib/geodata/handlers/kml/KmlElementDictionary.h 624465a 
>   src/lib/geodata/handlers/kml/KmlElementDictionary.cpp 07f33fd 
>   src/lib/geodata/handlers/kml/KmlExtendedDataTagHandler.cpp 669fb5e 
>   src/lib/geodata/handlers/kml/KmlSchemaDataTagHandler.h PRE-CREATION 
>   src/lib/geodata/handlers/kml/KmlSchemaDataTagHandler.cpp PRE-CREATION 
>   src/lib/geodata/handlers/kml/KmlSimpleArrayDataTagHandler.h PRE-CREATION 
>   src/lib/geodata/handlers/kml/KmlSimpleArrayDataTagHandler.cpp PRE-CREATION 
>   src/lib/geodata/handlers/kml/KmlValueTagHandler.cpp a2e5441 
>   src/lib/geodata/parser/GeoDataTypes.h fee81bd 
>   src/lib/geodata/parser/GeoDataTypes.cpp 4443896 
>   src/plugins/runner/gpx/CMakeLists.txt dae7719 
>   src/plugins/runner/gpx/GpxParser.cpp 61a749f 
>   src/plugins/runner/gpx/handlers/GPXElementDictionary.h 37152bd 
>   src/plugins/runner/gpx/handlers/GPXElementDictionary.cpp 471ad64 
>   src/plugins/runner/gpx/handlers/GPXTrackPointExtensionTagHandler.h PRE-CREATION 
>   src/plugins/runner/gpx/handlers/GPXTrackPointExtensionTagHandler.cpp PRE-CREATION 
>   src/plugins/runner/gpx/handlers/GPXeleTagHandler.h PRE-CREATION 
>   src/plugins/runner/gpx/handlers/GPXeleTagHandler.cpp PRE-CREATION 
>   src/plugins/runner/gpx/handlers/GPXextensionsTagHandler.h PRE-CREATION 
>   src/plugins/runner/gpx/handlers/GPXextensionsTagHandler.cpp PRE-CREATION 
>   src/plugins/runner/gpx/handlers/GPXhrTagHandler.h PRE-CREATION 
>   src/plugins/runner/gpx/handlers/GPXhrTagHandler.cpp PRE-CREATION 
>   src/plugins/runner/gpx/handlers/GPXtimeTagHandler.h PRE-CREATION 
>   src/plugins/runner/gpx/handlers/GPXtimeTagHandler.cpp PRE-CREATION 
>   src/plugins/runner/gpx/handlers/GPXtrkptTagHandler.cpp 455e8e1 
>   src/plugins/runner/gpx/handlers/GPXtrksegTagHandler.cpp 9b1a24e 
>   src/plugins/runner/gpx/tests/TestTrack.cpp PRE-CREATION 
>   tests/TestGeoDataTrack.cpp c9f347d 
> 
> Diff: http://git.reviewboard.kde.org/r/103191/diff/diff
> 
> 
> Testing
> -------
> 
> Unittests included in patch.
> 
> 
> Thanks,
> 
> Niko Sams
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/marble-devel/attachments/20111120/637f1634/attachment-0001.html>


More information about the Marble-devel mailing list