樹心幽徑

« 20180910-13安裝xml程式庫libxml2-dev並設計測試程式xml2.c用來解讀gpx航跡檔 | Main | 20180924在Ubuntu Linux装中文字型 »

20180919程式xml2b.c:解讀gpx航跡檔並另存為xmlout.gpx
2018/09/19,14:18

(1)input file: midlake.gpx

(2)code: xml2b.c

(3)complie:

g++ `xml2-config --cflags` xml2b.c `xml2-config --libs`

(4)excute:

treehrt@hrt:~/lake$ ./a.out midlake.gpx
WPT0 : WPT1 : WPT2 : WPT3 : WPT4 : WPT5 : WPT6 : WPT7 : WPT8 : WPT9 : WPT10 : WPT11 : WPT12 : WPT13 : WPT14 : WPT15 : WPT16 : WPT17 : WPT18 : WPT19 : WPT20 : WPT21 : Trk 0
midlake.gpx (wc=22 trkc=1 ) is save as xmlout.gpx ok!!

 

(5)output file:  xmlout.gpx

 

6)cat xmlout.gpx

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="xmlout.gpx" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocat
ion="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata>
<time>2018-03-20T05:09:19Z</time>
<bounds  maxlat="24.721389999613166" maxlon="121.61008159630001" minlat="24.676733650267124" minlon="121.57345452345908"/>
</metadata>
<wpt lat="24.676764998584986" lon="121.61000397987664" >
<ele>109.23812100000001</ele>
<time>2018-03-16T23:13:35Z</time>
<name>001大同郵局</name>
<sym>City (Small)</sym>
</wpt>
<wpt lat="24.681043960154057" lon="121.60281800664961" >
<ele>148.16665599999999</ele>
<time>2018-03-16T23:20:19Z</time>
<name>002涼亭</name>
<sym>City (Small)</sym>
</wpt>
<wpt lat="24.687358969822526" lon="121.59566899761558" >
<ele>257.38415500000002</ele>
<time>2018-03-16T23:25:00Z</time>
<name>003斗嫩橋岔</name>
<sym>City (Small)</sym>
</wpt>

<wpt lat="24.690732015296817" lon="121.59257397986948" >
<ele>387.77941900000002</ele>
<time>2018-03-17T09:41:35Z</time>
<name>039柵</name>
<sym>City (Small)</sym>
</wpt>
<trk>
<name>201800317崙埤池中嶺池中嶺山O</name>
<trkseg>
<trkpt  lat="24.676733650267124" lon="121.61008159630001">
<ele>71.760000000000005</ele>
<time> 2018-03-16T23:13:02Z</time>
</trkpt>
<trkpt  lat="24.676743792369962" lon="121.61002300679684">
<ele>71.760000000000005</ele>
<time> 2018-03-16T23:13:03Z</time>
</trkpt>

 

<trkpt  lat="24.690756741911173" lon="121.59254036843777">
<ele>387.06999999999999</ele>
<time> 2018-03-17T09:41:03Z</time>
</trkpt>
<trkpt  lat="24.690732602030039" lon="121.59257649444044">
<ele>387.06999999999999</ele>
<time> 2018-03-17T09:41:26Z</time>
</trkpt>
<trkpt  lat="24.690732099115849" lon="121.59257171675563">
<ele>385.63</ele>
<time> 2018-03-17T09:41:39Z</time>
</trkpt>
</trkseg>
</trk>
</gpx>

 

迴響

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType