diff options
-rw-r--r-- | scripts/gpx/head | 10 | ||||
-rwxr-xr-x | scripts/gpx/merge_gpx.sh | 5 | ||||
-rwxr-xr-x | scripts/gpx/merge_trk.sh | 4 | ||||
-rw-r--r-- | scripts/gpx/tail | 1 |
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 | |||
3 | GPX_DIR=$(dirname $0) | ||
4 | |||
5 | sed '/<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 | |||
3 | sed '/<trk>/,/<\/name>/ d; /<\/trk>/ d; /<\/gpx>/ i \ \ <\/trk>' |\ | ||
4 | awk '/<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> | |||