Code covered by the BSD License  

Highlights from
GPX file reader

5.0

5.0 | 5 ratings Rate this file 40 Downloads (last 30 days) File Size: 2.73 KB File ID: #24154
image thumbnail

GPX file reader

by karl critz

 

18 May 2009

%LOADGPX Loads route points from a GPS interchange file

| Watch this File

File Information
Description

% ROUTE = LOADGPX(FILENAME) Loads route point information from a .GPX
% GPS interchange file. This utility is not a general-purpose
% implementation of GPX reading and is intended mostly for reading the
% files output by the "gmap pedometer" tool.
%
% ROUTE is a Nx6 array where each row is a route point.
% Columns 1-3 are the X, Y, and Z coordinates.
% Columns 4-5 are latitude and longitude
% Column 6 is cumulative route length.
%
% Note that the mapping of latitude/longitude assumes an approximate spherical
% transformation to rectangular coordinates.
%
% Additional property/value arguments:
% LOADGPX(...,'ElevationUnits','meters',...) uses meters for elevation
% LOADGPX(...,'Viz',true,...) displays the route and elevation map
%
% For more information on the gmap pedometer and GPX output:
% http://www.gmap-pedometer.com/
% http://www.elsewhere.org/journal/gmaptogpx/
%
% See also xmlread

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
14 Jan 2010 Andrew Bliss  
14 Jan 2010 Andrew Bliss

This is a useful, good file. A few adjustments could improve it.

To allow the output, 1st line should be:
function route=loadgpx(fileName,varargin)

Calculate range before the viz section, so it can be output too if the viz option is off.

Something about the units is off but I didn't take the time to figure out what is wrong with it... gmaptogpx is outputting elevations in meters, right?

Thanks!

26 Jul 2010 David Longin  
09 May 2011 Georg Ogris  
09 May 2011 Georg Ogris

To read my Garmin data change

ptList = d.getElementsByTagName('rtept');
into
ptList = d.getElementsByTagName('trkpt');

and add:

tim = pt.getElementsByTagName('time') ;
    timChar = char(tim.item(0).getTextContent) ;
    route(i,COL_TIMEVEC) = datevec([timChar(1:10) ' ' timChar(12:19)]) ;
    

before the end of the main for-loop
with

COL_TIMEVEC = 7:12;

02 Sep 2011 Evan

Can't figure out the units of the X, Y, and Z columns. I did the same as George to get gpx files with trkpt instead of rtept. Also converted time to Matlab serial time using datenum.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
geodetic karl critz 18 May 2009 15:18:50
mapping karl critz 18 May 2009 15:18:51
latitude karl critz 18 May 2009 15:18:51
longitude karl critz 18 May 2009 15:18:51
cycling karl critz 18 May 2009 15:18:51
gps karl critz 18 May 2009 15:18:51
cycling Stefan Blaettler 15 Jul 2009 06:51:06
gps kuoping 29 Jun 2010 07:20:24
cycling Raphael 14 Jun 2011 07:28:20

Contact us at files@mathworks.com