Hex Artifact Content
Not logged in

Artifact 1cca9cb7a90f01e880b0849aeae133ad461cf9b2:

Wiki page [GPX tracks] by sandro 2015-12-12 14:09:25.
0000: 44 20 32 30 31 35 2d 31 32 2d 31 32 54 31 34 3a  D 2015-12-12T14:
0010: 30 39 3a 32 35 2e 37 32 39 0a 4c 20 47 50 58 5c  09:25.729.L GPX\
0020: 73 74 72 61 63 6b 73 0a 50 20 32 33 34 38 63 37  stracks.P 2348c7
0030: 66 36 33 30 61 33 30 30 63 66 66 33 66 37 37 35  f630a300cff3f775
0040: 35 64 31 32 31 32 64 34 66 33 32 37 31 61 33 63  5d1212d4f3271a3c
0050: 30 65 0a 55 20 73 61 6e 64 72 6f 0a 57 20 39 30  0e.U sandro.W 90
0060: 32 35 0a 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70  25.<table cellsp
0070: 61 63 69 6e 67 3d 22 31 32 22 20 77 69 64 74 68  acing="12" width
0080: 3d 22 31 30 30 25 22 3e 0d 0a 3c 74 72 3e 3c 74  ="100%">..<tr><t
0090: 64 20 63 6f 6c 73 70 61 6e 3d 22 32 22 3e 0d 0a  d colspan="2">..
00a0: 3c 74 61 62 6c 65 20 77 69 64 74 68 3d 22 31 30  <table width="10
00b0: 30 25 22 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30  0%" bgcolor="#f0
00c0: 66 30 66 38 22 3e 0d 0a 3c 74 72 3e 3c 74 64 20  f0f8">..<tr><td 
00d0: 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 0d  align="center">.
00e0: 0a 3c 68 31 3e 47 50 58 20 74 72 61 63 6b 73 3a  .<h1>GPX tracks:
00f0: 20 61 20 71 75 69 63 6b 20 69 6e 74 72 6f 3c 2f   a quick intro</
0100: 68 31 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c  h1>..</td></tr><
0110: 2f 74 61 62 6c 65 3e 0d 0a 3c 74 61 62 6c 65 20  /table>..<table 
0120: 77 69 64 74 68 3d 22 31 30 30 25 22 3e 3c 74 72  width="100%"><tr
0130: 3e 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33  >..<td width="33
0140: 25 22 20 61 6c 69 67 6e 3d 22 6c 65 66 74 22 3e  %" align="left">
0150: 3c 2f 74 64 3e 0d 0a 3c 74 64 20 61 6c 69 67 6e  </td>..<td align
0160: 3d 22 63 65 6e 74 65 72 22 3e 3c 61 20 68 72 65  ="center"><a hre
0170: 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67  f="https://www.g
0180: 61 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69  aia-gis.it/fossi
0190: 6c 2f 6c 69 62 73 70 61 74 69 61 6c 69 74 65 2f  l/libspatialite/
01a0: 77 69 6b 69 3f 6e 61 6d 65 3d 6d 69 73 63 2d 64  wiki?name=misc-d
01b0: 6f 63 73 22 3e 62 61 63 6b 20 74 6f 20 69 6e 64  ocs">back to ind
01c0: 65 78 3c 2f 61 3e 3c 2f 74 64 3e 0d 0a 3c 74 64  ex</a></td>..<td
01d0: 20 77 69 64 74 68 3d 22 33 33 25 22 20 61 6c 69   width="33%" ali
01e0: 67 6e 3d 22 72 69 67 68 74 22 3e 3c 2f 74 64 3e  gn="right"></td>
01f0: 0d 0a 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 3c  ..</tr></table><
0200: 62 72 3e 3c 74 61 62 6c 65 20 77 69 64 74 68 3d  br><table width=
0210: 22 31 30 30 25 22 20 62 67 63 6f 6c 6f 72 3d 22  "100%" bgcolor="
0220: 23 66 66 66 66 64 66 22 20 63 65 6c 6c 73 70 61  #ffffdf" cellspa
0230: 63 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64  cing="4" cellpad
0240: 64 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c  ding="8">..<tr><
0250: 74 64 3e 3c 62 3e 57 68 61 74 20 69 73 20 61 20  td><b>What is a 
0260: 47 50 58 20 66 69 6c 65 20 3f 3c 2f 62 3e 3c 2f  GPX file ?</b></
0270: 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74  td></tr>..<tr><t
0280: 64 3e 3c 62 3e 47 50 58 3c 2f 62 3e 20 73 74 61  d><b>GPX</b> sta
0290: 6e 64 73 20 66 6f 72 20 3c 69 3e 3c 62 3e 47 50  nds for <i><b>GP
02a0: 3c 2f 62 3e 53 20 45 3c 62 3e 78 3c 2f 62 3e 63  </b>S E<b>x</b>c
02b0: 68 61 6e 67 65 20 46 6f 72 6d 61 74 3c 2f 69 3e  hange Format</i>
02c0: 3b 20 69 74 27 73 20 61 20 76 65 72 79 20 70 6f  ; it's a very po
02d0: 70 75 6c 61 72 20 66 69 6c 65 20 66 6f 72 6d 61  pular file forma
02e0: 74 20 75 73 65 64 20 69 6e 20 6f 72 64 65 72 20  t used in order 
02f0: 74 6f 20 65 78 63 68 61 6e 67 65 20 47 50 53 20  to exchange GPS 
0300: 64 61 74 61 20 61 63 72 6f 73 73 20 64 69 66 66  data across diff
0310: 65 72 65 6e 74 20 64 65 76 69 63 65 73 2e 3c 62  erent devices.<b
0320: 72 3e 20 0d 0a 47 50 58 20 69 73 20 61 6e 20 6f  r> ..GPX is an o
0330: 70 65 6e 20 66 6f 72 6d 61 74 20 61 6e 64 20 69  pen format and i
0340: 73 20 61 6c 6d 6f 73 74 20 61 6c 77 61 79 73 20  s almost always 
0350: 73 75 70 70 6f 72 74 65 64 3a 20 69 74 27 73 20  supported: it's 
0360: 62 61 73 65 64 20 6f 6e 20 61 20 66 6f 72 6d 61  based on a forma
0370: 6c 6c 79 20 64 65 66 69 6e 65 64 20 3c 61 20 68  lly defined <a h
0380: 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e  ref="http://www.
0390: 74 6f 70 6f 67 72 61 66 69 78 2e 63 6f 6d 2f 47  topografix.com/G
03a0: 50 58 2f 31 2f 31 2f 23 74 6f 70 22 3e 58 4d 4c  PX/1/1/#top">XML
03b0: 20 73 63 68 65 6d 61 3c 2f 61 3e 3c 62 72 3e 0d   schema</a><br>.
03c0: 0a 4d 61 6e 79 20 72 65 61 6c 20 77 6f 72 64 20  .Many real word 
03d0: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20  implementations 
03e0: 61 72 65 20 6f 6e 6c 79 20 6c 6f 6f 73 65 6c 79  are only loosely
03f0: 20 63 6f 6e 66 6f 72 6d 61 6e 74 20 74 6f 20 74   conformant to t
0400: 68 65 20 73 74 61 6e 64 61 72 64 20 73 63 68 65  he standard sche
0410: 6d 61 20 61 6e 64 20 66 75 72 74 68 65 72 20 6e  ma and further n
0420: 6f 6e 2d 73 74 61 6e 64 61 72 64 20 74 61 67 73  on-standard tags
0430: 20 68 61 76 65 20 62 65 65 6e 20 69 6e 74 72 6f   have been intro
0440: 64 75 63 65 64 20 62 79 20 73 65 76 65 72 61 6c  duced by several
0450: 20 76 65 6e 64 6f 72 73 2e 3c 62 72 3e 3c 62 72   vendors.<br><br
0460: 3e 0d 0a 41 20 47 50 58 20 66 69 6c 65 20 69 73  >..A GPX file is
0470: 20 65 78 70 65 63 74 65 64 20 74 6f 20 69 6e 74   expected to int
0480: 65 72 6e 61 6c 6c 79 20 73 74 6f 72 65 20 61 74  ernally store at
0490: 20 6c 65 61 73 74 20 6f 6e 65 20 6f 66 20 74 68   least one of th
04a0: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 6e 74  e following cont
04b0: 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69  ents:..<ul>..<li
04c0: 3e 3c 62 3e 54 72 61 63 6b 73 3c 2f 62 3e 3a 20  ><b>Tracks</b>: 
04d0: 61 20 54 72 61 63 6b 20 69 73 20 61 6e 20 6f 72  a Track is an or
04e0: 64 65 72 65 64 20 6c 69 73 74 20 6f 66 20 70 6f  dered list of po
04f0: 69 6e 74 73 20 64 65 73 63 72 69 62 69 6e 67 20  ints describing 
0500: 61 20 70 61 74 68 2e 0d 0a 41 20 54 72 61 63 6b  a path...A Track
0510: 20 6d 75 73 74 20 63 6f 6e 74 61 69 6e 20 61 74   must contain at
0520: 20 6c 65 61 73 74 20 6f 6e 65 20 54 72 61 63 6b   least one Track
0530: 20 53 65 67 6d 65 6e 74 20 68 6f 6c 64 69 6e 67   Segment holding
0540: 20 61 20 6c 69 73 74 20 6f 66 20 54 72 61 63 6b   a list of Track
0550: 20 50 6f 69 6e 74 73 20 77 68 69 63 68 20 61 72   Points which ar
0560: 65 20 6c 6f 67 69 63 61 6c 6c 79 20 63 6f 6e 6e  e logically conn
0570: 65 63 74 65 64 20 69 6e 20 6f 72 64 65 72 2e 3c  ected in order.<
0580: 62 72 3e 0d 0a 41 20 54 72 61 63 6b 20 63 61 6e  br>..A Track can
0590: 20 63 6f 6e 74 61 69 6e 20 6d 6f 72 65 20 53 65   contain more Se
05a0: 67 6d 65 6e 74 73 2c 20 61 6e 64 20 6d 6f 72 65  gments, and more
05b0: 20 54 72 61 63 6b 73 20 63 61 6e 20 62 65 20 73   Tracks can be s
05c0: 74 6f 72 65 64 20 69 6e 74 6f 20 74 68 65 20 73  tored into the s
05d0: 61 6d 65 20 47 50 58 20 66 69 6c 65 2e 3c 2f 6c  ame GPX file.</l
05e0: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 57 61 79 50 6f  i>..<li><b>WayPo
05f0: 69 6e 74 73 3c 2f 62 3e 3c 2f 62 3e 3a 20 61 20  ints</b></b>: a 
0600: 57 61 79 50 6f 69 6e 74 20 63 6f 6e 73 69 73 74  WayPoint consist
0610: 73 20 6f 66 20 74 68 65 20 57 47 53 20 38 34 20  s of the WGS 84 
0620: 28 47 50 53 29 20 63 6f 6f 72 64 69 6e 61 74 65  (GPS) coordinate
0630: 73 20 6f 66 20 61 20 70 6f 69 6e 74 20 61 6e 64  s of a point and
0640: 20 70 6f 73 73 69 62 6c 79 20 6f 74 68 65 72 20   possibly other 
0650: 64 65 73 63 72 69 70 74 69 76 65 20 69 6e 66 6f  descriptive info
0660: 72 6d 61 74 69 6f 6e 2e 3c 62 72 3e 0d 0a 54 68  rmation.<br>..Th
0670: 65 20 73 61 6d 65 20 47 50 58 20 66 69 6c 65 20  e same GPX file 
0680: 63 61 6e 20 63 6f 6e 74 61 69 6e 20 61 20 63 6f  can contain a co
0690: 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 6d 61 6e 79  llection of many
06a0: 20 57 61 79 50 6f 69 6e 74 73 20 77 69 74 68 20   WayPoints with 
06b0: 6e 6f 20 73 65 71 75 65 6e 74 69 61 6c 20 72 65  no sequential re
06c0: 6c 61 74 69 6f 6e 73 68 69 70 2e 3c 2f 6c 69 3e  lationship.</li>
06d0: 0d 0a 3c 6c 69 3e 3c 62 3e 52 6f 75 74 65 73 3c  ..<li><b>Routes<
06e0: 2f 62 3e 3a 20 61 20 52 6f 75 74 65 20 69 73 20  /b>: a Route is 
06f0: 61 6e 20 6f 72 64 65 72 65 64 20 6c 69 73 74 20  an ordered list 
0700: 6f 66 20 72 6f 75 74 65 70 6f 69 6e 74 73 20 28  of routepoints (
0710: 77 61 79 70 6f 69 6e 74 73 20 72 65 70 72 65 73  waypoints repres
0720: 65 6e 74 69 6e 67 20 61 20 73 65 72 69 65 73 20  enting a series 
0730: 6f 66 20 73 69 67 6e 69 66 69 63 61 6e 74 20 74  of significant t
0740: 75 72 6e 20 6f 72 20 73 74 61 67 65 20 70 6f 69  urn or stage poi
0750: 6e 74 73 29 20 6c 65 61 64 69 6e 67 20 74 6f 20  nts) leading to 
0760: 61 20 64 65 73 74 69 6e 61 74 69 6f 6e 2e 3c 2f  a destination.</
0770: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a  li>..</ul><br>..
0780: 53 70 61 74 69 61 4c 69 74 65 20 6f 6e 6c 79 20  SpatiaLite only 
0790: 73 75 70 70 6f 72 74 73 20 3c 62 3e 47 50 58 20  supports <b>GPX 
07a0: 54 72 61 63 6b 73 3c 2f 62 3e 20 61 6e 64 20 77  Tracks</b> and w
07b0: 69 6c 6c 20 61 6c 77 61 79 73 20 73 69 6c 65 6e  ill always silen
07c0: 74 6c 79 20 69 67 6e 6f 72 65 20 61 6e 79 20 6f  tly ignore any o
07d0: 74 68 65 72 20 63 6f 6e 74 65 6e 74 2e 3c 62 72  ther content.<br
07e0: 3e 3c 62 72 3e 0d 0a 3c 68 33 3e 41 6e 61 74 6f  ><br>..<h3>Anato
07f0: 6d 79 20 6f 66 20 61 20 47 50 58 20 66 69 6c 65  my of a GPX file
0800: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 20 47 50   containing a GP
0810: 53 20 54 72 61 63 6b 3c 2f 68 33 3e 0d 0a 49 66  S Track</h3>..If
0820: 20 79 6f 75 20 61 72 65 20 69 6e 74 65 72 65 73   you are interes
0830: 74 65 64 20 69 6e 74 6f 20 47 50 53 20 54 72 61  ted into GPS Tra
0840: 63 6b 73 20 79 6f 75 27 6c 6c 20 76 65 72 79 20  cks you'll very 
0850: 70 72 6f 62 61 62 6c 79 20 68 61 76 65 20 6c 6f  probably have lo
0860: 74 73 20 6f 66 20 47 50 58 20 66 69 6c 65 73 20  ts of GPX files 
0870: 6f 66 20 79 6f 75 72 20 6f 77 6e 20 74 68 61 74  of your own that
0880: 20 79 6f 75 20 63 61 6e 20 75 73 65 20 61 73 20   you can use as 
0890: 74 65 73 74 20 73 61 6d 70 6c 65 73 2e 3c 62 72  test samples.<br
08a0: 3e 0d 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67  >..The following
08b0: 20 65 78 61 6d 70 6c 65 73 20 75 73 65 20 74 68   examples use th
08c0: 69 73 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70  is <a href="http
08d0: 3a 2f 2f 77 77 77 2e 73 68 6d 75 6d 61 2e 72 75  ://www.shmuma.ru
08e0: 2f 77 69 6b 69 2f 69 6d 61 67 65 73 2f 35 2f 35  /wiki/images/5/5
08f0: 31 2f 47 70 78 2d 66 75 6c 6c 2d 73 61 6d 70 6c  1/Gpx-full-sampl
0900: 65 2e 67 70 78 22 3e 47 50 58 20 73 61 6d 70 6c  e.gpx">GPX sampl
0910: 65 3c 2f 61 3e 3c 62 72 3e 0d 0a 3c 76 65 72 62  e</a><br>..<verb
0920: 61 74 69 6d 3e 0d 0a 3c 3f 78 6d 6c 20 76 65 72  atim>..<?xml ver
0930: 73 69 6f 6e 3d 22 31 2e 30 22 3f 3e 0d 0a 3c 67  sion="1.0"?>..<g
0940: 70 78 20 76 65 72 73 69 6f 6e 3d 22 31 2e 30 22  px version="1.0"
0950: 20 78 6d 6c 6e 73 3d 22 68 74 74 70 3a 2f 2f 77   xmlns="http://w
0960: 77 77 2e 74 6f 70 6f 67 72 61 66 69 78 2e 63 6f  ww.topografix.co
0970: 6d 2f 47 50 58 2f 31 2f 30 22 3e 0d 0a 20 20 3c  m/GPX/1/0">..  <
0980: 74 72 6b 3e 0d 0a 20 20 20 20 3c 74 72 6b 73 65  trk>..    <trkse
0990: 67 3e 0d 0a 20 20 20 20 20 20 3c 74 72 6b 70 74  g>..      <trkpt
09a0: 20 6c 61 74 3d 22 35 35 2e 37 35 33 35 37 32 22   lat="55.753572"
09b0: 20 6c 6f 6e 3d 22 33 37 2e 38 30 38 32 35 30 22   lon="37.808250"
09c0: 3e 0d 0a 20 20 20 20 20 20 20 20 3c 65 6c 65 3e  >..        <ele>
09d0: 31 33 35 2e 30 30 3c 2f 65 6c 65 3e 0d 0a 20 20  135.00</ele>..  
09e0: 20 20 20 20 20 20 3c 74 69 6d 65 3e 32 30 30 39        <time>2009
09f0: 2d 30 35 2d 31 39 54 30 34 3a 30 30 3a 33 30 5a  -05-19T04:00:30Z
0a00: 3c 2f 74 69 6d 65 3e 0d 0a 20 20 20 20 20 20 3c  </time>..      <
0a10: 2f 74 72 6b 70 74 3e 0d 0a 20 20 20 20 20 20 3c  /trkpt>..      <
0a20: 74 72 6b 70 74 20 6c 61 74 3d 22 35 35 2e 37 35  trkpt lat="55.75
0a30: 33 36 32 32 22 20 6c 6f 6e 3d 22 33 37 2e 38 30  3622" lon="37.80
0a40: 38 32 35 35 22 3e 0d 0a 20 20 20 20 20 20 20 20  8255">..        
0a50: 3c 65 6c 65 3e 31 33 35 2e 30 30 3c 2f 65 6c 65  <ele>135.00</ele
0a60: 3e 0d 0a 20 20 20 20 20 20 20 20 3c 74 69 6d 65  >..        <time
0a70: 3e 32 30 30 39 2d 30 35 2d 31 39 54 30 34 3a 30  >2009-05-19T04:0
0a80: 30 3a 33 31 5a 3c 2f 74 69 6d 65 3e 0d 0a 20 20  0:31Z</time>..  
0a90: 20 20 20 20 3c 2f 74 72 6b 70 74 3e 0d 0a 20 20      </trkpt>..  
0aa0: 20 20 20 20 3c 74 72 6b 70 74 20 6c 61 74 3d 22      <trkpt lat="
0ab0: 35 35 2e 37 35 33 35 39 33 22 20 6c 6f 6e 3d 22  55.753593" lon="
0ac0: 33 37 2e 38 30 38 31 35 38 22 3e 0d 0a 20 20 20  37.808158">..   
0ad0: 20 20 20 20 20 3c 65 6c 65 3e 31 33 35 2e 30 30       <ele>135.00
0ae0: 3c 2f 65 6c 65 3e 0d 0a 20 20 20 20 20 20 20 20  </ele>..        
0af0: 3c 74 69 6d 65 3e 32 30 30 39 2d 30 35 2d 31 39  <time>2009-05-19
0b00: 54 30 34 3a 30 30 3a 33 32 5a 3c 2f 74 69 6d 65  T04:00:32Z</time
0b10: 3e 0d 0a 20 20 20 20 20 20 3c 2f 74 72 6b 70 74  >..      </trkpt
0b20: 3e 0d 0a 2e 2e 2e 2e 0d 0a 20 20 20 20 20 20 3c  >........      <
0b30: 74 72 6b 70 74 20 6c 61 74 3d 22 35 35 2e 37 35  trkpt lat="55.75
0b40: 38 31 37 37 22 20 6c 6f 6e 3d 22 33 37 2e 36 37  8177" lon="37.67
0b50: 37 38 30 32 22 3e 0d 0a 20 20 20 20 20 20 20 20  7802">..        
0b60: 3c 65 6c 65 3e 31 35 32 2e 30 30 3c 2f 65 6c 65  <ele>152.00</ele
0b70: 3e 0d 0a 20 20 20 20 20 20 20 20 3c 74 69 6d 65  >..        <time
0b80: 3e 32 30 30 39 2d 30 35 2d 31 39 54 30 34 3a 34  >2009-05-19T04:4
0b90: 36 3a 32 37 5a 3c 2f 74 69 6d 65 3e 0d 0a 20 20  6:27Z</time>..  
0ba0: 20 20 20 20 3c 2f 74 72 6b 70 74 3e 0d 0a 20 20      </trkpt>..  
0bb0: 20 20 3c 2f 74 72 6b 73 65 67 3e 0d 0a 20 20 3c    </trkseg>..  <
0bc0: 2f 74 72 6b 3e 0d 0a 3c 2f 67 70 78 3e 0d 0a 3c  /trk>..</gpx>..<
0bd0: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 6c 3e  /verbatim>..<ul>
0be0: 0d 0a 3c 6c 69 3e 74 68 65 20 77 68 6f 6c 65 20  ..<li>the whole 
0bf0: 47 50 58 20 66 69 6c 65 20 69 73 20 65 6e 63 6c  GPX file is encl
0c00: 6f 73 65 64 20 77 69 74 68 69 6e 20 3c 62 3e 26  osed within <b>&
0c10: 6c 74 3b 67 70 78 26 67 74 3b 3c 2f 62 3e 20 61  lt;gpx&gt;</b> a
0c20: 6e 64 20 3c 62 3e 26 6c 74 3b 2f 67 70 78 26 67  nd <b>&lt;/gpx&g
0c30: 74 3b 3c 2f 62 3e 20 74 61 67 73 2e 3c 2f 6c 69  t;</b> tags.</li
0c40: 3e 0d 0a 3c 6c 69 3e 65 61 63 68 20 54 72 61 63  >..<li>each Trac
0c50: 6b 20 69 73 20 64 65 6c 69 6d 69 74 65 64 20 62  k is delimited b
0c60: 79 20 61 20 6d 61 74 63 68 69 6e 67 20 70 61 69  y a matching pai
0c70: 72 20 6f 66 20 3c 62 3e 26 6c 74 3b 74 72 6b 26  r of <b>&lt;trk&
0c80: 67 74 3b 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 26  gt;</b> and <b>&
0c90: 6c 74 3b 2f 74 72 6b 26 67 74 3b 3c 2f 62 3e 20  lt;/trk&gt;</b> 
0ca0: 74 61 67 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  tags.</li>..<li>
0cb0: 65 61 63 68 20 54 72 61 63 6b 20 53 65 67 6d 65  each Track Segme
0cc0: 6e 74 20 69 73 20 64 65 6c 69 6d 69 74 65 64 20  nt is delimited 
0cd0: 62 79 20 61 20 6d 61 74 63 68 69 6e 67 20 70 61  by a matching pa
0ce0: 69 72 20 6f 66 20 3c 62 3e 26 6c 74 3b 74 72 6b  ir of <b>&lt;trk
0cf0: 73 65 67 26 67 74 3b 3c 2f 62 3e 20 61 6e 64 20  seg&gt;</b> and 
0d00: 3c 62 3e 26 6c 74 3b 2f 74 72 6b 73 65 67 26 67  <b>&lt;/trkseg&g
0d10: 74 3b 3c 2f 62 3e 20 74 61 67 73 2e 3c 2f 6c 69  t;</b> tags.</li
0d20: 3e 0d 0a 3c 6c 69 3e 65 61 63 68 20 54 72 61 63  >..<li>each Trac
0d30: 6b 20 50 6f 69 6e 74 20 69 73 20 65 6e 63 6c 6f  k Point is enclo
0d40: 73 65 64 20 77 69 74 68 69 6e 20 3c 62 3e 26 6c  sed within <b>&l
0d50: 74 3b 74 72 6b 70 74 26 67 74 3b 3c 2f 62 3e 20  t;trkpt&gt;</b> 
0d60: 61 6e 64 20 3c 62 3e 26 6c 74 3b 2f 74 72 6b 70  and <b>&lt;/trkp
0d70: 74 26 67 74 3b 3c 2f 62 3e 20 74 61 67 73 2e 0d  t&gt;</b> tags..
0d80: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 3c  .<ul>..<li>the <
0d90: 62 3e 6c 61 74 3c 2f 62 3e 20 61 6e 64 20 3c 62  b>lat</b> and <b
0da0: 3e 6c 6f 6e 3c 2f 62 3e 20 6d 61 6e 64 61 74 6f  >lon</b> mandato
0db0: 72 79 20 61 74 74 72 69 62 75 74 65 73 20 61 72  ry attributes ar
0dc0: 65 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 64 65  e intended to de
0dd0: 63 6c 61 72 65 20 74 68 65 20 57 47 53 20 38 34  clare the WGS 84
0de0: 20 3c 62 3e 3c 69 3e 6c 61 74 69 74 75 64 65 3c   <b><i>latitude<
0df0: 2f 69 3e 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 3c  /i></b> and <b><
0e00: 69 3e 6c 6f 6e 67 69 74 75 64 65 3c 2f 69 3e 3c  i>longitude</i><
0e10: 2f 62 3e 20 6f 66 20 74 68 65 20 70 6f 69 6e 74  /b> of the point
0e20: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20  .</li>..<li>the 
0e30: 3c 62 3e 3c 69 3e 65 6c 65 76 61 74 69 6f 6e 3c  <b><i>elevation<
0e40: 2f 69 3e 3c 2f 62 3e 20 6f 66 20 74 68 65 20 70  /i></b> of the p
0e50: 6f 69 6e 74 20 28 6d 65 61 73 75 72 65 64 20 69  oint (measured i
0e60: 6e 20 6d 65 74 65 72 73 29 20 63 61 6e 20 62 65  n meters) can be
0e70: 20 6f 70 74 69 6f 6e 61 6c 6c 79 20 64 65 63 6c   optionally decl
0e80: 61 72 65 64 20 77 69 74 68 69 6e 20 61 20 70 61  ared within a pa
0e90: 69 72 20 6f 66 20 3c 62 3e 26 6c 74 3b 65 6c 65  ir of <b>&lt;ele
0ea0: 26 67 74 3b 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e  &gt;</b> and <b>
0eb0: 26 6c 74 3b 2f 65 6c 65 26 67 74 3b 3c 2f 62 3e  &lt;/ele&gt;</b>
0ec0: 20 74 61 67 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69   tags.</li>..<li
0ed0: 3e 74 68 65 20 3c 62 3e 3c 69 3e 64 61 74 65 20  >the <b><i>date 
0ee0: 61 6e 64 20 74 69 6d 65 3c 2f 69 3e 3c 2f 62 3e  and time</i></b>
0ef0: 20 6f 66 20 74 68 65 20 63 6f 72 72 65 73 70 6f   of the correspo
0f00: 6e 64 69 6e 67 20 47 50 53 20 6d 65 61 73 75 72  nding GPS measur
0f10: 65 20 63 61 6e 20 62 65 20 6f 70 74 69 6f 6e 61  e can be optiona
0f20: 6c 6c 79 20 64 65 63 6c 61 72 65 64 20 77 69 74  lly declared wit
0f30: 68 69 6e 20 61 20 70 61 69 72 20 6f 66 20 3c 62  hin a pair of <b
0f40: 3e 26 6c 74 3b 74 69 6d 65 26 67 74 3b 3c 2f 62  >&lt;time&gt;</b
0f50: 3e 20 61 6e 64 20 3c 62 3e 26 6c 74 3b 2f 74 69  > and <b>&lt;/ti
0f60: 6d 65 26 67 74 3b 3c 2f 62 3e 20 74 61 67 73 2e  me&gt;</b> tags.
0f70: 3c 62 72 3e 0d 0a 44 61 74 65 73 20 61 6e 64 20  <br>..Dates and 
0f80: 74 69 6d 65 73 20 61 72 65 20 6e 6f 74 20 6c 6f  times are not lo
0f90: 63 61 6c 20 74 69 6d 65 2c 20 62 75 74 20 69 6e  cal time, but in
0fa0: 73 74 65 61 64 20 61 72 65 20 3c 61 20 68 72 65  stead are <a hre
0fb0: 66 3d 22 68 74 74 70 73 3a 2f 2f 65 6e 2e 77 69  f="https://en.wi
0fc0: 6b 69 70 65 64 69 61 2e 6f 72 67 2f 77 69 6b 69  kipedia.org/wiki
0fd0: 2f 43 6f 6f 72 64 69 6e 61 74 65 64 5f 55 6e 69  /Coordinated_Uni
0fe0: 76 65 72 73 61 6c 5f 54 69 6d 65 22 3e 43 6f 6f  versal_Time">Coo
0ff0: 72 64 69 6e 61 74 65 64 20 55 6e 69 76 65 72 73  rdinated Univers
1000: 61 6c 20 54 69 6d 65 3c 2f 61 3e 20 28 3c 62 3e  al Time</a> (<b>
1010: 55 54 43 3c 2f 62 3e 29 20 75 73 69 6e 67 20 3c  UTC</b>) using <
1020: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f  a href="https://
1030: 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72 67  en.wikipedia.org
1040: 2f 77 69 6b 69 2f 49 53 4f 5f 38 36 30 31 22 3e  /wiki/ISO_8601">
1050: 49 53 4f 20 38 36 30 31 3c 2f 61 3e 20 66 6f 72  ISO 8601</a> for
1060: 6d 61 74 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  mat.</li>..</ul>
1070: 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f  </li>..</ul>..</
1080: 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c  td></tr>..</tabl
1090: 65 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 3c 62 72 3e  e><br>..<hr><br>
10a0: 0d 0a 3c 68 32 3e 49 6d 70 6f 72 74 69 6e 67 20  ..<h2>Importing 
10b0: 47 50 58 20 74 72 61 63 6b 73 20 69 6e 74 6f 20  GPX tracks into 
10c0: 61 20 53 70 61 74 69 61 4c 69 74 65 20 47 65 6f  a SpatiaLite Geo
10d0: 54 61 62 6c 65 3c 2f 68 32 3e 0d 0a 3c 76 65 72  Table</h2>..<ver
10e0: 62 61 74 69 6d 3e 0d 0a 43 52 45 41 54 45 20 54  batim>..CREATE T
10f0: 41 42 4c 45 20 72 61 77 5f 67 70 78 20 28 0d 0a  ABLE raw_gpx (..
1100: 20 20 20 20 69 64 5f 67 70 78 20 49 4e 54 45 47      id_gpx INTEG
1110: 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59 20 41  ER PRIMARY KEY A
1120: 55 54 4f 49 4e 43 52 45 4d 45 4e 54 2c 0d 0a 20  UTOINCREMENT,.. 
1130: 20 20 20 67 70 78 20 42 4c 4f 42 20 4e 4f 54 20     gpx BLOB NOT 
1140: 20 4e 55 4c 4c 29 3b 0d 0a 0d 0a 49 4e 53 45 52   NULL);....INSER
1150: 54 20 49 4e 54 4f 20 72 61 77 5f 67 70 78 20 56  T INTO raw_gpx V
1160: 41 4c 55 45 53 20 28 4e 55 4c 4c 2c 20 58 42 5f  ALUES (NULL, XB_
1170: 43 72 65 61 74 65 28 58 42 5f 4c 6f 61 64 58 4d  Create(XB_LoadXM
1180: 4c 28 27 47 70 78 2d 66 75 6c 6c 2d 73 61 6d 70  L('Gpx-full-samp
1190: 6c 65 2e 67 70 78 27 29 29 29 3b 0d 0a 0d 0a 53  le.gpx')));....S
11a0: 45 4c 45 43 54 20 69 64 5f 67 70 78 2c 20 58 42  ELECT id_gpx, XB
11b0: 5f 49 73 47 50 58 28 67 70 78 29 20 0d 0a 46 52  _IsGPX(gpx) ..FR
11c0: 4f 4d 20 72 61 77 5f 67 70 78 3b 0d 0a 2d 2d 2d  OM raw_gpx;..---
11d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
11e0: 0d 0a 31 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e  ..1..</verbatim>
11f0: 0d 0a 53 69 6e 63 65 20 47 50 58 20 66 69 6c 65  ..Since GPX file
1200: 73 20 61 72 65 20 58 4d 4c 20 66 69 6c 65 73 2c  s are XML files,
1210: 20 79 6f 75 20 6d 75 73 74 20 75 73 65 20 74 68   you must use th
1220: 65 20 73 74 61 6e 64 61 72 64 20 53 51 4c 20 66  e standard SQL f
1230: 75 6e 63 74 69 6f 6e 73 20 73 75 70 70 6f 72 74  unctions support
1240: 69 6e 67 20 67 65 6e 65 72 69 63 20 58 4d 4c 2e  ing generic XML.
1250: 3c 62 72 3e 0d 0a 3c 62 3e 58 42 5f 49 73 47 50  <br>..<b>XB_IsGP
1260: 58 28 29 3c 2f 62 3e 20 69 73 20 61 20 6e 65 77  X()</b> is a new
1270: 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e 20 69 6e   SQL function in
1280: 74 72 6f 64 75 63 65 64 20 62 79 20 53 70 61 74  troduced by Spat
1290: 69 61 4c 69 74 65 20 3c 62 3e 34 2e 34 2e 30 3c  iaLite <b>4.4.0<
12a0: 2f 62 3e 3b 20 69 74 20 77 69 6c 6c 20 74 65 73  /b>; it will tes
12b0: 74 20 74 68 65 20 61 63 74 75 61 6c 20 58 4d 4c  t the actual XML
12c0: 20 69 6e 70 75 74 20 61 6e 64 20 77 69 6c 6c 20   input and will 
12d0: 72 65 74 75 72 6e 20 3c 62 3e 31 3c 2f 62 3e 20  return <b>1</b> 
12e0: 69 66 20 69 74 20 72 65 61 6c 6c 79 20 69 73 20  if it really is 
12f0: 6f 66 20 74 68 65 20 47 50 58 20 74 79 70 65 2c  of the GPX type,
1300: 20 3c 62 3e 30 3c 2f 62 3e 20 69 66 20 6e 6f 74   <b>0</b> if not
1310: 2c 20 61 6e 64 20 3c 62 3e 2d 31 3c 2f 62 3e 20  , and <b>-1</b> 
1320: 77 68 65 6e 20 74 68 65 20 70 61 73 73 65 64 20  when the passed 
1330: 61 72 67 75 6d 65 6e 74 20 69 73 20 6e 6f 74 20  argument is not 
1340: 61 20 76 61 6c 69 64 20 58 4d 4c 20 64 6f 63 75  a valid XML docu
1350: 6d 65 6e 74 2e 3c 62 72 3e 0d 0a 3c 76 65 72 62  ment.<br>..<verb
1360: 61 74 69 6d 3e 0d 0a 43 52 45 41 54 45 20 54 41  atim>..CREATE TA
1370: 42 4c 45 20 67 70 78 5f 74 72 61 63 6b 73 20 28  BLE gpx_tracks (
1380: 0d 0a 20 20 20 20 69 64 5f 74 72 6b 20 49 4e 54  ..    id_trk INT
1390: 45 47 45 52 20 50 52 49 4d 41 52 59 20 4b 45 59  EGER PRIMARY KEY
13a0: 20 41 55 54 4f 49 4e 43 52 45 4d 45 4e 54 29 3b   AUTOINCREMENT);
13b0: 0d 0a 0d 0a 53 45 4c 45 43 54 20 41 64 64 47 65  ....SELECT AddGe
13c0: 6f 6d 65 74 72 79 43 6f 6c 75 6d 6e 28 27 67 70  ometryColumn('gp
13d0: 78 5f 74 72 61 63 6b 73 27 2c 20 27 67 65 6f 6d  x_tracks', 'geom
13e0: 27 2c 20 34 33 32 36 2c 20 27 4d 55 4c 54 49 4c  ', 4326, 'MULTIL
13f0: 49 4e 45 53 54 52 49 4e 47 27 2c 20 27 58 59 5a  INESTRING', 'XYZ
1400: 4d 27 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  M');..----------
1410: 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 49 4e 53 45 52 54  ---..1....INSERT
1420: 20 49 4e 54 4f 20 67 70 78 5f 74 72 61 63 6b 73   INTO gpx_tracks
1430: 20 0d 0a 53 45 4c 45 43 54 20 4e 55 4c 4c 2c 20   ..SELECT NULL, 
1440: 58 42 5f 4d 4c 69 6e 65 46 72 6f 6d 47 50 58 28  XB_MLineFromGPX(
1450: 67 70 78 29 0d 0a 46 52 4f 4d 20 72 61 77 5f 67  gpx)..FROM raw_g
1460: 70 78 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e  px;..</verbatim>
1470: 0d 0a 4e 6f 77 20 77 65 27 6c 6c 20 63 72 65 61  ..Now we'll crea
1480: 74 65 20 61 6e 6f 74 68 65 72 20 74 61 62 6c 65  te another table
1490: 20 69 6e 63 6c 75 64 69 6e 67 20 61 20 47 65 6f   including a Geo
14a0: 6d 65 74 72 79 20 63 6f 6c 75 6d 6e 20 64 65 63  metry column dec
14b0: 6c 61 72 65 64 20 6f 66 20 74 68 65 20 3c 62 3e  lared of the <b>
14c0: 4d 55 4c 54 49 4c 49 4e 45 53 54 52 49 4e 47 3c  MULTILINESTRING<
14d0: 2f 62 3e 20 74 79 70 65 20 61 6e 64 20 68 61 76  /b> type and hav
14e0: 69 6e 67 20 3c 62 3e 58 59 5a 4d 3c 2f 62 3e 20  ing <b>XYZM</b> 
14f0: 64 69 6d 65 6e 73 69 6f 6e 73 2e 20 54 68 65 20  dimensions. The 
1500: 53 52 49 44 20 66 6f 72 20 74 68 69 73 20 47 65  SRID for this Ge
1510: 6f 6d 65 74 72 79 20 3c 62 3e 6d 75 73 74 3c 2f  ometry <b>must</
1520: 62 3e 20 62 65 20 3c 62 3e 34 33 32 36 3c 2f 62  b> be <b>4326</b
1530: 3e 20 28 61 6c 69 61 73 20 3c 62 3e 57 47 53 20  > (alias <b>WGS 
1540: 38 34 3c 2f 62 3e 29 2c 20 77 68 69 63 68 20 69  84</b>), which i
1550: 73 20 3c 62 3e 61 6c 77 61 79 73 3c 2f 62 3e 20  s <b>always</b> 
1560: 75 73 65 64 20 77 69 74 68 20 47 50 53 20 64 61  used with GPS da
1570: 74 61 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 57 69 74  ta.<br><br>..Wit
1580: 68 20 74 68 69 73 2c 20 77 65 20 63 61 6e 20 69  h this, we can i
1590: 6e 76 6f 6b 65 20 74 68 65 20 6e 65 77 20 3c 62  nvoke the new <b
15a0: 3e 58 42 5f 4d 4c 69 6e 65 46 72 6f 6d 47 50 58  >XB_MLineFromGPX
15b0: 28 29 3c 2f 62 3e 20 53 51 4c 20 66 75 6e 63 74  ()</b> SQL funct
15c0: 69 6f 6e 20 77 68 69 63 68 20 77 69 6c 6c 20 70  ion which will p
15d0: 61 72 73 65 20 74 68 65 20 47 50 58 20 69 6e 70  arse the GPX inp
15e0: 75 74 2c 20 70 6f 73 73 69 62 6c 79 20 63 72 65  ut, possibly cre
15f0: 61 74 69 6e 67 20 61 20 4d 75 6c 74 69 4c 69 6e  ating a MultiLin
1600: 65 73 74 72 69 6e 67 20 63 6f 72 72 65 73 70 6f  estring correspo
1610: 6e 64 69 6e 67 20 74 6f 20 61 6c 6c 20 6f 66 20  nding to all of 
1620: 74 68 65 20 54 72 61 63 6b 2d 53 65 67 6d 65 6e  the Track-Segmen
1630: 74 73 20 64 65 66 69 6e 65 64 20 69 6e 20 74 68  ts defined in th
1640: 65 20 47 50 58 2d 46 69 6c 65 2e 3c 62 72 3e 0d  e GPX-File.<br>.
1650: 0a 50 6c 65 61 73 65 20 6e 6f 74 65 3a 0d 0a 3c  .Please note:..<
1660: 75 6c 3e 0d 0a 3c 6c 69 3e 58 42 5f 4d 4c 69 6e  ul>..<li>XB_MLin
1670: 65 46 72 6f 6d 47 50 58 28 29 20 77 69 6c 6c 20  eFromGPX() will 
1680: 72 65 74 75 72 6e 20 3c 62 3e 4e 55 4c 4c 3c 2f  return <b>NULL</
1690: 62 3e 20 69 66 20 65 69 74 68 65 72 20 74 68 65  b> if either the
16a0: 20 70 61 73 73 65 64 20 61 72 67 75 6d 65 6e 74   passed argument
16b0: 20 69 73 20 6e 6f 74 20 61 20 76 61 6c 69 64 20   is not a valid 
16c0: 42 4c 4f 42 2c 20 6f 72 20 69 74 27 73 20 61 20  BLOB, or it's a 
16d0: 76 61 6c 69 64 20 42 4c 4f 42 20 62 75 74 20 6e  valid BLOB but n
16e0: 6f 74 20 6f 66 20 74 68 65 20 47 50 58 20 74 79  ot of the GPX ty
16f0: 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 58 42  pe.</li>..<li>XB
1700: 5f 4d 4c 69 6e 65 46 72 6f 6d 47 50 58 28 29 20  _MLineFromGPX() 
1710: 77 69 6c 6c 20 72 65 74 75 72 6e 20 61 20 3c 62  will return a <b
1720: 3e 4e 55 4c 4c 3c 2f 62 3e 20 76 61 6c 75 65 2c  >NULL</b> value,
1730: 20 69 66 20 69 74 20 64 6f 65 73 20 6e 6f 74 20   if it does not 
1740: 63 6f 6e 74 61 69 6e 73 20 61 6e 79 20 54 72 61  contains any Tra
1750: 63 6b 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 77  cks.</li>..<li>w
1760: 68 65 6e 20 73 75 63 63 65 73 73 66 75 6c 2c 20  hen successful, 
1770: 74 68 65 20 72 65 74 75 72 6e 65 64 20 47 65 6f  the returned Geo
1780: 6d 65 74 72 79 20 77 69 6c 6c 20 61 6c 77 61 79  metry will alway
1790: 73 20 62 65 20 61 20 4d 75 6c 74 69 4c 69 6e 65  s be a MultiLine
17a0: 73 74 72 69 6e 67 2c 20 61 6e 64 20 61 20 64 69  string, and a di
17b0: 73 74 69 6e 63 74 20 4c 69 6e 65 73 74 72 69 6e  stinct Linestrin
17c0: 67 20 77 69 6c 6c 20 62 65 20 63 72 65 61 74 65  g will be create
17d0: 64 20 69 6e 73 69 64 65 20 66 6f 72 20 65 76 65  d inside for eve
17e0: 72 79 20 3c 62 3e 54 72 61 63 6b 20 53 65 67 6d  ry <b>Track Segm
17f0: 65 6e 74 3c 2f 62 3e 20 66 6f 75 6e 64 20 77 69  ent</b> found wi
1800: 74 68 69 6e 20 74 68 65 20 47 50 58 2d 46 69 6c  thin the GPX-Fil
1810: 65 2e 3c 62 72 3e 0d 0a 45 61 63 68 20 3c 62 3e  e.<br>..Each <b>
1820: 54 72 61 6b 50 6f 69 6e 74 3c 2f 62 3e 20 77 69  TrakPoint</b> wi
1830: 6c 6c 20 63 6f 72 72 65 73 70 6f 6e 64 20 74 6f  ll correspond to
1840: 20 61 20 56 65 72 74 65 78 20 6f 66 20 74 68 65   a Vertex of the
1850: 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 4c   corresponding L
1860: 69 6e 65 73 74 72 69 6e 67 0d 0a 3c 75 6c 3e 0d  inestring..<ul>.
1870: 0a 3c 6c 69 3e 74 68 65 20 3c 62 3e 58 3c 2f 62  .<li>the <b>X</b
1880: 3e 20 61 6e 64 20 3c 62 3e 59 3c 2f 62 3e 20 63  > and <b>Y</b> c
1890: 6f 6f 72 64 69 6e 61 74 65 73 20 6f 66 20 74 68  oordinates of th
18a0: 65 20 56 65 72 74 65 78 20 77 69 6c 6c 20 62 65  e Vertex will be
18b0: 20 73 65 74 20 61 63 63 6f 72 64 69 6e 67 6c 79   set accordingly
18c0: 20 74 6f 20 74 68 65 20 64 65 63 6c 61 72 65 64   to the declared
18d0: 20 3c 62 3e 3c 69 3e 6c 6f 6e 3c 2f 69 3e 3c 2f   <b><i>lon</i></
18e0: 62 3e 20 61 6e 64 20 3c 62 3e 3c 69 3e 6c 61 74  b> and <b><i>lat
18f0: 3c 2f 69 3e 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a  </i></b>.</li>..
1900: 3c 6c 69 3e 69 66 20 61 6e 20 3c 62 3e 3c 69 3e  <li>if an <b><i>
1910: 65 6c 65 3c 2f 69 3e 3c 2f 62 3e 20 74 61 67 20  ele</i></b> tag 
1920: 77 61 73 20 64 65 63 6c 61 72 65 64 20 74 68 65  was declared the
1930: 20 3c 62 3e 5a 3c 2f 62 3e 20 63 6f 6f 72 64 69   <b>Z</b> coordi
1940: 6e 61 74 65 20 77 69 6c 6c 20 62 65 20 73 65 74  nate will be set
1950: 20 74 6f 20 74 68 65 20 63 6f 72 72 65 73 70 6f   to the correspo
1960: 6e 64 69 6e 67 20 76 61 6c 75 65 2e 3c 62 72 3e  nding value.<br>
1970: 0d 0a 4f 74 68 65 72 77 69 73 65 20 74 68 65 20  ..Otherwise the 
1980: 3c 62 3e 5a 3c 2f 62 3e 20 63 6f 6f 72 64 69 6e  <b>Z</b> coordin
1990: 61 74 65 20 77 69 6c 6c 20 62 65 20 73 65 74 20  ate will be set 
19a0: 74 6f 20 3c 62 3e 30 2e 30 3c 2f 62 3e 20 28 64  to <b>0.0</b> (d
19b0: 65 66 61 75 6c 74 20 76 61 6c 75 65 29 2e 3c 2f  efault value).</
19c0: 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 61 20 3c 62  li>..<li>if a <b
19d0: 3e 3c 69 3e 74 69 6d 65 3c 2f 69 3e 3c 2f 62 3e  ><i>time</i></b>
19e0: 20 74 61 67 20 77 61 73 20 64 65 63 6c 61 72 65   tag was declare
19f0: 64 2c 20 74 68 65 20 49 53 4f 20 38 36 30 31 20  d, the ISO 8601 
1a00: 74 69 6d 65 73 74 61 6d 70 20 77 69 6c 6c 20 62  timestamp will b
1a10: 65 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 69 6e  e transformed in
1a20: 74 6f 20 61 20 3c 61 20 68 72 65 66 3d 22 68 74  to a <a href="ht
1a30: 74 70 73 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 64  tps://en.wikiped
1a40: 69 61 2e 6f 72 67 2f 77 69 6b 69 2f 4a 75 6c 69  ia.org/wiki/Juli
1a50: 61 6e 5f 64 61 79 22 3e 6a 75 6c 69 61 6e 20 64  an_day">julian d
1a60: 61 79 20 6e 75 6d 62 65 72 3c 2f 61 3e 2c 20 61  ay number</a>, a
1a70: 6e 64 20 74 68 65 20 3c 62 3e 4d 3c 2f 62 3e 20  nd the <b>M</b> 
1a80: 63 6f 6f 72 64 69 6e 61 74 65 20 77 69 6c 6c 20  coordinate will 
1a90: 62 65 20 73 65 74 20 74 6f 20 74 68 65 20 63 6f  be set to the co
1aa0: 72 72 65 73 70 6f 6e 64 69 6e 67 20 76 61 6c 75  rresponding valu
1ab0: 65 2e 3c 62 72 3e 0d 0a 4f 74 68 65 72 77 69 73  e.<br>..Otherwis
1ac0: 65 20 74 68 65 20 3c 62 3e 4d 3c 2f 62 3e 20 63  e the <b>M</b> c
1ad0: 6f 6f 72 64 69 6e 61 74 65 20 77 69 6c 6c 20 62  oordinate will b
1ae0: 65 20 73 65 74 20 74 6f 20 3c 62 3e 31 37 32 31  e set to <b>1721
1af0: 30 35 39 2e 35 3c 2f 62 3e 2c 20 74 68 69 73 20  059.5</b>, this 
1b00: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f  corresponding to
1b10: 20 3c 62 3e 30 30 30 30 2d 30 31 2d 30 31 54 30   <b>0000-01-01T0
1b20: 30 3a 30 30 3a 30 30 5a 3c 2f 62 3e 20 28 64 65  0:00:00Z</b> (de
1b30: 66 61 75 6c 74 20 76 61 6c 75 65 29 2e 3c 2f 6c  fault value).</l
1b40: 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 6c 69 3e  i>..</ul>..</li>
1b50: 20 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 68   ..</ul><br>..<h
1b60: 72 3e 0d 0a 3c 68 32 3e 43 68 65 63 6b 69 6e 67  r>..<h2>Checking
1b70: 20 74 68 65 20 69 6d 70 6f 72 74 65 64 20 54 72   the imported Tr
1b80: 61 63 6b 50 6f 69 6e 74 73 3c 2f 68 32 3e 0d 0a  ackPoints</h2>..
1b90: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45  <verbatim>..SELE
1ba0: 43 54 20 27 50 6f 69 6e 74 20 23 31 27 20 41 53  CT 'Point #1' AS
1bb0: 20 70 6f 69 6e 74 2c 20 53 54 5f 58 28 61 2e 70   point, ST_X(a.p
1bc0: 74 29 20 41 53 20 6c 6f 6e 2c 20 53 54 5f 59 28  t) AS lon, ST_Y(
1bd0: 61 2e 70 74 29 20 41 53 20 6c 61 74 2c 20 53 54  a.pt) AS lat, ST
1be0: 5f 5a 28 61 2e 70 74 29 20 41 53 20 65 6c 65 2c  _Z(a.pt) AS ele,
1bf0: 20 44 61 74 65 54 69 6d 65 28 53 54 5f 4d 28 61   DateTime(ST_M(a
1c00: 2e 70 74 29 29 20 41 53 20 74 69 6d 65 0d 0a 46  .pt)) AS time..F
1c10: 52 4f 4d 20 28 53 45 4c 45 43 54 20 53 54 5f 53  ROM (SELECT ST_S
1c20: 74 61 72 74 50 6f 69 6e 74 28 67 65 6f 6d 29 20  tartPoint(geom) 
1c30: 41 53 20 70 74 20 46 52 4f 4d 20 67 70 78 5f 74  AS pt FROM gpx_t
1c40: 72 61 63 6b 73 29 20 41 53 20 61 0d 0a 55 4e 49  racks) AS a..UNI
1c50: 4f 4e 0d 0a 53 45 4c 45 43 54 20 27 50 6f 69 6e  ON..SELECT 'Poin
1c60: 74 20 23 32 27 20 41 53 20 70 6f 69 6e 74 2c 20  t #2' AS point, 
1c70: 53 54 5f 58 28 61 2e 70 74 29 20 41 53 20 6c 6f  ST_X(a.pt) AS lo
1c80: 6e 2c 20 53 54 5f 59 28 61 2e 70 74 29 20 41 53  n, ST_Y(a.pt) AS
1c90: 20 6c 61 74 2c 20 53 54 5f 5a 28 61 2e 70 74 29   lat, ST_Z(a.pt)
1ca0: 20 41 53 20 65 6c 65 2c 20 44 61 74 65 54 69 6d   AS ele, DateTim
1cb0: 65 28 53 54 5f 4d 28 61 2e 70 74 29 29 20 41 53  e(ST_M(a.pt)) AS
1cc0: 20 74 69 6d 65 0d 0a 46 52 4f 4d 20 28 53 45 4c   time..FROM (SEL
1cd0: 45 43 54 20 53 54 5f 50 6f 69 6e 74 4e 28 67 65  ECT ST_PointN(ge
1ce0: 6f 6d 2c 20 32 29 20 41 53 20 70 74 20 46 52 4f  om, 2) AS pt FRO
1cf0: 4d 20 67 70 78 5f 74 72 61 63 6b 73 29 20 41 53  M gpx_tracks) AS
1d00: 20 61 0d 0a 55 4e 49 4f 4e 0d 0a 53 45 4c 45 43   a..UNION..SELEC
1d10: 54 20 27 50 6f 69 6e 74 20 23 33 27 20 41 53 20  T 'Point #3' AS 
1d20: 70 6f 69 6e 74 2c 20 53 54 5f 58 28 61 2e 70 74  point, ST_X(a.pt
1d30: 29 20 41 53 20 6c 6f 6e 2c 20 53 54 5f 59 28 61  ) AS lon, ST_Y(a
1d40: 2e 70 74 29 20 41 53 20 6c 61 74 2c 20 53 54 5f  .pt) AS lat, ST_
1d50: 5a 28 61 2e 70 74 29 20 41 53 20 65 6c 65 2c 20  Z(a.pt) AS ele, 
1d60: 44 61 74 65 54 69 6d 65 28 53 54 5f 4d 28 61 2e  DateTime(ST_M(a.
1d70: 70 74 29 29 20 41 53 20 74 69 6d 65 0d 0a 46 52  pt)) AS time..FR
1d80: 4f 4d 20 28 53 45 4c 45 43 54 20 53 54 5f 50 6f  OM (SELECT ST_Po
1d90: 69 6e 74 4e 28 67 65 6f 6d 2c 20 33 29 20 41 53  intN(geom, 3) AS
1da0: 20 70 74 20 46 52 4f 4d 20 67 70 78 5f 74 72 61   pt FROM gpx_tra
1db0: 63 6b 73 29 20 41 53 20 61 0d 0a 55 4e 49 4f 4e  cks) AS a..UNION
1dc0: 0d 0a 53 45 4c 45 43 54 20 27 50 6f 69 6e 74 20  ..SELECT 'Point 
1dd0: 23 4e 27 20 41 53 20 70 6f 69 6e 74 2c 20 53 54  #N' AS point, ST
1de0: 5f 58 28 61 2e 70 74 29 20 41 53 20 6c 6f 6e 2c  _X(a.pt) AS lon,
1df0: 20 53 54 5f 59 28 61 2e 70 74 29 20 41 53 20 6c   ST_Y(a.pt) AS l
1e00: 61 74 2c 20 53 54 5f 5a 28 61 2e 70 74 29 20 41  at, ST_Z(a.pt) A
1e10: 53 20 65 6c 65 2c 20 44 61 74 65 54 69 6d 65 28  S ele, DateTime(
1e20: 53 54 5f 4d 28 61 2e 70 74 29 29 20 41 53 20 74  ST_M(a.pt)) AS t
1e30: 69 6d 65 0d 0a 46 52 4f 4d 20 28 53 45 4c 45 43  ime..FROM (SELEC
1e40: 54 20 53 54 5f 45 6e 64 50 6f 69 6e 74 28 67 65  T ST_EndPoint(ge
1e50: 6f 6d 29 20 41 53 20 70 74 20 46 52 4f 4d 20 67  om) AS pt FROM g
1e60: 70 78 5f 74 72 61 63 6b 73 29 20 41 53 20 61 3b  px_tracks) AS a;
1e70: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c  ..</verbatim>..<
1e80: 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23  table bgcolor="#
1e90: 64 30 66 66 62 30 22 20 63 65 6c 6c 73 70 61 63  d0ffb0" cellspac
1ea0: 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64  ing="4" cellpadd
1eb0: 69 6e 67 3d 22 34 22 20 62 6f 72 64 65 72 3d 22  ing="4" border="
1ec0: 31 22 3e 0d 0a 3c 74 72 3e 3c 74 64 20 62 67 63  1">..<tr><td bgc
1ed0: 6f 6c 6f 72 3d 22 23 63 30 64 64 61 6f 22 3e 3c  olor="#c0ddao"><
1ee0: 62 3e 70 6f 69 6e 74 3c 2f 62 3e 3c 2f 74 64 3e  b>point</b></td>
1ef0: 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 63 30  <td bgcolor="#c0
1f00: 64 64 61 6f 22 3e 3c 62 3e 6c 6f 6e 3c 2f 62 3e  ddao"><b>lon</b>
1f10: 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f 72  </td><td bgcolor
1f20: 3d 22 23 63 30 64 64 61 6f 22 3e 3c 62 3e 6c 61  ="#c0ddao"><b>la
1f30: 74 3c 2f 62 3e 3c 2f 74 64 3e 3c 74 64 20 62 67  t</b></td><td bg
1f40: 63 6f 6c 6f 72 3d 22 23 63 30 64 64 61 6f 22 3e  color="#c0ddao">
1f50: 3c 62 3e 65 6c 65 3c 2f 62 3e 3c 2f 74 64 3e 3c  <b>ele</b></td><
1f60: 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 63 30 64  td bgcolor="#c0d
1f70: 64 61 6f 22 3e 3c 62 3e 74 69 6d 65 3c 2f 62 3e  dao"><b>time</b>
1f80: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e  </td></tr>..<tr>
1f90: 3c 74 64 3e 50 6f 69 6e 74 20 23 31 3c 2f 74 64  <td>Point #1</td
1fa0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68  ><td align="righ
1fb0: 74 22 3e 33 37 2e 38 30 38 32 35 30 3c 2f 74 64  t">37.808250</td
1fc0: 3e 3c 74 64 20 61 6c 6f 67 6e 3d 22 72 69 67 68  ><td alogn="righ
1fd0: 74 22 3e 35 35 2e 37 35 33 35 37 32 3c 2f 74 64  t">55.753572</td
1fe0: 3e 3c 74 64 3e 31 33 35 2e 30 30 30 30 30 30 3c  ><td>135.000000<
1ff0: 2f 74 64 3e 3c 74 64 3e 32 30 30 39 2d 30 35 2d  /td><td>2009-05-
2000: 31 39 20 30 34 3a 30 30 3a 33 30 3c 2f 74 64 3e  19 04:00:30</td>
2010: 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 50  </tr>..<tr><td>P
2020: 6f 69 6e 74 20 23 32 3c 2f 74 64 3e 3c 74 64 20  oint #2</td><td 
2030: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 33 37  align="right">37
2040: 2e 38 30 38 32 35 35 3c 2f 74 64 3e 3c 74 64 20  .808255</td><td 
2050: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 35 35  align="right">55
2060: 2e 37 35 33 36 32 32 3c 2f 74 64 3e 3c 74 64 20  .753622</td><td 
2070: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 33  align="right">13
2080: 35 2e 30 30 30 30 30 30 3c 2f 74 64 3e 3c 74 64  5.000000</td><td
2090: 3e 32 30 30 39 2d 30 35 2d 31 39 20 30 34 3a 30  >2009-05-19 04:0
20a0: 30 3a 33 31 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a  0:31</td></tr>..
20b0: 3c 74 72 3e 3c 74 64 3e 50 6f 69 6e 74 20 23 33  <tr><td>Point #3
20c0: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
20d0: 72 69 67 68 74 22 3e 33 37 2e 38 30 38 31 35 38  right">37.808158
20e0: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
20f0: 72 69 67 68 74 22 3e 35 35 2e 37 35 33 35 39 33  right">55.753593
2100: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
2110: 72 69 67 68 74 22 3e 31 33 35 2e 30 30 30 30 30  right">135.00000
2120: 30 3c 2f 74 64 3e 3c 74 64 3e 32 30 30 39 2d 30  0</td><td>2009-0
2130: 35 2d 31 39 20 30 34 3a 30 30 3a 33 32 3c 2f 74  5-19 04:00:32</t
2140: 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64  d></tr>..<tr><td
2150: 3e 50 6f 69 6e 74 20 23 4e 3c 2f 74 64 3e 3c 74  >Point #N</td><t
2160: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
2170: 33 37 2e 36 37 37 38 30 32 3c 2f 74 64 3e 3c 74  37.677802</td><t
2180: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
2190: 35 35 2e 37 35 38 31 37 37 3c 2f 74 64 3e 3c 74  55.758177</td><t
21a0: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
21b0: 31 35 32 2e 30 30 30 30 30 30 3c 2f 74 64 3e 3c  152.000000</td><
21c0: 74 64 3e 32 30 30 39 2d 30 35 2d 31 39 20 30 34  td>2009-05-19 04
21d0: 3a 34 36 3a 32 37 3c 2f 74 64 3e 3c 2f 74 72 3e  :46:27</td></tr>
21e0: 0d 0a 3c 2f 74 61 62 6c 65 3e 3c 62 72 3e 0d 0a  ..</table><br>..
21f0: 41 73 20 79 6f 75 20 63 61 6e 20 65 61 73 69 6c  As you can easil
2200: 79 20 73 65 65 2c 20 74 68 65 20 4d 75 6c 74 69  y see, the Multi
2210: 4c 69 6e 65 73 74 72 69 6e 67 20 58 59 5a 4d 20  Linestring XYZM 
2220: 72 65 74 75 72 6e 65 64 20 62 79 20 3c 62 3e 58  returned by <b>X
2230: 42 5f 4d 4c 69 6e 65 46 72 6f 6d 47 50 58 28 29  B_MLineFromGPX()
2240: 3c 2f 62 3e 20 66 61 69 74 68 66 75 6c 6c 79 20  </b> faithfully 
2250: 70 72 65 73 65 72 76 65 73 20 62 6f 74 68 20 74  preserves both t
2260: 68 65 20 73 70 61 74 69 61 6c 20 63 6f 6f 72 64  he spatial coord
2270: 69 6e 61 74 65 73 20 61 6e 64 20 74 68 65 20 74  inates and the t
2280: 69 6d 65 73 74 61 6d 70 73 20 6f 72 69 67 69 6e  imestamps origin
2290: 61 6c 6c 79 20 72 65 67 69 73 74 65 72 65 64 20  ally registered 
22a0: 62 79 20 74 68 65 20 47 50 53 20 73 65 6e 73 6f  by the GPS senso
22b0: 72 2e 0d 0a 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 74  r...<br><br>..<t
22c0: 61 62 6c 65 20 77 69 64 74 68 3d 22 31 30 30 25  able width="100%
22d0: 22 3e 3c 74 72 3e 0d 0a 3c 74 64 20 77 69 64 74  "><tr>..<td widt
22e0: 68 3d 22 33 33 25 22 20 61 6c 69 67 6e 3d 22 6c  h="33%" align="l
22f0: 65 66 74 22 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20  eft"></td>..<td 
2300: 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 3c  align="center"><
2310: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f  a href="https://
2320: 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f  www.gaia-gis.it/
2330: 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61  fossil/libspatia
2340: 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 6d  lite/wiki?name=m
2350: 69 73 63 2d 64 6f 63 73 22 3e 62 61 63 6b 20 74  isc-docs">back t
2360: 6f 20 69 6e 64 65 78 3c 2f 61 3e 3c 2f 74 64 3e  o index</a></td>
2370: 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33 25  ..<td width="33%
2380: 22 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  " align="right">
2390: 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 3c 2f 74 61  </td>..</tr></ta
23a0: 62 6c 65 3e 0a 5a 20 62 64 30 31 33 30 65 31 37  ble>.Z bd0130e17
23b0: 36 31 34 39 33 39 35 65 34 33 62 31 62 30 35 64  6149395e43b1b05d
23c0: 63 39 32 38 34 64 34 0a                          c9284d4.