aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2019-12-19 08:34:15 +0800
committertypebrook <typebrook@gmail.com>2019-12-19 08:34:15 +0800
commit0a2b46b0355a1120d57968d40f61cd70a1cb3242 (patch)
tree3b318c44fb633587f6c34d3f3d7f74b72ec30f41
parentfbff89ea03527b9c9a27ac62f1bcc9544f81d9fb (diff)
update
-rw-r--r--scripts/gpx/head10
-rwxr-xr-xscripts/gpx/merge_gpx.sh5
-rwxr-xr-xscripts/gpx/merge_trk.sh4
-rw-r--r--scripts/gpx/tail1
4 files changed, 20 insertions, 0 deletions
diff --git a/scripts/gpx/head b/scripts/gpx/head
new file mode 100644
index 0000000..1912e8b
--- /dev/null
+++ b/scripts/gpx/head
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
2<gpx xmlns="http://www.topografix.com/GPX/1/1" creator="MapSource 6.10.2" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
3
4 <metadata>
5 <link href="http://www.garmin.com">
6 <text>Garmin International</text>
7 </link>
8 <time>2019-12-18T06:17:16Z</time>
9 <bounds maxlat="24.554773" maxlon="121.293261" minlat="24.534487" minlon="121.284309"/>
10 </metadata>
diff --git a/scripts/gpx/merge_gpx.sh b/scripts/gpx/merge_gpx.sh
new file mode 100755
index 0000000..c62badd
--- /dev/null
+++ b/scripts/gpx/merge_gpx.sh
@@ -0,0 +1,5 @@
1#!/bin/bash
2
3GPX_DIR=$(dirname $0)
4
5sed '/<trk/,/<\/trk>/ p' -nr | cat $GPX_DIR/head - | cat - $GPX_DIR/tail
diff --git a/scripts/gpx/merge_trk.sh b/scripts/gpx/merge_trk.sh
new file mode 100755
index 0000000..c3a72d4
--- /dev/null
+++ b/scripts/gpx/merge_trk.sh
@@ -0,0 +1,4 @@
1#!/bin/bash
2
3sed '/<trk>/,/<\/name>/ d; /<\/trk>/ d; /<\/gpx>/ i \ \ <\/trk>' |\
4awk '/<trkseg>/ && !x {print " <trk>\n <name>combined_trk</name>"; x=1} 1'
diff --git a/scripts/gpx/tail b/scripts/gpx/tail
new file mode 100644
index 0000000..d0759c0
--- /dev/null
+++ b/scripts/gpx/tail
@@ -0,0 +1 @@
</gpx>