0

I am performing GDAL ogr2org operation with ST_union(Geometry) on tracks from GPX file to split those at intersection points. Track points have elevation and depth info. In GPX track point entry looks like this:

    <trkpt lat="51.1012332738" lon="20.916904">
      <ele>130</ele>
      <extensions>
        <depth>12.3</depth>
      </extensions>
    </trkpt>

The command being executed is this:

ogr2ogr -nlt MULTILINESTRING -dsco GPX_USE_EXTENSIONS=YES -lco FORCE_GPX_TRACK=YES  -f GPX "%output_gpx%" "%input_gpx%" -dialect sqlite -sql "select ST_union(Geometry) from tracks"

The problem is that resulting GPX file looses depth and elevation data. The question is how to keep depth and elevation data in resulting GPX file after ST_union(Geometry)?

Sample GPX file: DOWNLOAD

1

In OGR, the elevation data gets stored in a point layer called track_points. You can do "normal" ogr2ogr operations preserving the elevation data like this:

 ogr2ogr -f GPX output.gpx input.gpx waypoints routes track_points

However, that fails on your ST_UNION command because you requested a Multilinestring (which has no vertex elevation data by definition).

  • Will command you provided split tracks at intersection point and preserve depth data? – alex Oct 9 '14 at 11:37
  • It preserves the depth data, but does no intersecting. Intersecting will only work with lines, not with points. But lines have no depth data, only points have it. – AndreJ Oct 9 '14 at 11:38
  • Do you have an idea how to work around this issue? – alex Oct 9 '14 at 11:39
  • Not yet, I will try what is possible... – AndreJ Oct 9 '14 at 11:40
  • For instance like making complex SQL query joining track and point data?.. – alex Oct 9 '14 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.