樹心幽徑

« 20180924在Ubuntu Linux装中文字型 | Main | 20181010在ubuntu用c在mysql ilvssell資料庫new_id_reg資料表加入一筆資料(t11.c) »

20180925xml2e.c將gpx航跡檔轉存為csv文字檔
2018/09/25,20:08

(1)code: xml2e.c

(2) inputfile :20180915midlake.gpx

20180923崙埤子山越中嶺古道0915崙埤山0318崙埤池中嶺池山OReal.gpx

(3)compile

treehrt@treehrt-BM6AE-BM1AE-BP1AE:~/lake$ g++ `xml2-config --cflags` xml2e.c `xml2-config --libs`

(4)excute

treehrt@treehrt-BM6AE-BM1AE-BP1AE:~/lake$ ./a.out 20180915midlake.gpx

0:[001大同郵局] 1:[001大同鄉公所] 2:[002涼亭] 3:[002紅土咖啡岔] 4:[003斗嫩橋岔] 5:[003朝陽巷土岔] 6:[004大彎岔] 7:[004柵欄] 8:[005] 9:[005造林地] 10:[006坡岔] 11:[006昔停車處] 12:[007登山口] 13:[007紅土咖啡口] 14:[008岔] 15:[008崙埤山岔] 16:[009古道岔] 17:[009折返岔] 18:[010] 19:[011] 20:[011崙埤池岔] 21:[012土岔] 22:[012崙埤池] 23:[013] 24:[013告示牌] 25:[014崙埤池岔] 26:[014果園P] 27:[015溪溝路岔] 28:[015稜岔] 29:[016崙埤子山] 30:[017_760m] 31:[017十字岔] 32:[018_785峰] 33:[018上稜岔] 34:[019] 35:[019中嶺池岔] 36:[020] 37:[020山頭] 38:[021] 39:[021中嶺池] 40:[022] 41:[022山頭] 42:[023] 43:[023中嶺山岔] 44:[024_745折返] 45:[024牌] 46:[025] 47:[025中嶺山] 48:[026] 49:[027崙埤子山] 50:[028] 51:[028下稜點] 52:[029小溪] 53:[029航跡岔] 54:[030果園P] 55:[031] 56:[031藍白帆] 57:[032台泥岔] 58:[032溪溝] 59:[033乾溝拉繩] 60:[033紅土咖啡岔] 61:[034中嶺駐在所] 62:[035亂石] 63:[036古道岔] 64:[037登山口] 65:[038支流溪] 66:[039柵]
<trk> 0
20180317崙埤池中嶺池中嶺山O
trkpt as follow:
..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................:trkpts count =1678

Trk 0 END!!

<trk> 1
20180915崙埤子山
trkpt as follow:
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................:trkpts count =1819

Trk 1 END!!
20180915midlake.gpx (wc=67 trkc=2 ) is save as gpxout.csv ok!!

 

 

(4b)treehrt@treehrt-BM6AE-BM1AE-BP1AE:~/lake$ ./a.out 20180923崙埤子山越中嶺古道0915崙埤山0318崙埤池中嶺池山OReal.gpx
0:[001大同郵局] 1:[001大同鄉公所] 2:[002涼亭] 3:[002紅土咖啡岔] 4:[003斗嫩橋岔] 5:[003朝陽巷土岔] 6:[004大彎岔] 7:[004柵欄] 8:[005] 9:[005造林地] 10:[006坡岔] 11:[006昔停車處] 12:[007登山口] 13:[007紅土咖啡口] 14:[008岔] 15:[008崙埤山岔] 16:[009古道岔] 17:[009折返岔] 18:[010] 19:[011] 20:[011崙埤池岔] 21:[012土岔] 22:[012崙埤池] 23:[013] 24:[013告示牌] 25:[014崙埤池岔] 26:[014果園P] 27:[015溪溝路岔] 28:[015稜岔] 29:[016崙埤子山] 30:[017_760m] 31:[017十字岔] 32:[018_785峰] 33:[018上稜岔] 34:[019] 35:[019中嶺池岔] 36:[020] 37:[020山頭] 38:[021] 39:[021中嶺池] 40:[022] 41:[022山頭] 42:[023] 43:[023中嶺山岔] 44:[024_745折返] 45:[024牌] 46:[025] 47:[025中嶺山] 48:[026] 49:[027崙埤子山] 50:[028] 51:[028下稜點] 52:[029小溪] 53:[029航跡岔] 54:[030果園P] 55:[031] 56:[031藍白帆] 57:[032台泥岔] 58:[032溪溝] 59:[033乾溝拉繩] 60:[033紅土咖啡岔] 61:[034中嶺駐在所] 62:[034宜50朝陽巷口] 63:[035亂石] 64:[035大同郵局] 65:[036古道岔] 66:[036崙埤二橋岔] 67:[037登山口] 68:[037紅土咖啡岔] 69:[038台泥岔] 70:[038支流溪] 71:[039台泥岔2] 72:[039柵] 73:[040果園P] 74:[041上稜岔] 75:[042崙埤子山] 76:[043倒木山頭] 77:[044倒木] 78:[045迷航山頭] 79:[046繞圈] 80:[047出口] 81:[048倒木路條] 82:[049] 83:[050昔返] 84:[051] 85:[052] 86:[053] 87:[054午餐空地] 88:[055] 89:[056小獵營] 90:[057] 91:[058] 92:[059] 93:[060空地岔] 94:[061崙埤社區岔] 95:[062古道岔] 96:[063] 97:[064] 98:[065古道岔] 99:[066社區岔] 100:[067空地岔] 101:[068小獵營] 102:[069空地] 103:[070注意] 104:[071小鞍] 105:[072崙埤子山] 106:[073上稜岔] 107:[074果園岔]
<trk> 0
20180317崙埤池中嶺池中嶺山O
trkpt as follow:
..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................:trkpts count =1678

