Read GPX file and write GPX file
Versión 1.0.0 (5,2 KB) por
Peter Seibold
1.) Read a GPX file, 2.) Write a GPX file
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
Citar como
Peter Seibold (2025). Read GPX file and write GPX file (https://www.mathworks.com/matlabcentral/fileexchange/171459-read-gpx-file-and-write-gpx-file), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Se creó con
R2020a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS LinuxEtiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0 |