Read GPX file and write GPX file

版本 1.0.0 (5.2 KB) 作者: Peter Seibold
1.) Read a GPX file, 2.) Write a GPX file
4.0 次下载
更新时间 2024/8/16

查看许可证

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

引用格式

Peter Seibold (2024). 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. 检索来源 .

MATLAB 版本兼容性
创建方式 R2020a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0