Trk 0 END!!

<trk> 1
20180915崙埤子山
trkpt as follow:
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................:trkpts count =1819

Trk 1 END!!

<trk> 2
20180923崙埤子山-中嶺古道
trkpt as follow:
.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................:trkpts count =1665

Trk 2 END!!
20180923崙埤子山越中嶺古道0915崙埤山0318崙埤池中嶺池山OReal.gpx (wc=108 trkc=3 ) is save as gpxout.csv ok!!

 

(5)output file :  gpxout.csv

treehrt@treehrt-BM6AE-BM1AE-BP1AE:~/lake$ cat gpxout.csv|more
id,lat,lon,high,time,name,x67,y67,x97,y97,cat
 2018-09-17T04:49:53Z,, maxlat="24.721389999613166" , maxlon="121.61008159630001" , minlat="24.676733650267124" , minlon="121.57345452345908" ,

0,"24.676764998584986", "121.61000397987664", 109,2018-03-17 07:13:35,001大同郵局,310904.24,2730317.73,311734.67,2730113.45,2018-03-17 07:13:35 p001大同郵局(310904 2730318) 109m
1,"24.677336979657412", "121.60978697240353", 153,2018-09-15 08:08:15,001大同鄉公所,310882.00,2730380.98,311712.43,2730176.71,2018-09-15 08:08:15 p001大同鄉公所(310882 2730381) 153m
2,"24.681043960154057", "121.60281800664961", 148,2018-03-17 07:20:19,002涼亭,310174.90,2730788.46,311005.33,2730584.18,2018-03-17 07:20:19 p002涼亭(310175 2730788) 148m
3,"24.686318021267653", "121.59766397438943", 226,2018-09-15 08:15:47,002紅土咖啡岔,309650.76,2731370.33,310481.18,2731166.06,2018-09-15 08:15:47 p002紅土咖啡岔(309651 2731370) 226m:

 

(6a)把第11欄的資料砍出來存為t.txt

treehrt@treehrt-BM6AE-BM1AE-BP1AE:~/lake$ cat gpxout.csv|cut -d, -f11 > t.txt

(7a)treehrt@treehrt-BM6AE-BM1AE-BP1AE:~/lake$ cat t.txt|grep 2018-09-15
2018-09-15 08:08:15 p001大同鄉公所(310882 2730381) 153m
2018-09-15 08:15:47 p002紅土咖啡岔(309651 2731370) 226m
2018-09-15 08:23:27 p003朝陽巷土岔(310128 2731334) 291m
2018-09-15 08:27:29 p004大彎岔(310292 2731697) 340m
2018-09-15 08:33:41 p005(310617 2731891) 384m
2018-09-15 08:37:52 p006坡岔(310607 2732045) 399m
2018-09-15 08:40:59 p007紅土咖啡口(310508 2732048) 441m
2018-09-15 08:49:04 p008岔(309938 2731970) 457m
2018-09-15 08:53:26 p009折返岔(309809 2731967) 439m
2018-09-15 08:57:23 p010(309946 2732164) 541m
2018-09-15 09:00:32 p011(309725 2732261) 614m
2018-09-15 09:02:00 p012土岔(309744 2732444) 641m
2018-09-15 09:04:32 p013(309454 2732716) 679m
2018-09-15 09:10:04 p014果園P(309483 2732945) 718m
2018-09-15 10:44:43 p015稜岔(309377 2733057) 763m
2018-09-15 10:54:24 p016崙埤子山(309397 2733071) 773m
2018-09-15 11:29:05 p017_760m(309269 2733132) 784m
2018-09-15 12:04:01 p018_785峰(309061 2733248) 780m
2018-09-15 12:31:31 p019(308994 2733247) 782m
2018-09-15 12:34:01 p020(308995 2733242) 780m
2018-09-15 12:50:52 p021(309026 2733273) 785m
2018-09-15 13:11:22 p022(308930 2733279) 777m
2018-09-15 13:43:11 p023(308814 2733315) 771m
2018-09-15 13:47:58 p024_745折返(308806 2733313) 771m
2018-09-15 14:01:18 p025(308902 2733313) 778m
2018-09-15 14:10:51 p026(308971 2733278) 788m
2018-09-15 14:55:48 p027崙埤子山(309396 2733072) 779m
2018-09-15 15:05:55 p028(309432 2733048) 769m
2018-09-15 15:10:07 p029航跡岔(309443 2733038) 755m
2018-09-15 15:22:04 p030果園P(309484 2732953) 736m
2018-09-15 15:43:14 p031(309972 2732131) 475m
2018-09-15 15:47:12 p032台泥岔(310292 2731713) 372m
2018-09-15 15:52:25 p033紅土咖啡岔(309621 2731401) 260m

 

