[Qgis-user] GPX data in QGIS.

Fernando M. Roxo da Motta petro at roxo.org
Mon Nov 2 04:57:23 PST 2020


On Sun, 1 Nov 2020 17:26:46 -0500, Garth Fletcher <garth at jacqcad.com>
wrote:

  Just a side note.

  If I understand it correct, this procedure will store in attribute
table (as a temporary or permanent attribute) the coordinates as they
are at the time it is stored.   If a point is moved through edition that
value will not be updated automatically.  It will be necessary to store
the new value in the table with the described procedure.


> My experience is with .gpx files generated by a Garmin eTrex-20.
> 
> When I use QGIS's Data Source Manager to open a and Add a .gxp file I
> see several different layers:
>   Tracks
>   Track Points
>   Routes
>   Route Points
>   Waypoints
> 
> The one you want is "Track Points" because it contains all the
> individual points which collectively make up the tracks. "Tracks"
> only contains link(s) to the various tracks that have been recorded -
> it usually only contains one item unless you have saved multiple
> tracks.
> 
> You may also be interested in "Waypoints" if you've recorded specific
> waypoints on your GPS.
> 
> So Add the layers of interest (Track Points and maybe Waypoints)
> 
> Because a .gpx file is "input only", your first step needs to be to
> to right-click on the layer, select Export > Save Features As...
> 
> This will let you save the layer in a form that can be edited. Keep
> this new layer (you can remove the original .gpx layer)
> 
> The layer's Attribute Table contains fields for all sorts of
> attributes, but NOT including the location (Lat,Long) data which is
> stored separately.
> 
> So to be able to make your own location based calculations you want to
> copy the point locations into new fields in the Attribute Table.
> 
> With the layer selected, select the Field Calculator (Abaccus icon in
> toolbar)
>   check Create a new field
>   enter a name, e.g., "Latid"
>   set Output field type to Decimal number (real)
>   set Output field length to 10, Precision to 6
>   type "$y" in the Expression window below
>     {$y is the location's Y axis, i.e., its latitude}
>   click OK
> the first time it may warn you that the layer is not in edit mode and
> than proceding will turn on edit mode - this is fine
> 
> Now repeat for a 2nd field, using a different field name and
> expression "Longid" and $x
> 
> Now when you open the layer's Attribute Table you will see 2 new
> fields at the right which contain the point's Latid and Longid
> values...
> 
> Save the layer if you want to keep these additions.
> 
> 
> On 11/1/20 2:17 PM, J. M wrote:
> > Hi again Garth,
> > 
> > Well I parked this problem and only just came back to it. I may
> > have missed something, but when I create the new fields you
> > suggested in the Track they contain no information. Is this a very
> > advanced procedure? It seems like something quite basic, but
> > perhaps I've underestimated it (as I usually do with QGIS!).
> > 
> > Kind regards,
> > Jimi.
> > 
> > On Fri, Sep 11, 2020 at 11:51 AM J. M <jimimckay at gmail.com 
> > <mailto:jimimckay at gmail.com>> wrote:
> > 
> >     Hi Garth,
> > 
> >     Thanks a lot for the very complete answer! I'll give it a go as
> > soon as I resolve an unrelated Ubuntu problem. I hadn't realised
> > that GPX data wasn't automatically visible in Properties, and that
> > fields had to be created.
> > 
> >     Kind regards,
> >     Jimi.
> > 
> >     On Fri, Sep 11, 2020 at 4:26 AM Garth Fletcher
> > <garth at jacqcad.com <mailto:garth at jacqcad.com>> wrote:
> > 
> >         On 10 Sep 2020 at 20:12, J. M <jimimckay at gmail.com
> >         <mailto:jimimckay at gmail.com>> wrote:  
> >          > I can successfully import .gpx files into QGIS, and they
> >          > are  
> >         visible and  
> >          > can be clustered in new groups (waypoints, tracks and
> >          > routes  
> >         appear as  
> >          > independent layers). The problem I'm having is that I
> >          > can't  
> >         seem to find  
> >          > any way to access the data about the routes (distance,
> >          > time,  
> >         etc) which is  
> >          > clearly visible in the app I used to create the tracks  
> > 
> >         The GPX file contains a number of fields whose contents you
> > can see /
> >         access in the layer's Attribute Table
> >            right-click on layer and choose Open Attribute Table
> > 
> >         However, these are only the extra fields in the GPX records
> > but NOT including the x,y coordinates (Long,Lat)
> > 
> >         To access the later, use the Field Calculator
> >            select the layer
> >            click on Open Field Calculator icon (Abaccus) in the
> > menu bar which is next to the Open Attribute Table icon in menu, or
> >             in Processing > GDAL > Vector Table > Field Calculator
> > 
> >         create new fields, called Lat and Long, as decimal numbers
> >         and enter the expression $X or $Y (see Geometry > for
> > details) When you click OK, the new fields will be appended and
> > filled in with the right values.
> > 
> >         You can then access them in the layer's Attribute Table.
> > 
> >         With those 2 extra fields you essentially have access to
> > everything that was recorded in the GPX file.
> > 
> >         You can also use Field Calculator to add more fields and
> > populate them with calculation results.
> > 
> >         As an aside, Field Calculator cannot create new fields in
> > the GPX file; instead it creates them as temporary virtual fields.
> > 
> >         A better approach is to first save the data in a shape file
> >            right-click on layer, choose Export > Save selected
> > features then open that file instead of the original GPX.
> >         Field Calculator will add new fields to that format.
> > 
> >         Cordially,
> >         -- 
> >         Garth Fletcher  
> 








  Roxo

-- 
---------------- Non luctari, ludare -------------------+ WYSIWYG
Fernando M. Roxo da Motta <petro at roxo.org>              | Editor?
Except where explicitly stated I speak on my own behalf.|  VI !!
                PU5RXO                                  | I see text,
------------ Quis custodiet ipsos custodes?-------------+ I get text!
 


More information about the Qgis-user mailing list