Read GPX file and write GPX file

1.) Read a GPX file, 2.) Write a GPX file
119 téléchargements
Mise à jour 16 août 2024

Afficher la licence

Read GPX file
Read all track points and waypoints and put them into arrays
INPUT:
  • GPX file name (and path)
PROCESS:
  • Convert XML to DOM data
  • Track points: Extract latitude, longitude, elevation and time
  • Way points: Extract latitude, longitude, elevation, time and name
OUTPUT:
  • Track points: double array [latitude, longitude, elevation] and cell vector {time}
  • Way points: double array [latitude, longitude, elevation] and cell array {time, name}
If an elevation is not present, this elevation is set to zero.
If a time or name is not present, this time or name is set to empty.
If any lat, lon, elev. is not a number, 'CORRUPT GPX FILE!' is returned for the first way point name.
Write GPX file
Function to write a GPX file with given track and way points.
INPUT: DataGPX, a struct with the fields:
  • fileName: string, default 'MyGPX' + date
  • header: string with header information, default: 'version="1.1" xmlns="http://www.topografix.com/GPX/1/1"'
  • wpts: lat, lon, ele, double nwpt x 3 or nwpt x 2, nwpt is number of way points, default: no way points
  • default for elevation: 0
  • wptTime: time of a way point, cell array nwpt x 1, default: no way point time
  • wptName: name of a way point, cell array nwpt x 1, default: no way point name
  • trkName: name of total track, string, default: file name
  • trkPts: lat, lon, (ele), double ntrk x 3 or ntrk x 2, ntrk is number of track points, default: no track points
  • default for elevation: 0
  • trkTime: time of a trk point, cell array ntrk x 1, default: no track time
All fields are optional
A demo file is included

Citation pour cette source

Peter Seibold (2025). Read GPX file and write GPX file (https://fr.mathworks.com/matlabcentral/fileexchange/171459-read-gpx-file-and-write-gpx-file), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R2020a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version
1.0.0