Select to view content in your preferred language

Fix "GPX To Features" tool so it handles tracks correctly

61
1
Tuesday
Status: Open
Labels (1)
David_Kimball
Occasional Contributor

ArcGIS Pro's "GPX To Features" geoprocessing tool doesn't handle tracks correctly - it needs more options/settings so it converts each track in the GPX file to a line feature.

Currently, the tool has these parameters: Input GPX File, Output Feature Class, Output Type ("Points" or "Tracks as polylines"). It has no Environments settings.

The "Points" setting seems to work fine. The "Tracks as polylines" setting gives useless results, at least for the GPX file I tried to use it for. This file contains some waypoint <wpt> tags, but mostly consists of hundreds of track <trk> tags, each of which contains a <trkseg> tag that contains several <trkpt> lat/lon pairs. Each track (<trk>) represents a trail or section of a trail. Some of the tracks contain a <name> tag and some don't. Here's a small sample (I replaced most of the <trkpt>s with "(etc...)" to save space:

  <trk>
    <name>Berry Pond Road</name>
    <trkseg>
      <trkpt lat="42.61294" lon="-71.091489">
      </trkpt>
      <trkpt lat="42.612943" lon="-71.091457">
      </trkpt>
      (etc...)
    </trkseg>
  </trk>
  <trk>
    <trkseg>
      <trkpt lat="42.61088939999998" lon="-71.0602296">
      </trkpt>
      <trkpt lat="42.6110512" lon="-71.0600043">
      </trkpt>
      (etc...)
    </trkseg>
  </trk>
  <trk>
    <trkseg>
      <trkpt lat="42.62879410000001" lon="-71.0780068">
      </trkpt>
      <trkpt lat="42.6288179" lon="-71.0780753">
      </trkpt>
      (etc...)
    </trkseg>
  </trk>
  <trk>
    <name>Bay Circuit Trail</name>
    <trkseg>
      <trkpt lat="42.61758360000002" lon="-71.0909179">
      </trkpt>
      <trkpt lat="42.6177747" lon="-71.0910559">
      </trkpt>
      (etc...)
    </trkseg>
  </trk>
  <trk>
    <name>Healthy Heart Trail</name>
    <trkseg>
      <trkpt lat="42.62006399999998" lon="-71.084965">
      </trkpt>
      <trkpt lat="42.620004" lon="-71.085102">
      </trkpt>
      (etc...)
    </trkseg>
  </trk>
  <trk>
    <name>Healthy Heart Trail</name>
    <trkseg>
      <trkpt lat="42.61796699999999" lon="-71.085417">
      </trkpt>
      <trkpt lat="42.618123" lon="-71.085506">
      </trkpt>
      (etc...)
    </trkseg>
  </trk>

This sample contains:

  • "Berry Pond Road" track
  • an unnamed track
  • another unnamed track
  • "Bay Circuit Trail" track
  • "Healthy Heart Trail" track
  • another "Healthy Heart Trail" track

The geoprocessing tool will handle the Berry Pond Road track and the Bay Circuit Trail track correctly (each becomes a line feature in the output File Geodatabase feature class). However, if there are two or more consecutive tracks with the same name (like Healthy Heart Trail) or no name, the consecutive tracks get combined into a single line feature, and it connects the last vertex of one track to the first vertex of the next track. Here is a screenshot of the result:

GPX_To_Features_Problematic.png

I'm not sure if the GPX file I was given is a typical GPX file or an oddball one, but it's hard for me to imagine a case where someone would want the result above.

Please fix this geoprocessing tool!

Either:

  • make the tool respect the tracks in the GPX file and output a line feature for each <trk>
  • or, if there are legitimate use cases where someone would want to combine consecutive <trk>s, add an option so the user can choose whether they want to combine consecutive <trk>s with the same (or no) name, or not.

Here's a mockup of what it might look like 😁

GPX_To_Features_mockup.png

Thanks!

1 Comment
JonathanNeal

@David_Kimball To get you working, consider looking at these 3 tools:  Reconstruct tracks allows you to split on additional fields for time enabled data.  I am hoping the (etc....) has those needed timestamps to get order.  If not, maybe you can use Feature Vertices to points to split out the points, and Points to line to sort it by your name field.

1. Reconstruct Tracks (GeoAnalytics Desktop)—ArcGIS Pro | Documentation

2. Points To Line (Data Management)—ArcGIS Pro | Documentation

3. Feature Vertices To Points (Data Management)—ArcGIS Pro | Documentation