Artifact
2348c7f630a300cff3f7755d1212d4f3271a3c0e:
Wiki page
[GPX tracks] by
sandro
2015-12-11 23:24:34.
0000: 44 20 32 30 31 35 2d 31 32 2d 31 31 54 32 33 3a D 2015-12-11T23:
0010: 32 34 3a 33 34 2e 32 36 30 0a 4c 20 47 50 58 5c 24:34.260.L GPX\
0020: 73 74 72 61 63 6b 73 0a 55 20 73 61 6e 64 72 6f stracks.U sandro
0030: 0a 57 20 39 30 36 30 0a 3c 74 61 62 6c 65 20 63 .W 9060.<table c
0040: 65 6c 6c 73 70 61 63 69 6e 67 3d 22 31 32 22 20 ellspacing="12"
0050: 77 69 64 74 68 3d 22 31 30 30 25 22 3e 0d 0a 3c width="100%">..<
0060: 74 72 3e 3c 74 64 20 63 6f 6c 73 70 61 6e 3d 22 tr><td colspan="
0070: 32 22 3e 0d 0a 3c 74 61 62 6c 65 20 77 69 64 74 2">..<table widt
0080: 68 3d 22 31 30 30 25 22 20 62 67 63 6f 6c 6f 72 h="100%" bgcolor
0090: 3d 22 23 66 30 66 30 66 38 22 3e 0d 0a 3c 74 72 ="#f0f0f8">..<tr
00a0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 ><td align="cent
00b0: 65 72 22 3e 0d 0a 3c 68 31 3e 47 50 58 20 74 72 er">..<h1>GPX tr
00c0: 61 63 6b 73 3a 20 61 20 71 75 69 63 6b 20 69 6e acks: a quick in
00d0: 74 72 6f 3c 2f 68 31 3e 0d 0a 3c 2f 74 64 3e 3c tro</h1>..</td><
00e0: 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 74 /tr></table>..<t
00f0: 61 62 6c 65 20 77 69 64 74 68 3d 22 31 30 30 25 able width="100%
0100: 22 3e 3c 74 72 3e 0d 0a 3c 74 64 20 77 69 64 74 "><tr>..<td widt
0110: 68 3d 22 33 33 25 22 20 61 6c 69 67 6e 3d 22 6c h="33%" align="l
0120: 65 66 74 22 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 eft"></td>..<td
0130: 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 3c align="center"><
0140: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f a href="https://
0150: 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f www.gaia-gis.it/
0160: 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 fossil/libspatia
0170: 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 6d lite/wiki?name=m
0180: 69 73 63 2d 64 6f 63 73 22 3e 62 61 63 6b 20 74 isc-docs">back t
0190: 6f 20 69 6e 64 65 78 3c 2f 61 3e 3c 2f 74 64 3e o index</a></td>
01a0: 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33 25 ..<td width="33%
01b0: 22 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e " align="right">
01c0: 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 3c 2f 74 61 </td>..</tr></ta
01d0: 62 6c 65 3e 3c 62 72 3e 3c 74 61 62 6c 65 20 77 ble><br><table w
01e0: 69 64 74 68 3d 22 31 30 30 25 22 20 62 67 63 6f idth="100%" bgco
01f0: 6c 6f 72 3d 22 23 66 66 66 66 64 66 22 20 63 65 lor="#ffffdf" ce
0200: 6c 6c 73 70 61 63 69 6e 67 3d 22 34 22 20 63 65 llspacing="4" ce
0210: 6c 6c 70 61 64 64 69 6e 67 3d 22 38 22 3e 0d 0a llpadding="8">..
0220: 3c 74 72 3e 3c 74 64 3e 3c 62 3e 57 68 61 74 20 <tr><td><b>What
0230: 69 73 20 61 20 47 50 58 20 66 69 6c 65 20 3f 3c is a GPX file ?<
0240: 2f 62 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c /b></td></tr>..<
0250: 74 72 3e 3c 74 64 3e 3c 62 3e 47 50 58 3c 2f 62 tr><td><b>GPX</b
0260: 3e 20 73 74 61 6e 64 73 20 66 6f 72 20 3c 69 3e > stands for <i>
0270: 3c 62 3e 47 50 3c 2f 62 3e 53 20 45 3c 62 3e 78 <b>GP</b>S E<b>x
0280: 3c 2f 62 3e 63 68 61 6e 67 65 20 46 6f 72 6d 61 </b>change Forma
0290: 74 3c 2f 69 3e 3b 20 69 74 27 73 20 61 20 76 65 t</i>; it's a ve
02a0: 72 79 20 70 6f 70 75 6c 61 72 20 66 69 6c 65 20 ry popular file
02b0: 66 6f 72 6d 61 74 20 75 73 65 64 20 69 6e 20 6f format used in o
02c0: 72 64 65 72 20 74 6f 20 65 78 63 68 61 6e 67 65 rder to exchange
02d0: 20 47 50 53 20 64 61 74 61 20 61 63 72 6f 73 73 GPS data across
02e0: 20 64 69 66 66 65 72 65 6e 74 20 64 65 76 69 63 different devic
02f0: 65 73 2e 3c 62 72 3e 20 0d 0a 47 50 58 20 69 73 es.<br> ..GPX is
0300: 20 61 6e 20 6f 70 65 6e 20 66 6f 72 6d 61 74 20 an open format
0310: 61 6e 64 20 69 73 20 61 6c 6d 6f 73 74 20 75 6e and is almost un
0320: 69 76 65 72 73 61 6c 6c 79 20 73 75 70 70 6f 72 iversally suppor
0330: 74 65 64 3a 20 69 74 27 73 20 62 61 73 65 64 20 ted: it's based
0340: 6f 6e 20 61 20 66 6f 72 6d 61 6c 6c 79 20 64 65 on a formally de
0350: 66 69 6e 65 64 20 3c 61 20 68 72 65 66 3d 22 68 fined <a href="h
0360: 74 74 70 3a 2f 2f 77 77 77 2e 74 6f 70 6f 67 72 ttp://www.topogr
0370: 61 66 69 78 2e 63 6f 6d 2f 47 50 58 2f 31 2f 31 afix.com/GPX/1/1
0380: 2f 23 74 6f 70 22 3e 58 4d 4c 20 73 63 68 65 6d /#top">XML schem
0390: 61 3c 2f 61 3e 3c 62 72 3e 0d 0a 4d 61 6e 79 20 a</a><br>..Many
03a0: 72 65 61 6c 20 77 6f 72 64 20 69 6d 70 6c 65 6d real word implem
03b0: 65 6e 74 61 74 69 6f 6e 73 20 61 72 65 20 6f 6e entations are on
03c0: 6c 79 20 6c 6f 6f 73 65 6c 79 20 63 6f 6e 66 6f ly loosely confo
03d0: 72 6d 61 6e 74 20 74 6f 20 74 68 65 20 73 74 61 rmant to the sta
03e0: 6e 64 61 72 64 20 73 63 68 65 6d 61 20 61 6e 64 ndard schema and
03f0: 20 66 75 72 74 68 65 72 20 6e 6f 6e 2d 73 74 61 further non-sta
0400: 6e 64 61 72 64 20 74 61 67 73 20 68 61 76 65 20 ndard tags have
0410: 62 65 65 6e 20 69 6e 74 72 6f 64 75 63 65 64 20 been introduced
0420: 62 79 20 73 65 76 65 72 61 6c 20 76 65 6e 64 6f by several vendo
0430: 72 73 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 41 20 47 rs.<br><br>..A G
0440: 50 58 20 66 69 6c 65 20 69 73 20 65 78 70 65 63 PX file is expec
0450: 74 65 64 20 74 6f 20 69 6e 74 65 72 6e 61 6c 6c ted to internall
0460: 79 20 73 74 6f 72 65 20 61 74 20 6c 65 61 73 74 y store at least
0470: 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 6f 6c 6c one of the foll
0480: 6f 77 69 6e 67 20 63 6f 6e 74 65 6e 74 73 3a 0d owing contents:.
0490: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 54 72 .<ul>..<li><b>Tr
04a0: 61 63 6b 73 3c 2f 62 3e 3a 20 61 20 54 72 61 63 acks</b>: a Trac
04b0: 6b 20 69 73 20 61 6e 20 6f 72 64 65 72 65 64 20 k is an ordered
04c0: 6c 69 73 74 20 6f 66 20 70 6f 69 6e 74 73 20 64 list of points d
04d0: 65 73 63 72 69 62 69 6e 67 20 61 20 70 61 74 68 escribing a path
04e0: 2e 0d 0a 41 20 54 72 61 63 6b 20 6d 75 73 74 20 ...A Track must
04f0: 63 6f 6e 74 61 69 6e 20 61 74 20 6c 65 61 73 74 contain at least
0500: 20 6f 6e 65 20 54 72 61 63 6b 20 53 65 67 6d 65 one Track Segme
0510: 6e 74 20 68 6f 6c 64 69 6e 67 20 61 20 6c 69 73 nt holding a lis
0520: 74 20 6f 66 20 54 72 61 63 6b 20 50 6f 69 6e 74 t of Track Point
0530: 73 20 77 68 69 63 68 20 61 72 65 20 6c 6f 67 69 s which are logi
0540: 63 61 6c 6c 79 20 63 6f 6e 6e 65 63 74 65 64 20 cally connected
0550: 69 6e 20 6f 72 64 65 72 2e 3c 62 72 3e 0d 0a 41 in order.<br>..A
0560: 20 54 72 61 63 6b 20 63 61 6e 20 63 6f 6e 74 61 Track can conta
0570: 69 6e 69 6e 67 20 6d 6f 72 65 20 53 65 67 6d 65 ining more Segme
0580: 6e 74 73 2c 20 61 6e 64 20 6d 6f 72 65 20 54 72 nts, and more Tr
0590: 61 63 6b 73 20 63 61 6e 20 62 65 20 73 74 6f 72 acks can be stor
05a0: 65 64 20 69 6e 74 6f 20 74 68 65 20 73 61 6d 65 ed into the same
05b0: 20 47 50 58 20 66 69 6c 65 2e 3c 2f 6c 69 3e 0d GPX file.</li>.
05c0: 0a 3c 6c 69 3e 3c 62 3e 57 61 79 50 6f 69 6e 74 .<li><b>WayPoint
05d0: 73 3c 2f 62 3e 3c 2f 62 3e 3a 20 61 20 57 61 79 s</b></b>: a Way
05e0: 50 6f 69 6e 74 20 63 6f 6e 73 69 73 74 73 20 6f Point consists o
05f0: 66 20 74 68 65 20 57 47 53 20 38 34 20 28 47 50 f the WGS 84 (GP
0600: 53 29 20 63 6f 6f 72 64 69 6e 61 74 65 73 20 6f S) coordinates o
0610: 66 20 61 20 70 6f 69 6e 74 20 61 6e 64 20 70 6f f a point and po
0620: 73 73 69 62 6c 79 20 6f 74 68 65 72 20 64 65 73 ssibly other des
0630: 63 72 69 70 74 69 76 65 20 69 6e 66 6f 72 6d 61 criptive informa
0640: 74 69 6f 6e 2e 3c 62 72 3e 0d 0a 54 68 65 20 73 tion.<br>..The s
0650: 61 6d 65 20 47 50 58 20 66 69 6c 65 20 63 61 6e ame GPX file can
0660: 20 63 6f 6e 74 61 69 6e 20 61 20 63 6f 6c 6c 65 contain a colle
0670: 63 74 69 6f 6e 20 6f 66 20 6d 61 6e 79 20 57 61 ction of many Wa
0680: 79 50 6f 69 6e 74 73 20 77 69 74 68 20 6e 6f 20 yPoints with no
0690: 73 65 71 75 65 6e 74 69 61 6c 20 72 65 6c 61 74 sequential relat
06a0: 69 6f 6e 73 68 69 70 2e 3c 2f 6c 69 3e 0d 0a 3c ionship.</li>..<
06b0: 6c 69 3e 3c 62 3e 52 6f 75 74 65 73 3c 2f 62 3e li><b>Routes</b>
06c0: 3a 20 61 20 52 6f 75 74 65 20 69 73 20 61 6e 20 : a Route is an
06d0: 6f 72 64 65 72 65 64 20 6c 69 73 74 20 6f 66 20 ordered list of
06e0: 72 6f 75 74 65 70 6f 69 6e 74 28 77 61 79 70 6f routepoint(waypo
06f0: 69 6e 74 73 20 72 65 70 72 65 73 65 6e 74 69 6e ints representin
0700: 67 20 61 20 73 65 72 69 65 73 20 6f 66 20 73 69 g a series of si
0710: 67 6e 69 66 69 63 61 6e 74 20 74 75 72 6e 20 6f gnificant turn o
0720: 72 20 73 74 61 67 65 20 70 6f 69 6e 74 73 29 20 r stage points)
0730: 6c 65 61 64 69 6e 67 20 74 6f 20 61 20 64 65 73 leading to a des
0740: 74 69 6e 61 74 69 6f 6e 2e 3c 2f 6c 69 3e 0d 0a tination.</li>..
0750: 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 53 70 61 74 69 </ul><br>..Spati
0760: 61 4c 69 74 65 20 6f 6e 6c 79 20 73 75 70 70 6f aLite only suppo
0770: 72 74 73 20 3c 62 3e 47 50 58 20 54 72 61 63 6b rts <b>GPX Track
0780: 73 3c 2f 62 3e 20 61 6e 64 20 77 69 6c 6c 20 61 s</b> and will a
0790: 6c 77 61 79 73 20 73 69 6c 65 6e 74 6c 79 20 69 lways silently i
07a0: 67 6e 6f 72 65 20 61 6e 79 20 6f 74 68 65 72 20 gnore any other
07b0: 63 6f 6e 74 65 6e 74 2e 3c 62 72 3e 3c 62 72 3e content.<br><br>
07c0: 0d 0a 3c 68 33 3e 41 6e 61 74 6f 6d 79 20 6f 66 ..<h3>Anatomy of
07d0: 20 61 20 47 50 58 20 66 69 6c 65 20 63 6f 6e 74 a GPX file cont
07e0: 61 69 6e 69 6e 67 20 61 20 47 50 53 20 54 72 61 aining a GPS Tra
07f0: 63 6b 3c 2f 68 33 3e 0d 0a 49 66 20 79 6f 75 20 ck</h3>..If you
0800: 61 72 65 20 69 6e 74 65 72 65 73 74 65 64 20 69 are interested i
0810: 6e 74 6f 20 47 50 53 20 54 72 61 63 6b 73 20 79 nto GPS Tracks y
0820: 6f 75 27 6c 6c 20 76 65 72 79 20 70 72 6f 62 61 ou'll very proba
0830: 62 6c 79 20 68 61 76 65 20 6c 6f 74 73 20 6f 66 bly have lots of
0840: 20 47 50 58 20 66 69 6c 65 73 20 6f 66 20 79 6f GPX files of yo
0850: 75 72 20 6f 77 6e 20 74 68 61 74 20 79 6f 75 20 ur own that you
0860: 63 61 6e 20 75 73 65 20 61 73 20 74 65 73 74 20 can use as test
0870: 73 61 6d 70 6c 65 73 2e 3c 62 72 3e 0d 0a 54 68 samples.<br>..Th
0880: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 61 63 e following prac
0890: 74 69 63 61 6c 20 65 78 61 6d 70 6c 65 73 20 75 tical examples u
08a0: 73 65 20 74 68 69 73 20 3c 61 20 68 72 65 66 3d se this <a href=
08b0: 22 68 74 74 70 3a 2f 2f 77 77 77 2e 73 68 6d 75 "http://www.shmu
08c0: 6d 61 2e 72 75 2f 77 69 6b 69 2f 69 6d 61 67 65 ma.ru/wiki/image
08d0: 73 2f 35 2f 35 31 2f 47 70 78 2d 66 75 6c 6c 2d s/5/51/Gpx-full-
08e0: 73 61 6d 70 6c 65 2e 67 70 78 22 3e 47 50 58 20 sample.gpx">GPX
08f0: 73 61 6d 70 6c 65 3c 2f 61 3e 3c 62 72 3e 0d 0a sample</a><br>..
0900: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 3f 78 6d <verbatim>..<?xm
0910: 6c 20 76 65 72 73 69 6f 6e 3d 22 31 2e 30 22 3f l version="1.0"?
0920: 3e 0d 0a 3c 67 70 78 20 76 65 72 73 69 6f 6e 3d >..<gpx version=
0930: 22 31 2e 30 22 20 78 6d 6c 6e 73 3d 22 68 74 74 "1.0" xmlns="htt
0940: 70 3a 2f 2f 77 77 77 2e 74 6f 70 6f 67 72 61 66 p://www.topograf
0950: 69 78 2e 63 6f 6d 2f 47 50 58 2f 31 2f 30 22 3e ix.com/GPX/1/0">
0960: 0d 0a 20 20 3c 74 72 6b 3e 0d 0a 20 20 20 20 3c .. <trk>.. <
0970: 74 72 6b 73 65 67 3e 0d 0a 20 20 20 20 20 20 3c trkseg>.. <
0980: 74 72 6b 70 74 20 6c 61 74 3d 22 35 35 2e 37 35 trkpt lat="55.75
0990: 33 35 37 32 22 20 6c 6f 6e 3d 22 33 37 2e 38 30 3572" lon="37.80
09a0: 38 32 35 30 22 3e 0d 0a 20 20 20 20 20 20 20 20 8250">..
09b0: 3c 65 6c 65 3e 31 33 35 2e 30 30 3c 2f 65 6c 65 <ele>135.00</ele
09c0: 3e 0d 0a 20 20 20 20 20 20 20 20 3c 74 69 6d 65 >.. <time
09d0: 3e 32 30 30 39 2d 30 35 2d 31 39 54 30 34 3a 30 >2009-05-19T04:0
09e0: 30 3a 33 30 5a 3c 2f 74 69 6d 65 3e 0d 0a 20 20 0:30Z</time>..
09f0: 20 20 20 20 3c 2f 74 72 6b 70 74 3e 0d 0a 20 20 </trkpt>..
0a00: 20 20 20 20 3c 74 72 6b 70 74 20 6c 61 74 3d 22 <trkpt lat="
0a10: 35 35 2e 37 35 33 36 32 32 22 20 6c 6f 6e 3d 22 55.753622" lon="
0a20: 33 37 2e 38 30 38 32 35 35 22 3e 0d 0a 20 20 20 37.808255">..
0a30: 20 20 20 20 20 3c 65 6c 65 3e 31 33 35 2e 30 30 <ele>135.00
0a40: 3c 2f 65 6c 65 3e 0d 0a 20 20 20 20 20 20 20 20 </ele>..
0a50: 3c 74 69 6d 65 3e 32 30 30 39 2d 30 35 2d 31 39 <time>2009-05-19
0a60: 54 30 34 3a 30 30 3a 33 31 5a 3c 2f 74 69 6d 65 T04:00:31Z</time
0a70: 3e 0d 0a 20 20 20 20 20 20 3c 2f 74 72 6b 70 74 >.. </trkpt
0a80: 3e 0d 0a 20 20 20 20 20 20 3c 74 72 6b 70 74 20 >.. <trkpt
0a90: 6c 61 74 3d 22 35 35 2e 37 35 33 35 39 33 22 20 lat="55.753593"
0aa0: 6c 6f 6e 3d 22 33 37 2e 38 30 38 31 35 38 22 3e lon="37.808158">
0ab0: 0d 0a 20 20 20 20 20 20 20 20 3c 65 6c 65 3e 31 .. <ele>1
0ac0: 33 35 2e 30 30 3c 2f 65 6c 65 3e 0d 0a 20 20 20 35.00</ele>..
0ad0: 20 20 20 20 20 3c 74 69 6d 65 3e 32 30 30 39 2d <time>2009-
0ae0: 30 35 2d 31 39 54 30 34 3a 30 30 3a 33 32 5a 3c 05-19T04:00:32Z<
0af0: 2f 74 69 6d 65 3e 0d 0a 20 20 20 20 20 20 3c 2f /time>.. </
0b00: 74 72 6b 70 74 3e 0d 0a 2e 2e 2e 2e 0d 0a 20 20 trkpt>........
0b10: 20 20 20 20 3c 74 72 6b 70 74 20 6c 61 74 3d 22 <trkpt lat="
0b20: 35 35 2e 37 35 38 31 37 37 22 20 6c 6f 6e 3d 22 55.758177" lon="
0b30: 33 37 2e 36 37 37 38 30 32 22 3e 0d 0a 20 20 20 37.677802">..
0b40: 20 20 20 20 20 3c 65 6c 65 3e 31 35 32 2e 30 30 <ele>152.00
0b50: 3c 2f 65 6c 65 3e 0d 0a 20 20 20 20 20 20 20 20 </ele>..
0b60: 3c 74 69 6d 65 3e 32 30 30 39 2d 30 35 2d 31 39 <time>2009-05-19
0b70: 54 30 34 3a 34 36 3a 32 37 5a 3c 2f 74 69 6d 65 T04:46:27Z</time
0b80: 3e 0d 0a 20 20 20 20 20 20 3c 2f 74 72 6b 70 74 >.. </trkpt
0b90: 3e 0d 0a 20 20 20 20 3c 2f 74 72 6b 73 65 67 3e >.. </trkseg>
0ba0: 0d 0a 20 20 3c 2f 74 72 6b 3e 0d 0a 3c 2f 67 70 .. </trk>..</gp
0bb0: 78 3e 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d x>..</verbatim>.
0bc0: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 77 .<ul>..<li>the w
0bd0: 68 6f 6c 65 20 47 50 58 20 66 69 6c 65 20 69 73 hole GPX file is
0be0: 20 65 6e 63 6c 6f 73 65 64 20 77 69 74 68 69 6e enclosed within
0bf0: 20 3c 62 3e 26 6c 74 3b 67 70 78 26 67 74 3b 3c <b><gpx><
0c00: 2f 62 3e 20 61 6e 64 20 3c 62 3e 26 6c 74 3b 2f /b> and <b></
0c10: 67 70 78 26 67 74 3b 3c 2f 62 3e 20 74 61 67 73 gpx></b> tags
0c20: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 65 61 63 68 .</li>..<li>each
0c30: 20 54 72 61 63 6b 20 69 73 20 64 65 6c 69 6d 69 Track is delimi
0c40: 74 65 64 20 62 79 20 61 20 6d 61 74 63 68 69 6e ted by a matchin
0c50: 67 20 70 61 69 72 20 6f 66 20 3c 62 3e 26 6c 74 g pair of <b><
0c60: 3b 74 72 6b 26 67 74 3b 3c 2f 62 3e 20 61 6e 64 ;trk></b> and
0c70: 20 3c 62 3e 26 6c 74 3b 2f 74 72 6b 26 67 74 3b <b></trk>
0c80: 3c 2f 62 3e 20 74 61 67 73 2e 3c 2f 6c 69 3e 0d </b> tags.</li>.
0c90: 0a 3c 6c 69 3e 65 61 63 68 20 54 72 61 63 6b 20 .<li>each Track
0ca0: 53 65 67 6d 65 6e 74 20 69 73 20 64 65 6c 69 6d Segment is delim
0cb0: 69 74 65 64 20 62 79 20 61 20 6d 61 74 63 68 69 ited by a matchi
0cc0: 6e 67 20 70 61 69 72 20 6f 66 20 3c 62 3e 26 6c ng pair of <b>&l
0cd0: 74 3b 74 72 6b 73 65 67 26 67 74 3b 3c 2f 62 3e t;trkseg></b>
0ce0: 20 61 6e 64 20 3c 62 3e 26 6c 74 3b 2f 74 72 6b and <b></trk
0cf0: 73 65 67 26 67 74 3b 3c 2f 62 3e 20 74 61 67 73 seg></b> tags
0d00: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 65 61 63 68 .</li>..<li>each
0d10: 20 54 72 61 63 6b 20 50 6f 69 6e 74 20 69 73 20 Track Point is
0d20: 65 6e 63 6c 6f 73 65 64 20 77 69 74 68 69 6e 20 enclosed within
0d30: 3c 62 3e 26 6c 74 3b 74 72 6b 70 74 26 67 74 3b <b><trkpt>
0d40: 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 26 6c 74 3b </b> and <b><
0d50: 2f 74 72 6b 70 74 26 67 74 3b 3c 2f 62 3e 20 74 /trkpt></b> t
0d60: 61 67 73 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e ags...<ul>..<li>
0d70: 74 68 65 20 3c 62 3e 6c 61 74 3c 2f 62 3e 20 61 the <b>lat</b> a
0d80: 6e 64 20 3c 62 3e 6c 6f 6e 3c 2f 62 3e 20 6d 61 nd <b>lon</b> ma
0d90: 6e 64 61 74 6f 72 79 20 61 74 74 72 69 62 75 74 ndatory attribut
0da0: 65 73 20 61 72 65 20 69 6e 74 65 6e 64 65 64 20 es are intended
0db0: 74 6f 20 64 65 63 6c 61 72 65 20 74 68 65 20 57 to declare the W
0dc0: 47 53 20 38 34 20 3c 62 3e 3c 69 3e 6c 61 74 69 GS 84 <b><i>lati
0dd0: 74 75 64 65 3c 2f 69 3e 3c 2f 62 3e 20 61 6e 64 tude</i></b> and
0de0: 20 3c 62 3e 3c 69 3e 6c 6f 6e 67 69 74 75 64 65 <b><i>longitude
0df0: 3c 2f 69 3e 3c 2f 62 3e 20 6f 66 20 74 68 65 20 </i></b> of the
0e00: 70 6f 69 6e 74 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 point.</li>..<li
0e10: 3e 74 68 65 20 3c 62 3e 3c 69 3e 65 6c 65 76 61 >the <b><i>eleva
0e20: 74 69 6f 6e 3c 2f 69 3e 3c 2f 62 3e 20 6f 66 20 tion</i></b> of
0e30: 74 68 65 20 70 6f 69 6e 74 20 28 6d 65 61 73 75 the point (measu
0e40: 72 65 64 20 69 6e 20 6d 65 74 65 72 73 29 20 63 red in meters) c
0e50: 61 6e 20 62 65 20 6f 70 74 69 6f 6e 61 6c 6c 79 an be optionally
0e60: 20 64 65 63 6c 61 72 65 64 20 77 69 74 68 69 6e declared within
0e70: 20 61 20 70 61 69 72 20 6f 66 20 3c 62 3e 26 6c a pair of <b>&l
0e80: 74 3b 65 6c 65 26 67 74 3b 3c 2f 62 3e 20 61 6e t;ele></b> an
0e90: 64 20 3c 62 3e 26 6c 74 3b 2f 65 6c 65 26 67 74 d <b></ele>
0ea0: 3b 3c 2f 62 3e 20 74 61 67 73 2e 3c 2f 6c 69 3e ;</b> tags.</li>
0eb0: 0d 0a 3c 6c 69 3e 74 68 65 20 3c 62 3e 3c 69 3e ..<li>the <b><i>
0ec0: 64 61 74 65 20 61 6e 64 20 74 69 6d 65 3c 2f 69 date and time</i
0ed0: 3e 3c 2f 62 3e 20 6f 66 20 74 68 65 20 63 6f 72 ></b> of the cor
0ee0: 72 65 73 70 6f 6e 64 69 6e 67 20 47 50 53 20 6d responding GPS m
0ef0: 65 61 73 75 72 65 20 63 61 6e 20 62 65 20 6f 70 easure can be op
0f00: 74 69 6f 6e 61 6c 6c 79 20 64 65 63 6c 61 72 65 tionally declare
0f10: 64 20 77 69 74 68 69 6e 20 61 20 70 61 69 72 20 d within a pair
0f20: 6f 66 20 3c 62 3e 26 6c 74 3b 74 69 6d 65 26 67 of <b><time&g
0f30: 74 3b 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 26 6c t;</b> and <b>&l
0f40: 74 3b 2f 74 69 6d 65 26 67 74 3b 3c 2f 62 3e 20 t;/time></b>
0f50: 74 61 67 73 2e 3c 62 72 3e 0d 0a 44 61 74 65 73 tags.<br>..Dates
0f60: 20 61 6e 64 20 74 69 6d 65 73 20 61 72 65 20 6e and times are n
0f70: 6f 74 20 6c 6f 63 61 6c 20 74 69 6d 65 2c 20 62 ot local time, b
0f80: 75 74 20 69 6e 73 74 65 61 64 20 61 72 65 20 3c ut instead are <
0f90: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f a href="https://
0fa0: 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72 67 en.wikipedia.org
0fb0: 2f 77 69 6b 69 2f 43 6f 6f 72 64 69 6e 61 74 65 /wiki/Coordinate
0fc0: 64 5f 55 6e 69 76 65 72 73 61 6c 5f 54 69 6d 65 d_Universal_Time
0fd0: 22 3e 43 6f 6f 72 64 69 6e 61 74 65 64 20 55 6e ">Coordinated Un
0fe0: 69 76 65 72 73 61 6c 20 54 69 6d 65 3c 2f 61 3e iversal Time</a>
0ff0: 20 28 3c 62 3e 55 54 43 3c 2f 62 3e 29 20 75 73 (<b>UTC</b>) us
1000: 69 6e 67 20 3c 61 20 68 72 65 66 3d 22 68 74 74 ing <a href="htt
1010: 70 73 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 64 69 ps://en.wikipedi
1020: 61 2e 6f 72 67 2f 77 69 6b 69 2f 49 53 4f 5f 38 a.org/wiki/ISO_8
1030: 36 30 31 22 3e 49 53 4f 20 38 36 30 31 3c 2f 61 601">ISO 8601</a
1040: 3e 20 66 6f 72 6d 61 74 2e 3c 2f 6c 69 3e 0d 0a > format.</li>..
1050: 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c </ul></li>..</ul
1060: 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c >..</td></tr>..<
1070: 2f 74 61 62 6c 65 3e 3c 62 72 3e 0d 0a 3c 68 72 /table><br>..<hr
1080: 3e 3c 62 72 3e 0d 0a 3c 68 32 3e 49 6d 70 6f 72 ><br>..<h2>Impor
1090: 74 69 6e 67 20 47 50 58 20 74 72 61 63 6b 73 20 ting GPX tracks
10a0: 69 6e 74 6f 20 61 20 53 70 61 74 69 61 4c 69 74 into a SpatiaLit
10b0: 65 20 47 65 6f 54 61 62 6c 65 3c 2f 68 32 3e 0d e GeoTable</h2>.
10c0: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 43 52 45 .<verbatim>..CRE
10d0: 41 54 45 20 54 41 42 4c 45 20 72 61 77 5f 67 70 ATE TABLE raw_gp
10e0: 78 20 28 0d 0a 20 20 20 20 69 64 5f 67 70 78 20 x (.. id_gpx
10f0: 49 4e 54 45 47 45 52 20 50 52 49 4d 41 52 59 20 INTEGER PRIMARY
1100: 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e KEY AUTOINCREMEN
1110: 54 2c 0d 0a 20 20 20 20 67 70 78 20 42 4c 4f 42 T,.. gpx BLOB
1120: 20 4e 4f 54 20 20 4e 55 4c 4c 29 3b 0d 0a 0d 0a NOT NULL);....
1130: 49 4e 53 45 52 54 20 49 4e 54 4f 20 72 61 77 5f INSERT INTO raw_
1140: 67 70 78 20 56 41 4c 55 45 53 20 28 4e 55 4c 4c gpx VALUES (NULL
1150: 2c 20 58 42 5f 43 72 65 61 74 65 28 58 42 5f 4c , XB_Create(XB_L
1160: 6f 61 64 58 4d 4c 28 27 47 70 78 2d 66 75 6c 6c oadXML('Gpx-full
1170: 2d 73 61 6d 70 6c 65 2e 67 70 78 27 29 29 29 3b -sample.gpx')));
1180: 0d 0a 0d 0a 53 45 4c 45 43 54 20 69 64 5f 67 70 ....SELECT id_gp
1190: 78 2c 20 58 42 5f 49 73 47 50 58 28 67 70 78 29 x, XB_IsGPX(gpx)
11a0: 20 0d 0a 46 52 4f 4d 20 72 61 77 5f 67 70 78 3b ..FROM raw_gpx;
11b0: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ..--------------
11c0: 2d 2d 2d 2d 2d 0d 0a 31 0d 0a 3c 2f 76 65 72 62 -----..1..</verb
11d0: 61 74 69 6d 3e 0d 0a 47 50 58 20 66 69 6c 65 73 atim>..GPX files
11e0: 20 62 61 73 69 63 61 6c 6c 79 20 61 72 65 20 58 basically are X
11f0: 4d 4c 20 66 69 6c 65 73 2c 20 73 6f 20 79 6f 75 ML files, so you
1200: 20 6a 75 73 74 20 68 61 76 65 20 74 6f 20 75 73 just have to us
1210: 65 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 53 e the standard S
1220: 51 4c 20 66 75 6e 63 74 69 6f 6e 73 20 73 75 70 QL functions sup
1230: 70 6f 72 74 69 6e 67 20 67 65 6e 65 72 69 63 20 porting generic
1240: 58 4d 4c 2e 3c 62 72 3e 0d 0a 3c 62 3e 58 42 5f XML.<br>..<b>XB_
1250: 49 73 47 50 58 28 29 3c 2f 62 3e 20 69 73 20 61 IsGPX()</b> is a
1260: 20 6e 65 77 20 53 51 4c 20 66 75 6e 63 74 69 6f new SQL functio
1270: 6e 20 69 6e 74 72 6f 64 75 63 65 64 20 62 79 20 n introduced by
1280: 53 70 61 74 69 61 4c 69 74 65 20 3c 62 3e 34 2e SpatiaLite <b>4.
1290: 34 2e 30 3c 2f 62 3e 3b 20 69 74 20 77 69 6c 6c 4.0</b>; it will
12a0: 20 74 65 73 74 20 74 68 65 20 61 63 74 75 61 6c test the actual
12b0: 20 58 4d 4c 20 70 61 79 6c 6f 61 64 20 61 6e 64 XML payload and
12c0: 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 3c 62 3e will return <b>
12d0: 31 3c 2f 62 3e 20 69 66 20 69 74 20 72 65 61 6c 1</b> if it real
12e0: 6c 79 20 69 73 20 6f 66 20 74 68 65 20 47 50 58 ly is of the GPX
12f0: 20 74 79 70 65 2c 20 3c 62 3e 30 3c 2f 62 3e 20 type, <b>0</b>
1300: 69 66 20 6e 6f 74 2c 20 61 6e 64 20 3c 62 3e 2d if not, and <b>-
1310: 31 3c 2f 62 3e 20 77 68 65 6e 20 74 68 65 20 70 1</b> when the p
1320: 61 73 73 65 64 20 61 72 67 75 6d 65 6e 74 20 69 assed argument i
1330: 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 20 58 4d s not a valid XM
1340: 4c 20 64 6f 63 75 6d 65 6e 74 2e 3c 62 72 3e 0d L document.<br>.
1350: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 43 52 45 .<verbatim>..CRE
1360: 41 54 45 20 54 41 42 4c 45 20 67 70 78 5f 74 72 ATE TABLE gpx_tr
1370: 61 63 6b 73 20 28 0d 0a 20 20 20 20 69 64 5f 74 acks (.. id_t
1380: 72 6b 20 49 4e 54 45 47 45 52 20 50 52 49 4d 41 rk INTEGER PRIMA
1390: 52 59 20 4b 45 59 20 41 55 54 4f 49 4e 43 52 45 RY KEY AUTOINCRE
13a0: 4d 45 4e 54 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 MENT);....SELECT
13b0: 20 41 64 64 47 65 6f 6d 65 74 72 79 43 6f 6c 75 AddGeometryColu
13c0: 6d 6e 28 27 67 70 78 5f 74 72 61 63 6b 73 27 2c mn('gpx_tracks',
13d0: 20 27 67 65 6f 6d 27 2c 20 34 33 32 36 2c 20 27 'geom', 4326, '
13e0: 4d 55 4c 54 49 4c 49 4e 45 53 54 52 49 4e 47 27 MULTILINESTRING'
13f0: 2c 20 27 58 59 5a 4d 27 29 3b 0d 0a 2d 2d 2d 2d , 'XYZM');..----
1400: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a ---------..1....
1410: 49 4e 53 45 52 54 20 49 4e 54 4f 20 67 70 78 5f INSERT INTO gpx_
1420: 74 72 61 63 6b 73 20 0d 0a 53 45 4c 45 43 54 20 tracks ..SELECT
1430: 4e 55 4c 4c 2c 20 58 42 5f 4d 4c 69 6e 65 46 72 NULL, XB_MLineFr
1440: 6f 6d 47 50 58 28 67 70 78 29 0d 0a 46 52 4f 4d omGPX(gpx)..FROM
1450: 20 72 61 77 5f 67 70 78 3b 0d 0a 3c 2f 76 65 72 raw_gpx;..</ver
1460: 62 61 74 69 6d 3e 0d 0a 4e 6f 77 20 77 65 27 6c batim>..Now we'l
1470: 6c 20 63 72 65 61 74 65 20 61 6e 6f 74 68 65 72 l create another
1480: 20 74 61 62 6c 65 20 69 6e 63 6c 75 64 69 6e 67 table including
1490: 20 61 20 47 65 6f 6d 65 74 72 79 20 63 6f 6c 75 a Geometry colu
14a0: 6d 6e 20 64 65 63 6c 61 72 65 64 20 6f 66 20 74 mn declared of t
14b0: 68 65 20 3c 62 3e 4d 55 4c 54 49 4c 49 4e 45 53 he <b>MULTILINES
14c0: 54 52 49 4e 47 3c 2f 62 3e 20 74 79 70 65 20 61 TRING</b> type a
14d0: 6e 64 20 68 61 76 69 6e 67 20 3c 62 3e 58 59 5a nd having <b>XYZ
14e0: 4d 3c 2f 62 3e 20 64 69 6d 65 6e 73 69 6f 6e 73 M</b> dimensions
14f0: 2e 20 54 68 65 20 53 52 49 44 20 66 6f 72 20 74 . The SRID for t
1500: 68 69 73 20 47 65 6f 6d 65 74 72 79 20 6d 75 73 his Geometry mus
1510: 74 20 62 65 20 3c 62 3e 34 33 32 36 3c 2f 62 3e t be <b>4326</b>
1520: 20 61 6b 61 20 3c 62 3e 57 47 53 20 38 34 3c 2f aka <b>WGS 84</
1530: 62 3e 2c 20 74 68 65 20 6f 6e 65 20 61 6c 77 61 b>, the one alwa
1540: 79 73 20 61 64 6f 70 74 65 64 20 62 79 20 47 50 ys adopted by GP
1550: 53 20 64 61 74 61 2e 3c 62 72 3e 3c 62 72 3e 0d S data.<br><br>.
1560: 0a 57 65 20 63 61 6e 20 66 69 6e 61 6c 6c 79 20 .We can finally
1570: 69 6e 76 6f 6b 65 20 74 68 65 20 6e 65 77 20 3c invoke the new <
1580: 62 3e 58 42 5f 4d 4c 69 6e 65 46 72 6f 6d 47 50 b>XB_MLineFromGP
1590: 58 28 29 3c 2f 62 3e 20 53 51 4c 20 66 75 6e 63 X()</b> SQL func
15a0: 74 69 6f 6e 20 69 6e 20 6f 72 64 65 72 20 74 6f tion in order to
15b0: 20 70 61 72 73 65 20 74 68 65 20 47 50 58 20 70 parse the GPX p
15c0: 61 79 6c 6f 61 64 20 70 6f 73 73 69 62 6c 79 20 ayload possibly
15d0: 62 75 69 6c 64 69 6e 67 20 61 20 4d 75 6c 74 69 building a Multi
15e0: 4c 69 6e 65 73 74 72 69 6e 67 20 63 6f 72 72 65 Linestring corre
15f0: 73 70 6f 6e 64 69 6e 67 20 74 6f 20 61 6c 6c 20 sponding to all
1600: 20 54 72 61 6b 73 53 65 67 6d 65 6e 74 73 20 64 TraksSegments d
1610: 65 66 69 6e 65 64 20 62 79 20 74 68 65 20 47 50 efined by the GP
1620: 58 2e 3c 62 72 3e 0d 0a 50 6c 65 61 73 65 20 6e X.<br>..Please n
1630: 6f 74 65 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e ote:..<ul>..<li>
1640: 58 42 5f 4d 4c 69 6e 65 46 72 6f 6d 47 50 58 28 XB_MLineFromGPX(
1650: 29 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 3c 62 ) will return <b
1660: 3e 4e 55 4c 4c 3c 2f 62 3e 20 65 69 74 68 65 72 >NULL</b> either
1670: 20 69 66 20 74 68 65 20 70 61 73 73 65 64 20 61 if the passed a
1680: 72 67 75 6d 65 6e 74 20 69 73 20 6e 6f 74 20 61 rgument is not a
1690: 20 76 61 6c 69 64 20 42 4c 4f 42 2c 20 6f 72 20 valid BLOB, or
16a0: 69 66 20 69 74 27 73 20 61 20 76 61 6c 69 64 20 if it's a valid
16b0: 42 4c 4f 42 20 62 75 74 20 6e 6f 74 20 6f 66 20 BLOB but not of
16c0: 74 68 65 20 47 50 58 20 74 79 70 65 2e 3c 2f 6c the GPX type.</l
16d0: 69 3e 0d 0a 3c 6c 69 3e 61 6e 79 77 61 79 20 58 i>..<li>anyway X
16e0: 42 5f 4d 4c 69 6e 65 46 72 6f 6d 47 50 58 28 29 B_MLineFromGPX()
16f0: 20 63 6f 75 6c 64 20 65 76 65 6e 74 75 61 6c 6c could eventuall
1700: 79 20 72 65 74 75 72 6e 20 61 20 3c 62 3e 4e 55 y return a <b>NU
1710: 4c 4c 3c 2f 62 3e 20 76 61 6c 75 65 20 65 76 65 LL</b> value eve
1720: 6e 20 77 68 69 6c 65 20 70 61 72 73 69 6e 67 20 n while parsing
1730: 61 20 76 61 6c 69 64 20 47 50 58 20 70 61 79 6c a valid GPX payl
1740: 6f 61 64 2c 20 69 66 20 69 74 20 64 6f 65 73 20 oad, if it does
1750: 6e 6f 74 20 63 6f 6e 74 61 69 6e 73 20 61 6e 79 not contains any
1760: 20 54 72 61 6b 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 Trak.</li>..<li
1770: 3e 69 6e 20 63 61 73 65 20 6f 66 20 73 75 63 63 >in case of succ
1780: 65 73 73 20 74 68 65 20 72 65 74 75 72 6e 65 64 ess the returned
1790: 20 47 65 6f 6d 65 74 72 79 20 77 69 6c 6c 20 61 Geometry will a
17a0: 6c 77 61 79 73 20 62 65 20 61 20 4d 75 6c 74 69 lways be a Multi
17b0: 4c 69 6e 65 73 74 72 69 6e 67 2c 20 61 6e 64 20 Linestring, and
17c0: 61 20 64 69 73 74 69 6e 63 74 20 4c 69 6e 65 73 a distinct Lines
17d0: 74 72 69 6e 67 20 77 69 6c 6c 20 62 65 20 63 72 tring will be cr
17e0: 65 61 74 65 64 20 66 6f 72 20 65 76 65 72 79 20 eated for every
17f0: 3c 62 3e 54 72 61 63 6b 20 53 65 67 6d 65 6e 74 <b>Track Segment
1800: 3c 2f 62 3e 20 66 6f 75 6e 64 20 77 69 74 68 69 </b> found withi
1810: 6e 20 74 68 65 20 47 50 58 2e 3c 62 72 3e 0d 0a n the GPX.<br>..
1820: 45 61 63 68 20 3c 62 3e 54 72 61 6b 50 6f 69 6e Each <b>TrakPoin
1830: 74 3c 2f 62 3e 20 77 69 6c 6c 20 63 6f 72 72 65 t</b> will corre
1840: 73 70 6f 6e 64 20 74 6f 20 61 20 56 65 72 74 65 spond to a Verte
1850: 78 20 6f 66 20 74 68 65 20 63 6f 72 72 65 73 70 x of the corresp
1860: 6f 6e 64 69 6e 67 20 4c 69 6e 65 73 74 72 69 6e onding Linestrin
1870: 67 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 g..<ul>..<li>the
1880: 20 3c 62 3e 58 3c 2f 62 3e 20 61 6e 64 20 3c 62 <b>X</b> and <b
1890: 3e 59 3c 2f 62 3e 20 63 6f 6f 72 64 69 6e 61 74 >Y</b> coordinat
18a0: 65 73 20 6f 66 20 74 68 65 20 56 65 72 74 65 78 es of the Vertex
18b0: 20 77 69 6c 6c 20 62 65 20 73 65 74 20 61 63 63 will be set acc
18c0: 6f 72 64 69 6e 67 6c 79 20 74 6f 20 74 68 65 20 ordingly to the
18d0: 64 65 63 6c 61 72 65 64 20 3c 62 3e 3c 69 3e 6c declared <b><i>l
18e0: 6f 6e 3c 2f 69 3e 3c 2f 62 3e 20 61 6e 64 20 3c on</i></b> and <
18f0: 62 3e 3c 69 3e 6c 61 74 3c 2f 69 3e 3c 2f 62 3e b><i>lat</i></b>
1900: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 61 .</li>..<li>if a
1910: 6e 20 3c 62 3e 65 6c 65 3c 2f 62 3e 20 74 61 67 n <b>ele</b> tag
1920: 20 77 61 73 20 64 65 63 6c 61 72 65 64 20 74 68 was declared th
1930: 65 20 3c 62 3e 5a 3c 2f 62 3e 20 63 6f 6f 72 64 e <b>Z</b> coord
1940: 69 6e 61 74 65 20 77 69 6c 6c 20 62 65 20 73 65 inate will be se
1950: 74 20 74 6f 20 63 6f 72 72 65 73 70 6f 6e 64 69 t to correspondi
1960: 6e 67 20 76 61 6c 75 65 2e 3c 62 72 3e 0d 0a 4f ng value.<br>..O
1970: 74 68 65 72 77 69 73 65 20 74 68 65 20 3c 62 3e therwise the <b>
1980: 5a 3c 2f 62 3e 20 63 6f 6f 72 64 69 6e 61 74 65 Z</b> coordinate
1990: 20 77 69 6c 6c 20 62 65 20 73 65 74 20 74 6f 20 will be set to
19a0: 3c 62 3e 30 2e 30 3c 2f 62 3e 20 28 64 65 66 61 <b>0.0</b> (defa
19b0: 75 6c 74 20 76 61 6c 75 65 29 2e 3c 2f 6c 69 3e ult value).</li>
19c0: 0d 0a 3c 6c 69 3e 69 66 20 61 20 3c 62 3e 74 69 ..<li>if a <b>ti
19d0: 6d 65 3c 2f 62 3e 20 74 61 67 20 77 61 73 20 64 me</b> tag was d
19e0: 65 63 6c 61 72 65 64 2c 20 74 68 65 20 49 53 4f eclared, the ISO
19f0: 20 38 36 30 31 20 74 69 6d 65 73 74 61 6d 70 20 8601 timestamp
1a00: 77 69 6c 6c 20 62 65 20 74 72 61 6e 73 66 6f 72 will be transfor
1a10: 6d 65 64 20 69 6e 74 6f 20 61 20 3c 61 20 68 72 med into a <a hr
1a20: 65 66 3d 22 68 74 74 70 73 3a 2f 2f 65 6e 2e 77 ef="https://en.w
1a30: 69 6b 69 70 65 64 69 61 2e 6f 72 67 2f 77 69 6b ikipedia.org/wik
1a40: 69 2f 4a 75 6c 69 61 6e 5f 64 61 79 22 3e 6a 75 i/Julian_day">ju
1a50: 6c 69 61 6e 20 64 61 79 20 6e 75 6d 62 65 72 3c lian day number<
1a60: 2f 61 3e 2c 20 61 6e 64 20 74 68 65 20 3c 62 3e /a>, and the <b>
1a70: 4d 3c 2f 62 3e 20 63 6f 6f 72 64 69 6e 61 74 65 M</b> coordinate
1a80: 20 77 69 6c 6c 20 62 65 20 73 65 74 20 74 6f 20 will be set to
1a90: 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e the correspondin
1aa0: 67 20 76 61 6c 75 65 2e 3c 62 72 3e 0d 0a 4f 74 g value.<br>..Ot
1ab0: 68 65 72 77 69 73 65 20 74 68 65 20 3c 62 3e 4d herwise the <b>M
1ac0: 3c 2f 62 3e 20 63 6f 6f 72 64 69 6e 61 74 65 20 </b> coordinate
1ad0: 77 69 6c 6c 20 62 65 20 73 65 74 20 74 6f 20 3c will be set to <
1ae0: 62 3e 31 37 32 31 30 35 39 2e 35 3c 2f 62 3e 2c b>1721059.5</b>,
1af0: 20 74 68 69 73 20 63 6f 72 72 65 73 70 6f 6e 64 this correspond
1b00: 69 6e 67 20 74 6f 20 3c 62 3e 30 30 30 30 2d 30 ing to <b>0000-0
1b10: 31 2d 30 31 54 30 30 3a 30 30 3a 30 30 5a 3c 2f 1-01T00:00:00Z</
1b20: 62 3e 20 28 64 65 66 61 75 6c 74 20 76 61 6c 75 b> (default valu
1b30: 65 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d e).</li>..</ul>.
1b40: 0a 3c 2f 6c 69 3e 20 0d 0a 3c 2f 75 6c 3e 3c 62 .</li> ..</ul><b
1b50: 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 32 3e 43 68 r>..<hr>..<h2>Ch
1b60: 65 63 6b 69 6e 67 20 74 68 65 20 69 6d 70 6f 72 ecking the impor
1b70: 74 65 64 20 54 72 61 63 6b 50 6f 69 6e 74 73 3c ted TrackPoints<
1b80: 2f 68 32 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e /h2>..<verbatim>
1b90: 0d 0a 53 45 4c 45 43 54 20 27 50 6f 69 6e 74 20 ..SELECT 'Point
1ba0: 23 31 27 20 41 53 20 70 6f 69 6e 74 2c 20 53 54 #1' AS point, ST
1bb0: 5f 58 28 61 2e 70 74 29 20 41 53 20 6c 6f 6e 2c _X(a.pt) AS lon,
1bc0: 20 53 54 5f 59 28 61 2e 70 74 29 20 41 53 20 6c ST_Y(a.pt) AS l
1bd0: 61 74 2c 20 53 54 5f 5a 28 61 2e 70 74 29 20 41 at, ST_Z(a.pt) A
1be0: 53 20 65 6c 65 2c 20 44 61 74 65 54 69 6d 65 28 S ele, DateTime(
1bf0: 53 54 5f 4d 28 61 2e 70 74 29 29 20 41 53 20 74 ST_M(a.pt)) AS t
1c00: 69 6d 65 0d 0a 46 52 4f 4d 20 28 53 45 4c 45 43 ime..FROM (SELEC
1c10: 54 20 53 54 5f 53 74 61 72 74 50 6f 69 6e 74 28 T ST_StartPoint(
1c20: 67 65 6f 6d 29 20 41 53 20 70 74 20 46 52 4f 4d geom) AS pt FROM
1c30: 20 67 70 78 5f 74 72 61 63 6b 73 29 20 41 53 20 gpx_tracks) AS
1c40: 61 0d 0a 55 4e 49 4f 4e 0d 0a 53 45 4c 45 43 54 a..UNION..SELECT
1c50: 20 27 50 6f 69 6e 74 20 23 32 27 20 41 53 20 70 'Point #2' AS p
1c60: 6f 69 6e 74 2c 20 53 54 5f 58 28 61 2e 70 74 29 oint, ST_X(a.pt)
1c70: 20 41 53 20 6c 6f 6e 2c 20 53 54 5f 59 28 61 2e AS lon, ST_Y(a.
1c80: 70 74 29 20 41 53 20 6c 61 74 2c 20 53 54 5f 5a pt) AS lat, ST_Z
1c90: 28 61 2e 70 74 29 20 41 53 20 65 6c 65 2c 20 44 (a.pt) AS ele, D
1ca0: 61 74 65 54 69 6d 65 28 53 54 5f 4d 28 61 2e 70 ateTime(ST_M(a.p
1cb0: 74 29 29 20 41 53 20 74 69 6d 65 0d 0a 46 52 4f t)) AS time..FRO
1cc0: 4d 20 28 53 45 4c 45 43 54 20 53 54 5f 50 6f 69 M (SELECT ST_Poi
1cd0: 6e 74 4e 28 67 65 6f 6d 2c 20 32 29 20 41 53 20 ntN(geom, 2) AS
1ce0: 70 74 20 46 52 4f 4d 20 67 70 78 5f 74 72 61 63 pt FROM gpx_trac
1cf0: 6b 73 29 20 41 53 20 61 0d 0a 55 4e 49 4f 4e 0d ks) AS a..UNION.
1d00: 0a 53 45 4c 45 43 54 20 27 50 6f 69 6e 74 20 23 .SELECT 'Point #
1d10: 33 27 20 41 53 20 70 6f 69 6e 74 2c 20 53 54 5f 3' AS point, ST_
1d20: 58 28 61 2e 70 74 29 20 41 53 20 6c 6f 6e 2c 20 X(a.pt) AS lon,
1d30: 53 54 5f 59 28 61 2e 70 74 29 20 41 53 20 6c 61 ST_Y(a.pt) AS la
1d40: 74 2c 20 53 54 5f 5a 28 61 2e 70 74 29 20 41 53 t, ST_Z(a.pt) AS
1d50: 20 65 6c 65 2c 20 44 61 74 65 54 69 6d 65 28 53 ele, DateTime(S
1d60: 54 5f 4d 28 61 2e 70 74 29 29 20 41 53 20 74 69 T_M(a.pt)) AS ti
1d70: 6d 65 0d 0a 46 52 4f 4d 20 28 53 45 4c 45 43 54 me..FROM (SELECT
1d80: 20 53 54 5f 50 6f 69 6e 74 4e 28 67 65 6f 6d 2c ST_PointN(geom,
1d90: 20 33 29 20 41 53 20 70 74 20 46 52 4f 4d 20 67 3) AS pt FROM g
1da0: 70 78 5f 74 72 61 63 6b 73 29 20 41 53 20 61 0d px_tracks) AS a.
1db0: 0a 55 4e 49 4f 4e 0d 0a 53 45 4c 45 43 54 20 27 .UNION..SELECT '
1dc0: 50 6f 69 6e 74 20 23 4e 27 20 41 53 20 70 6f 69 Point #N' AS poi
1dd0: 6e 74 2c 20 53 54 5f 58 28 61 2e 70 74 29 20 41 nt, ST_X(a.pt) A
1de0: 53 20 6c 6f 6e 2c 20 53 54 5f 59 28 61 2e 70 74 S lon, ST_Y(a.pt
1df0: 29 20 41 53 20 6c 61 74 2c 20 53 54 5f 5a 28 61 ) AS lat, ST_Z(a
1e00: 2e 70 74 29 20 41 53 20 65 6c 65 2c 20 44 61 74 .pt) AS ele, Dat
1e10: 65 54 69 6d 65 28 53 54 5f 4d 28 61 2e 70 74 29 eTime(ST_M(a.pt)
1e20: 29 20 41 53 20 74 69 6d 65 0d 0a 46 52 4f 4d 20 ) AS time..FROM
1e30: 28 53 45 4c 45 43 54 20 53 54 5f 45 6e 64 50 6f (SELECT ST_EndPo
1e40: 69 6e 74 28 67 65 6f 6d 29 20 41 53 20 70 74 20 int(geom) AS pt
1e50: 46 52 4f 4d 20 67 70 78 5f 74 72 61 63 6b 73 29 FROM gpx_tracks)
1e60: 20 41 53 20 61 3b 0d 0a 3c 2f 76 65 72 62 61 74 AS a;..</verbat
1e70: 69 6d 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f im>..<table bgco
1e80: 6c 6f 72 3d 22 23 64 30 66 66 62 30 22 20 63 65 lor="#d0ffb0" ce
1e90: 6c 6c 73 70 61 63 69 6e 67 3d 22 34 22 20 63 65 llspacing="4" ce
1ea0: 6c 6c 70 61 64 64 69 6e 67 3d 22 34 22 20 62 6f llpadding="4" bo
1eb0: 72 64 65 72 3d 22 31 22 3e 0d 0a 3c 74 72 3e 3c rder="1">..<tr><
1ec0: 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 63 30 64 td bgcolor="#c0d
1ed0: 64 61 6f 22 3e 3c 62 3e 70 6f 69 6e 74 3c 2f 62 dao"><b>point</b
1ee0: 3e 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f ></td><td bgcolo
1ef0: 72 3d 22 23 63 30 64 64 61 6f 22 3e 3c 62 3e 6c r="#c0ddao"><b>l
1f00: 6f 6e 3c 2f 62 3e 3c 2f 74 64 3e 3c 74 64 20 62 on</b></td><td b
1f10: 67 63 6f 6c 6f 72 3d 22 23 63 30 64 64 61 6f 22 gcolor="#c0ddao"
1f20: 3e 3c 62 3e 6c 61 74 3c 2f 62 3e 3c 2f 74 64 3e ><b>lat</b></td>
1f30: 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 63 30 <td bgcolor="#c0
1f40: 64 64 61 6f 22 3e 3c 62 3e 65 6c 65 3c 2f 62 3e ddao"><b>ele</b>
1f50: 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f 72 </td><td bgcolor
1f60: 3d 22 23 63 30 64 64 61 6f 22 3e 3c 62 3e 74 69 ="#c0ddao"><b>ti
1f70: 6d 65 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f 74 72 3e me</b></td></tr>
1f80: 0d 0a 3c 74 72 3e 3c 74 64 3e 50 6f 69 6e 74 20 ..<tr><td>Point
1f90: 23 31 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e #1</td><td align
1fa0: 3d 22 72 69 67 68 74 22 3e 33 37 2e 38 30 38 32 ="right">37.8082
1fb0: 35 30 3c 2f 74 64 3e 3c 74 64 20 61 6c 6f 67 6e 50</td><td alogn
1fc0: 3d 22 72 69 67 68 74 22 3e 35 35 2e 37 35 33 35 ="right">55.7535
1fd0: 37 32 3c 2f 74 64 3e 3c 74 64 3e 31 33 35 2e 30 72</td><td>135.0
1fe0: 30 30 30 30 30 3c 2f 74 64 3e 3c 74 64 3e 32 30 00000</td><td>20
1ff0: 30 39 2d 30 35 2d 31 39 20 30 34 3a 30 30 3a 33 09-05-19 04:00:3
2000: 30 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 0</td></tr>..<tr
2010: 3e 3c 74 64 3e 50 6f 69 6e 74 20 23 32 3c 2f 74 ><td>Point #2</t
2020: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 d><td align="rig
2030: 68 74 22 3e 33 37 2e 38 30 38 32 35 35 3c 2f 74 ht">37.808255</t
2040: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 d><td align="rig
2050: 68 74 22 3e 35 35 2e 37 35 33 36 32 32 3c 2f 74 ht">55.753622</t
2060: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 d><td align="rig
2070: 68 74 22 3e 31 33 35 2e 30 30 30 30 30 30 3c 2f ht">135.000000</
2080: 74 64 3e 3c 74 64 3e 32 30 30 39 2d 30 35 2d 31 td><td>2009-05-1
2090: 39 20 30 34 3a 30 30 3a 33 31 3c 2f 74 64 3e 3c 9 04:00:31</td><
20a0: 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 50 6f /tr>..<tr><td>Po
20b0: 69 6e 74 20 23 33 3c 2f 74 64 3e 3c 74 64 20 61 int #3</td><td a
20c0: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 33 37 2e lign="right">37.
20d0: 38 30 38 31 35 38 3c 2f 74 64 3e 3c 74 64 20 61 808158</td><td a
20e0: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 35 35 2e lign="right">55.
20f0: 37 35 33 35 39 33 3c 2f 74 64 3e 3c 74 64 20 61 753593</td><td a
2100: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 33 35 lign="right">135
2110: 2e 30 30 30 30 30 30 3c 2f 74 64 3e 3c 74 64 3e .000000</td><td>
2120: 32 30 30 39 2d 30 35 2d 31 39 20 30 34 3a 30 30 2009-05-19 04:00
2130: 3a 33 32 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c :32</td></tr>..<
2140: 74 72 3e 3c 74 64 3e 50 6f 69 6e 74 20 23 4e 3c tr><td>Point #N<
2150: 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 /td><td align="r
2160: 69 67 68 74 22 3e 33 37 2e 36 37 37 38 30 32 3c ight">37.677802<
2170: 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 /td><td align="r
2180: 69 67 68 74 22 3e 35 35 2e 37 35 38 31 37 37 3c ight">55.758177<
2190: 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 /td><td align="r
21a0: 69 67 68 74 22 3e 31 35 32 2e 30 30 30 30 30 30 ight">152.000000
21b0: 3c 2f 74 64 3e 3c 74 64 3e 32 30 30 39 2d 30 35 </td><td>2009-05
21c0: 2d 31 39 20 30 34 3a 34 36 3a 32 37 3c 2f 74 64 -19 04:46:27</td
21d0: 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e ></tr>..</table>
21e0: 3c 62 72 3e 0d 0a 41 73 20 79 6f 75 20 63 61 6e <br>..As you can
21f0: 20 65 61 73 69 6c 79 20 63 68 65 63 6b 2c 20 74 easily check, t
2200: 68 65 20 4d 75 6c 74 69 4c 69 6e 65 73 74 72 69 he MultiLinestri
2210: 6e 67 20 58 59 5a 4d 20 72 65 74 75 72 6e 65 64 ng XYZM returned
2220: 20 62 79 20 3c 62 3e 58 42 5f 4d 4c 69 6e 65 46 by <b>XB_MLineF
2230: 72 6f 6d 47 50 58 28 29 3c 2f 62 3e 20 66 61 69 romGPX()</b> fai
2240: 74 68 66 75 6c 6c 79 20 70 72 65 73 65 72 76 65 thfully preserve
2250: 73 20 62 6f 74 68 20 74 68 65 20 73 70 61 74 69 s both the spati
2260: 61 6c 20 63 6f 6f 72 64 69 6e 61 74 65 73 20 61 al coordinates a
2270: 6e 64 20 74 68 65 20 74 69 6d 65 73 74 61 6d 70 nd the timestamp
2280: 73 20 6f 72 69 67 69 6e 61 6c 6c 79 20 72 65 67 s originally reg
2290: 69 73 74 65 72 65 64 20 62 79 20 74 68 65 20 47 istered by the G
22a0: 50 53 20 73 65 6e 73 6f 72 2e 0d 0a 3c 62 72 3e PS sensor...<br>
22b0: 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 77 69 64 <br>..<table wid
22c0: 74 68 3d 22 31 30 30 25 22 3e 3c 74 72 3e 0d 0a th="100%"><tr>..
22d0: 3c 74 64 20 77 69 64 74 68 3d 22 33 33 25 22 20 <td width="33%"
22e0: 61 6c 69 67 6e 3d 22 6c 65 66 74 22 3e 3c 2f 74 align="left"></t
22f0: 64 3e 0d 0a 3c 74 64 20 61 6c 69 67 6e 3d 22 63 d>..<td align="c
2300: 65 6e 74 65 72 22 3e 3c 61 20 68 72 65 66 3d 22 enter"><a href="
2310: 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 https://www.gaia
2320: 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c -gis.it/fossil/l
2330: 69 62 73 70 61 74 69 61 6c 69 74 65 2f 77 69 6b ibspatialite/wik
2340: 69 3f 6e 61 6d 65 3d 6d 69 73 63 2d 64 6f 63 73 i?name=misc-docs
2350: 22 3e 62 61 63 6b 20 74 6f 20 69 6e 64 65 78 3c ">back to index<
2360: 2f 61 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 77 69 /a></td>..<td wi
2370: 64 74 68 3d 22 33 33 25 22 20 61 6c 69 67 6e 3d dth="33%" align=
2380: 22 72 69 67 68 74 22 3e 3c 2f 74 64 3e 0d 0a 3c "right"></td>..<
2390: 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0a 5a 20 64 /tr></table>.Z d
23a0: 62 33 61 37 64 63 39 63 37 62 38 65 37 65 63 61 b3a7dc9c7b8e7eca
23b0: 63 65 38 61 32 66 32 37 33 38 66 65 32 65 39 0a ce8a2f2738fe2e9.