1

I’m missing something real obvious and I apologize for revisiting a topic addressed in several Q&A’s here. I’m an experienced GIS user (not programmer) who’s new to QGIS (can’t afford Arc in retirement). I was given GPX files from a race organizer who wants to know whether they truly have a 50K course laid out. These were generated by Motion-X GPS on an iPhone and that program can also produce KMZ files.

The files had a number of small dropouts and had to be merged into a total race route, so I performed quite a few edits before moving on to determining the total distance of the current race route.

I have followed the manual, tutorials, and a few answers here several times now. In essence, the correct steps appear to be:

  1. import the GPX tracks or KMZ file in CRS 4326
  2. save to a shapefile in an equidistant CRS
  3. add a new field to the attribute table for length, populated by $length

All values in that field remain NULL. I tried bringing in the trackpoints and converting those to a line using point to one then repeated the steps above without success. I also tried dumping the coordinates from the GPX to a text file then reading that in as a CSV file before attempting the steps above. I tried importing a KMZ instead, without success. Every alternate attempt or workaround hasn’t achieved what I need.

I’m feeling pretty dim right now. The imported map layers (GPX or KMZ) display properly and register with other base geodata, of course, so it’s extra frustrating.

First few lines of a GPX:

<gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" creator="MotionXGPSFull 22.2 Build 4844R">
<trk>
<name>50K - 0 to 1</name>
<desc>Mar 28, 2015  7:38 am</desc>
<trkseg>
<trkpt lat="39.1847345" lon="-78.5107859">
<ele>308.437</ele>
<time>2015-03-28T11:38:28.034Z</time>
</trkpt>
<trkpt lat="39.1847345" lon="-78.5107859">
<ele>308.358</ele>
<time>2015-03-28T11:38:29.413Z</time>
</trkpt>
  • 1
    Welcome to GIS SE! As a new user be sure to take the 2-minute Tour, if you have not already. Would you be able to edit your question to include links to the questions alluded to when saying that this was "a topic addressed in several Q&A’s here". It will prevent us having to retrace all your steps before being able to assist. – PolyGeo May 3 '15 at 21:31
  • Are you adding a new field with a default value of $length, or are you using the Field Calculator to calc a value to the new field with the formula $length? Is the new field a double? You probably don't want to use an equidistant projection, but you are correct you do want to save your WGS84 data to a projected coordinate system (equal area would be better) to do the length calcs. Exactly which CRS are you saving to? Where is the data? A state plane in the US or UTM zone worldwide might be a better choice. – Chris W May 3 '15 at 21:38
  • Thank you for responding Chris W. I followed the tutorial until exasperation set in. I used the Field Calculator to add the new field with a default value of $length. Should I have calc'd a value? If so, what's a sample expression? A double? Double precision, yes. I hadn't moved on to selection of a projection, but will likely use the appropriate state plane CRS for the race location in Kentucky. Forgot to mention I'm running QGIS 2.6.1-Brighton. – roncopeil May 4 '15 at 0:57
  • I'm not sure which tutorial you're referring to so I can't offer any input there (which is part of why PolyGeo suggests adding links into your question). That is a formula rather than a value, so yes it needs to be a field calculation on a record - doesn't quite work like spreadsheets. Also, it calculates the length in the CRS of either the layer or the project (layer I believe), so you need to have that set before running the calculation. – Chris W May 4 '15 at 2:36
  • Thanks again, @Chris W. This is the tutorial I should have linked. If I save a GPX track as a shapefile to a state plane CRS, then create a new field populated with $length * 1 (though length, like lat/long, is stored somewhere, it is not viewable in the attribute table), each record is populated with a length value of less than one hundredth of a foot. – roncopeil May 4 '15 at 12:17

Your Answer

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

Browse other questions tagged or ask your own question.