(7b)

treehrt@treehrt-BM6AE-BM1AE-BP1AE:~/lake$ cat gpxout.csv|cut -d, -f11 > t.txt

treehrt@treehrt-BM6AE-BM1AE-BP1AE:~/lake$ cat t.txt|grep 2018-09-23
2018-09-23 07:07:17 p034宜50朝陽巷口(312174 2731086) 117m
2018-09-23 07:11:13 p035大同郵局(310872 2730395) 138m
2018-09-23 07:12:52 p036崙埤二橋岔(310542 2730735) 143m
2018-09-23 07:17:01 p037紅土咖啡岔(309654 2731358) 225m
2018-09-23 07:23:54 p038台泥岔(310290 2731701) 335m
2018-09-23 07:29:04 p039台泥岔2(309911 2731971) 435m
2018-09-23 07:44:03 p040果園P(309484 2732948) 695m
2018-09-23 08:36:11 p041上稜岔(309449 2733025) 746m
2018-09-23 09:03:26 p042崙埤子山(309397 2733066) 770m
2018-09-23 09:36:17 p043倒木山頭(309240 2733151) 781m
2018-09-23 09:52:25 p044倒木(309183 2733180) 773m
2018-09-23 10:31:11 p045迷航山頭(308992 2733245) 785m
2018-09-23 10:42:16 p046繞圈(309047 2733257) 787m
2018-09-23 10:51:54 p047出口(308971 2733279) 781m
2018-09-23 11:02:03 p048倒木路條(308905 2733311) 775m
2018-09-23 11:13:13 p049(308851 2733293) 772m
2018-09-23 11:21:13 p050昔返(308802 2733314) 760m
2018-09-23 11:27:56 p051(308778 2733299) 753m
2018-09-23 11:35:36 p052(308751 2733304) 752m
2018-09-23 12:03:27 p053(308695 2733313) 755m
2018-09-23 12:13:33 p054午餐空地(308668 2733321) 755m
2018-09-23 12:53:43 p055(308606 2733308) 773m
2018-09-23 12:55:49 p056小獵營(308603 2733306) 772m
2018-09-23 13:12:23 p057(308508 2733310) 765m
2018-09-23 13:26:30 p058(308465 2733310) 755m
2018-09-23 13:29:53 p059(308432 2733314) 759m
2018-09-23 13:32:57 p060空地岔(308411 2733310) 757m
2018-09-23 13:38:17 p061崙埤社區岔(308350 2733312) 750m
2018-09-23 13:42:21 p062古道岔(308258 2733325) 755m
2018-09-23 14:01:46 p063(308136 2733705) 779m
2018-09-23 14:29:21 p064(308234 2733532) 764m
2018-09-23 14:39:12 p065古道岔(308259 2733336) 749m
2018-09-23 14:45:20 p066社區岔(308342 2733309) 748m
2018-09-23 14:48:40 p067空地岔(308413 2733311) 749m
2018-09-23 15:10:16 p068小獵營(308602 2733308) 766m
2018-09-23 15:22:43 p069空地(308665 2733323) 754m
2018-09-23 16:33:27 p070注意(308965 2733282) 779m
2018-09-23 16:52:22 p071小鞍(309122 2733217) 779m
2018-09-23 17:15:47 p072崙埤子山(309392 2733071) 775m
2018-09-23 17:24:31 p073上稜岔(309450 2733034) 754m
2018-09-23 17:31:14 p074果園岔(309487 2732954) 734m
treehrt@treehrt-BM6AE-BM1AE-BP1AE:~/lake$

迴響

 
Accessible and Valid XHTML 1.0 Strict and CSS Powered by LifeType