gen_gpx_testdata.sh (3188B)
1 #!/bin/sh 2 # This file is part of libextractor. 3 # Copyright (C) 2026 Vidyut Samanta and Christian Grothoff 4 # 5 # Regenerate src/plugins/testdata/gpx_test.gpx. 6 # 7 # Requires: nothing beyond a POSIX shell -- the file is plain text and is 8 # written out literally, so the result is byte-for-byte reproducible. 9 # 10 # The file is a GPX 1.1 track that exercises exactly the fields the gpx 11 # plugin parses: the `creator' attribute (the single most identifying 12 # item in the format), a full <metadata> block with an explicit <bounds>, 13 # two waypoints, a two-point route, and one track segment of five points 14 # carrying timestamps and elevations. The <desc> deliberately contains 15 # an entity reference so that the unescaping path is covered. 16 # 17 # The data is invented (a walk through central Zurich); it is not derived 18 # from anybody's real location history and is dedicated to the public 19 # domain (CC0). 20 set -e 21 22 srcdir=$(dirname "$0")/.. 23 out="$srcdir/src/plugins/testdata/gpx_test.gpx" 24 25 cat > "$out" <<'EOF' 26 <?xml version="1.0" encoding="UTF-8"?> 27 <gpx version="1.1" 28 creator="Garmin eTrex 30" 29 xmlns="http://www.topografix.com/GPX/1/1" 30 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 31 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"> 32 <metadata> 33 <name>Zurich morning walk</name> 34 <desc>Recorded on the way to the office & back</desc> 35 <author> 36 <name>Anna Mueller</name> 37 <email id="anna.mueller" domain="example.com"/> 38 <link href="https://example.com/~anna/"> 39 <text>Anna's tracks</text> 40 </link> 41 </author> 42 <copyright author="Anna Mueller"> 43 <year>2024</year> 44 <license>https://creativecommons.org/publicdomain/zero/1.0/</license> 45 </copyright> 46 <link href="https://example.com/tracks/2024-03-15.gpx"> 47 <text>Original upload</text> 48 </link> 49 <time>2024-03-15T07:12:00Z</time> 50 <keywords>walk,commute,zurich</keywords> 51 <bounds minlat="47.376890" minlon="8.541694" 52 maxlat="47.385100" maxlon="8.552300"/> 53 </metadata> 54 <wpt lat="47.376890" lon="8.541694"> 55 <ele>408.2</ele> 56 <name>Home</name> 57 </wpt> 58 <wpt lat="47.385100" lon="8.552300"> 59 <ele>419.3</ele> 60 <name>Office</name> 61 </wpt> 62 <rte> 63 <name>Planned route</name> 64 <rtept lat="47.377000" lon="8.542000"/> 65 <rtept lat="47.385000" lon="8.552000"/> 66 </rte> 67 <trk> 68 <name>Zurich morning walk</name> 69 <type>walking</type> 70 <trkseg> 71 <trkpt lat="47.376890" lon="8.541694"> 72 <ele>408.2</ele> 73 <time>2024-03-15T07:12:33Z</time> 74 </trkpt> 75 <trkpt lat="47.378120" lon="8.543210"> 76 <ele>412.5</ele> 77 <time>2024-03-15T07:14:03Z</time> 78 </trkpt> 79 <trkpt lat="47.380450" lon="8.546800"> 80 <ele>425.0</ele> 81 <time>2024-03-15T07:17:45Z</time> 82 </trkpt> 83 <trkpt lat="47.382990" lon="8.549900"> 84 <ele>430.7</ele> 85 <time>2024-03-15T07:21:10Z</time> 86 </trkpt> 87 <trkpt lat="47.385100" lon="8.552300"> 88 <ele>419.3</ele> 89 <time>2024-03-15T07:24:53Z</time> 90 </trkpt> 91 </trkseg> 92 </trk> 93 </gpx> 94 EOF 95 96 echo "wrote $out ($(wc -c < "$out") bytes)"