3

I'm using QGIS 2.18.17 on Linux Mint 19. I have several .gpx files of waypoints recorded using a handheld GPS device. I can load them on to QGIS or Google Earth with no problems. However, I want to be able to access the coordinate data and the values for each GPS point that I have recorded.

When I look at the attribute table of the .gpx files in QGIS, the X and Y coordinates are not displayed, although the elevation, time, name, and comment data are. When I open the .gpx files in a text editor, the coordinate information is there and I can copy and paste the values for each waypoint.

I assume that there is an automated way to do this, like converting the .gpx to a .csv file.

How do I extract all the X and Y coordinates from a .gpx file using QGIS?

7
  • You can do Layer... Save As... and choose the CSV output format. Choose Geometry type as POINT and Geometry as AS_XY:

enter image description here

Then you'll get a CSV like:

X,Y,route_fid,route_point_id,ele,time,magvar,geoidheight,name,cmt,desc,src,link1_href,link1_text,link1_type,link2_href,link2_text,link2_type,sym,type,fix,sat,hdop,vdop,pdop,ageofdgpsdata,dgpsid
-2.57063249857404,54.2370357762529,0,0,,,,,0,,,,,,,,,,,,,,,,,,
-2.56816794239764,54.2363284379558,0,1,,,,,1,,,,,,,,,,,,,,,,,,

That was a for a set of route points rather than waypoints but similar output should result.

  • Alternatively you can open the attribute table for your points layer, then use the field calculator (abacus icon) to add two new attributes (columns) based on the $x and $y expressions. Like this:

enter image description here

  • Also theres a Processing module that does exactly this, called Add Geometry Attributes:

enter image description here

after running that on my test layer I see an extra xcoord and ycoord column.

What you should actually do will depend on why you want the coordinates anyway...

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.