Hex Artifact Content
Not logged in

Artifact eb4769d3b31190e5253b0df56d0661ff076d744a:

Wiki page [VirtualRouting] by sandro 2018-04-01 12:45:17.
0000: 44 20 32 30 31 38 2d 30 34 2d 30 31 54 31 32 3a  D 2018-04-01T12:
0010: 34 35 3a 31 37 2e 34 33 37 0a 4c 20 56 69 72 74  45:17.437.L Virt
0020: 75 61 6c 52 6f 75 74 69 6e 67 0a 50 20 36 36 31  ualRouting.P 661
0030: 63 63 39 34 39 38 36 62 39 65 30 33 62 34 63 35  cc94986b9e03b4c5
0040: 34 32 66 63 61 65 34 38 33 30 35 30 64 33 37 35  42fcae483050d375
0050: 31 37 32 39 32 0a 55 20 73 61 6e 64 72 6f 0a 57  17292.U sandro.W
0060: 20 31 33 39 36 37 0a 3c 61 20 68 72 65 66 3d 22   13967.<a href="
0070: 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61  https://www.gaia
0080: 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c  -gis.it/fossil/l
0090: 69 62 73 70 61 74 69 61 6c 69 74 65 2f 77 69 6b  ibspatialite/wik
00a0: 69 3f 6e 61 6d 65 3d 34 2e 33 2e 30 2d 64 6f 63  i?name=4.3.0-doc
00b0: 22 3e 62 61 63 6b 3c 2f 61 3e 3c 68 72 3e 3c 62  ">back</a><hr><b
00c0: 72 3e 0d 0a 3c 68 31 3e 49 6e 74 72 6f 64 75 63  r>..<h1>Introduc
00d0: 74 69 6f 6e 3c 2f 68 31 3e 0d 0a 50 72 65 76 69  tion</h1>..Previ
00e0: 6f 75 73 20 76 65 72 73 69 6f 6e 73 20 6f 66 20  ous versions of 
00f0: 53 70 61 74 69 61 4c 69 74 65 20 74 72 61 64 69  SpatiaLite tradi
0100: 74 69 6f 6e 61 6c 6c 79 20 73 75 70 70 6f 72 74  tionally support
0110: 65 64 20 61 20 3c 62 3e 70 75 72 65 20 53 51 4c  ed a <b>pure SQL
0120: 20 72 6f 75 74 69 6e 67 20 6d 6f 64 75 6c 65 3c   routing module<
0130: 2f 62 3e 20 74 68 61 74 20 77 61 73 20 6e 61 6d  /b> that was nam
0140: 65 64 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70  ed <a href="http
0150: 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73  s://www.gaia-gis
0160: 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70  .it/fossil/libsp
0170: 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61  atialite/wiki?na
0180: 6d 65 3d 56 69 72 74 75 61 6c 4e 65 74 77 6f 72  me=VirtualNetwor
0190: 6b 2b 72 65 6c 6f 61 64 65 64 22 3e 56 69 72 74  k+reloaded">Virt
01a0: 75 61 6c 4e 65 74 77 6f 72 6b 3c 2f 61 3e 2e 3c  ualNetwork</a>.<
01b0: 62 72 3e 3c 62 72 3e 0d 0a 53 69 6e 63 65 20 76  br><br>..Since v
01c0: 65 72 73 69 6f 6e 20 3c 62 3e 35 2e 30 2e 30 3c  ersion <b>5.0.0<
01d0: 2f 62 3e 20 61 20 62 72 61 6e 64 20 6e 65 77 20  /b> a brand new 
01e0: 3c 62 3e 72 6f 75 74 69 6e 67 20 6d 6f 64 75 6c  <b>routing modul
01f0: 65 3c 2f 62 3e 20 28 6d 6f 72 65 20 61 64 76 61  e</b> (more adva
0200: 6e 63 65 64 20 61 6e 64 20 73 6f 70 68 69 73 74  nced and sophist
0210: 69 63 61 74 65 64 29 20 69 73 20 61 76 61 69 6c  icated) is avail
0220: 61 62 6c 65 2c 20 74 68 61 74 20 69 73 20 63 61  able, that is ca
0230: 6c 6c 65 64 20 3c 62 3e 56 69 72 74 75 61 6c 52  lled <b>VirtualR
0240: 6f 75 74 69 6e 67 3c 2f 62 3e 2e 3c 62 72 3e 0d  outing</b>.<br>.
0250: 0a 54 68 65 20 6e 6f 77 20 6f 62 73 6f 6c 65 74  .The now obsolet
0260: 65 20 3c 62 3e 56 69 72 74 75 61 6c 4e 65 74 77  e <b>VirtualNetw
0270: 6f 72 6b 3c 2f 62 3e 20 69 73 20 73 74 69 6c 6c  ork</b> is still
0280: 20 73 75 70 70 6f 72 74 65 64 20 62 79 20 76 65   supported by ve
0290: 72 73 69 6f 6e 20 3c 62 3e 35 2e 30 2e 30 3c 2f  rsion <b>5.0.0</
02a0: 62 3e 20 73 6f 20 61 73 20 74 6f 20 6e 6f 74 20  b> so as to not 
02b0: 63 61 75 73 65 20 61 6e 20 61 62 72 75 70 74 20  cause an abrupt 
02c0: 62 72 65 61 6b 20 74 6f 20 61 6c 72 65 61 64 79  break to already
02d0: 20 65 78 69 73 74 69 6e 67 20 61 70 70 6c 69 63   existing applic
02e0: 61 74 69 6f 6e 73 2c 20 62 75 74 20 77 69 6c 6c  ations, but will
02f0: 20 70 72 65 73 75 6d 61 62 6c 79 20 62 65 20 64   presumably be d
0300: 69 73 63 6f 6e 74 69 6e 75 65 64 20 69 6e 20 66  iscontinued in f
0310: 75 74 75 72 65 20 76 65 72 73 69 6f 6e 73 2e 3c  uture versions.<
0320: 62 72 3e 0d 0a 55 73 69 6e 67 20 3c 62 3e 56 69  br>..Using <b>Vi
0330: 72 74 75 61 6c 52 6f 75 74 69 6e 67 3c 2f 62 3e  rtualRouting</b>
0340: 20 69 6e 73 74 65 61 64 20 6f 66 20 3c 62 3e 56   instead of <b>V
0350: 69 72 74 75 61 6c 4e 65 74 77 69 72 6b 3c 2f 62  irtualNetwirk</b
0360: 3e 20 69 73 20 77 61 72 6d 6c 79 20 72 65 63 6f  > is warmly reco
0370: 6d 6d 65 6e 64 65 64 20 66 6f 72 20 61 6e 79 20  mmended for any 
0380: 6e 65 77 20 64 65 76 65 6c 6f 70 6d 65 6e 74 2e  new development.
0390: 20 0d 0a 3c 68 32 3e 54 68 65 6f 72 65 74 69 63   ..<h2>Theoretic
03a0: 61 6c 20 66 6f 75 6e 64 61 74 69 6f 6e 73 20 2d  al foundations -
03b0: 20 61 6e 20 75 6c 74 72 61 2d 71 75 69 63 6b 20   an ultra-quick 
03c0: 72 65 63 61 6c 6c 3c 2f 68 32 3e 0d 0a 41 6c 6c  recall</h2>..All
03d0: 20 3c 62 3e 52 6f 75 74 69 6e 67 20 61 6c 67 6f   <b>Routing algo
03e0: 72 69 74 68 6d 73 3c 2f 62 3e 20 28 3c 69 3e 61  rithms</b> (<i>a
03f0: 6b 61 3c 2f 69 3e 20 3c 62 3e 53 68 6f 72 74 65  ka</i> <b>Shorte
0400: 73 74 20 50 61 74 68 3c 2f 62 3e 20 61 6c 67 6f  st Path</b> algo
0410: 72 69 74 68 6d 73 29 20 61 72 65 20 62 61 73 65  rithms) are base
0420: 64 20 6f 6e 20 74 68 65 20 6d 61 74 68 65 6d 61  d on the mathema
0430: 74 69 63 73 20 6f 66 20 74 68 65 20 3c 61 20 68  tics of the <a h
0440: 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 65 6e 2e  ref="https://en.
0450: 77 69 6b 69 70 65 64 69 61 2e 6f 72 67 2f 77 69  wikipedia.org/wi
0460: 6b 69 2f 47 72 61 70 68 5f 74 68 65 6f 72 79 22  ki/Graph_theory"
0470: 3e 47 72 61 70 68 20 74 68 65 6f 72 79 3c 2f 61  >Graph theory</a
0480: 3e 20 6f 72 20 74 6f 20 62 65 20 6d 6f 72 65 20  > or to be more 
0490: 70 72 65 63 69 73 65 3a 20 6f 6e 20 3c 62 3e 57  precise: on <b>W
04a0: 65 69 67 68 74 65 64 20 47 72 61 70 68 73 3c 2f  eighted Graphs</
04b0: 62 3e 2e 0d 0a 3c 62 72 3e 0d 0a 3c 69 6d 67 20  b>...<br>..<img 
04c0: 73 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e  src="http://www.
04d0: 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61  gaia-gis.it/gaia
04e0: 2d 73 69 6e 73 2f 6e 65 74 77 6f 72 6b 2e 70 6e  -sins/network.pn
04f0: 67 22 20 61 6c 74 3d 22 6e 65 74 77 6f 72 6b 22  g" alt="network"
0500: 3e 0d 0a 3c 62 72 3e 0d 0a 41 20 74 6f 70 6f 6c  >..<br>..A topol
0510: 6f 67 69 63 61 6c 6c 79 20 76 61 6c 69 64 20 3c  ogically valid <
0520: 62 3e 4e 65 74 77 6f 72 6b 3c 2f 62 3e 20 69 73  b>Network</b> is
0530: 20 61 20 64 61 74 61 73 65 74 20 74 68 61 74 20   a dataset that 
0540: 66 75 6c 66 69 6c 6c 73 20 74 68 65 20 66 6f 6c  fulfills the fol
0550: 6c 6f 77 69 6e 67 20 72 65 71 75 69 72 65 6d 65  lowing requireme
0560: 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  nts:..<ul>..<li>
0570: 41 6c 6c 20 69 74 65 6d 73 20 69 6e 20 74 68 65  All items in the
0580: 20 64 61 74 61 73 65 74 20 61 72 65 20 63 61 6c   dataset are cal
0590: 6c 65 64 20 3c 62 3e 4c 69 6e 6b 73 3c 2f 62 3e  led <b>Links</b>
05a0: 20 28 3c 69 3e 61 6b 61 3c 2f 69 3e 20 3c 62 3e   (<i>aka</i> <b>
05b0: 41 72 63 73 3c 2f 62 3e 29 2c 20 61 6e 64 20 61  Arcs</b>), and a
05c0: 72 65 20 65 78 70 65 63 74 65 64 20 74 6f 20 72  re expected to r
05d0: 65 70 72 65 73 65 6e 74 20 73 6f 6d 65 20 6f 72  epresent some or
05e0: 69 65 6e 74 65 64 20 63 6f 6e 6e 65 63 74 69 6f  iented connectio
05f0: 6e 20 6a 6f 69 6e 69 6e 67 20 74 77 6f 20 3c 62  n joining two <b
0600: 3e 4e 6f 64 65 73 3c 2f 62 3e 2e 3c 62 72 3e 0d  >Nodes</b>.<br>.
0610: 0a 3c 75 3e 45 78 61 6d 70 6c 65 3c 2f 75 3e 3a  .<u>Example</u>:
0620: 20 69 6e 20 74 68 65 20 61 62 6f 76 65 20 66 69   in the above fi
0630: 67 75 72 65 20 4c 69 6e 6b 20 3c 62 3e 4c 33 3c  gure Link <b>L3<
0640: 2f 62 3e 20 63 6f 6e 6e 65 63 74 73 20 4e 6f 64  /b> connects Nod
0650: 65 73 20 3c 62 3e 4e 32 3c 2f 62 3e 20 61 6e 64  es <b>N2</b> and
0660: 20 3c 62 3e 4e 35 3c 2f 62 3e 2e 3c 2f 6c 69 3e   <b>N5</b>.</li>
0670: 0d 0a 3c 6c 69 3e 53 6f 20 61 6c 6c 20 3c 62 3e  ..<li>So all <b>
0680: 4c 69 6e 6b 73 3c 2f 62 3e 20 61 72 65 20 61 6c  Links</b> are al
0690: 77 61 79 73 20 65 78 70 65 63 74 65 64 20 74 6f  ways expected to
06a0: 20 65 78 70 6c 69 63 69 74 6c 79 20 72 65 66 65   explicitly refe
06b0: 72 65 6e 63 65 20 61 20 3c 62 3e 53 74 61 72 74  rence a <b>Start
06c0: 2d 4e 6f 64 65 3c 2f 62 3e 20 28 3c 69 3e 61 6b  -Node</b> (<i>ak
06d0: 61 3c 2f 69 3e 20 3c 62 3e 4e 6f 64 65 2d 46 72  a</i> <b>Node-Fr
06e0: 6f 6d 3c 2f 62 3e 29 20 61 6e 64 20 61 6e 20 3c  om</b>) and an <
06f0: 62 3e 45 6e 64 2d 4e 6f 64 65 3c 2f 62 3e 20 28  b>End-Node</b> (
0700: 3c 69 3e 61 6b 61 3c 2f 69 3e 20 3c 62 3e 4e 6f  <i>aka</i> <b>No
0710: 64 65 2d 54 6f 3c 2f 62 3e 29 2e 0d 0a 3c 75 6c  de-To</b>)...<ul
0720: 3e 0d 0a 3c 6c 69 3e 4c 69 6e 6b 73 20 61 72 65  >..<li>Links are
0730: 20 61 6c 77 61 79 73 20 3c 62 3e 6f 72 69 65 6e   always <b>orien
0740: 74 65 64 3c 2f 62 3e 2c 20 61 6e 64 20 74 68 65  ted</b>, and the
0750: 69 72 20 6e 61 74 75 72 61 6c 20 64 69 72 65 63  ir natural direc
0760: 74 69 6f 6e 20 69 73 20 3c 62 3e 46 72 6f 6d 2d  tion is <b>From-
0770: 54 6f 3c 2f 62 3e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c  To</b>:..<ul>..<
0780: 6c 69 3e 69 6e 20 61 6e 20 3c 62 3e 75 6e 69 64  li>in an <b>unid
0790: 69 72 65 63 74 69 6f 6e 61 6c 3c 2f 62 3e 20 4e  irectional</b> N
07a0: 65 74 77 6f 72 6b 20 65 61 63 68 20 4c 69 6e 6b  etwork each Link
07b0: 20 69 73 20 61 6e 20 3c 62 3e 6f 6e 65 2d 77 61   is an <b>one-wa
07c0: 79 3c 2f 62 3e 20 63 6f 6e 6e 65 63 74 69 6f 6e  y</b> connection
07d0: 2e 3c 62 72 3e 0d 0a 49 66 20 74 68 65 20 63 6f  .<br>..If the co
07e0: 6e 6e 65 63 74 69 6f 6e 20 69 73 20 61 76 61 69  nnection is avai
07f0: 6c 61 62 6c 65 20 69 6e 20 74 68 65 20 6f 70 70  lable in the opp
0800: 6f 73 69 74 65 20 64 69 72 65 63 74 69 6f 6e 20  osite direction 
0810: 61 20 73 65 63 6f 6e 64 20 4c 69 6e 6b 20 6d 75  a second Link mu
0820: 73 74 20 62 65 20 65 78 70 6c 69 63 69 74 6c 79  st be explicitly
0830: 20 64 65 63 6c 61 72 65 64 2e 3c 62 72 3e 0d 0a   declared.<br>..
0840: 3c 75 3e 45 78 61 6d 70 6c 65 3c 2f 75 3e 3a 20  <u>Example</u>: 
0850: 4c 69 6e 6b 20 3c 62 3e 58 31 3c 2f 62 3e 20 67  Link <b>X1</b> g
0860: 6f 65 73 20 66 72 6f 6d 20 4e 6f 64 65 20 3c 62  oes from Node <b
0870: 3e 41 3c 2f 62 3e 20 74 6f 20 4e 6f 64 65 20 3c  >A</b> to Node <
0880: 62 3e 42 3c 2f 62 3e 2c 20 61 6e 64 20 4c 69 6e  b>B</b>, and Lin
0890: 6b 20 3c 62 3e 58 32 3c 2f 62 3e 20 67 6f 65 73  k <b>X2</b> goes
08a0: 20 66 72 6f 6d 20 4e 6f 64 65 20 3c 62 3e 42 3c   from Node <b>B<
08b0: 2f 62 3e 20 74 6f 20 4e 6f 64 65 20 3c 62 3e 41  /b> to Node <b>A
08c0: 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  </b>.</li>..<li>
08d0: 69 6e 20 61 20 3c 62 3e 62 69 64 69 72 65 63 74  in a <b>bidirect
08e0: 69 6f 6e 61 6c 3c 2f 62 3e 20 4e 65 74 77 6f 72  ional</b> Networ
08f0: 6b 20 61 6c 6c 20 4c 69 6e 6b 73 20 61 72 65 20  k all Links are 
0900: 61 73 73 75 6d 65 64 20 74 6f 20 65 73 74 61 62  assumed to estab
0910: 6c 69 73 68 20 61 20 63 6f 6e 6e 65 63 74 69 6f  lish a connectio
0920: 6e 20 69 6e 20 62 6f 74 68 20 64 69 72 65 63 74  n in both direct
0930: 69 6f 6e 73 2e 3c 62 72 3e 0d 0a 44 65 66 69 6e  ions.<br>..Defin
0940: 69 74 69 6e 67 20 61 6e 20 3c 62 3e 6f 6e 65 2d  iting an <b>one-
0950: 77 61 79 20 63 6f 6e 6e 65 63 74 69 6f 6e 3c 2f  way connection</
0960: 62 3e 20 72 65 71 75 69 72 65 73 20 61 6e 20 61  b> requires an a
0970: 70 70 72 6f 70 72 69 61 74 65 20 61 74 74 72 69  ppropriate attri
0980: 62 75 74 65 20 74 6f 20 62 65 20 73 65 74 20 28  bute to be set (
0990: 73 65 65 20 62 65 6c 6f 77 29 2e 3c 2f 6c 69 3e  see below).</li>
09a0: 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c  ..</ul></li>..<l
09b0: 69 3e 54 68 65 20 3c 62 3e 53 74 61 72 74 2d 3c  i>The <b>Start-<
09c0: 2f 62 3e 20 61 6e 64 20 3c 62 3e 45 6e 64 2d 4e  /b> and <b>End-N
09d0: 6f 64 65 3c 2f 62 3e 20 63 6f 75 6c 64 20 65 76  ode</b> could ev
09e0: 65 6e 74 75 61 6c 6c 79 20 62 65 20 74 68 65 20  entually be the 
09f0: 73 61 6d 65 2c 20 61 6e 64 20 69 6e 20 74 68 69  same, and in thi
0a00: 73 20 63 61 73 65 20 77 65 27 6c 6c 20 68 61 76  s case we'll hav
0a10: 65 20 61 20 3c 62 3e 73 65 6c 66 2d 63 6c 6f 73  e a <b>self-clos
0a20: 65 64 3c 2f 62 3e 20 4c 69 6e 6b 2e 3c 2f 6c 69  ed</b> Link.</li
0a30: 3e 0d 0a 3c 6c 69 3e 4e 65 74 77 6f 72 6b 27 73  >..<li>Network's
0a40: 20 4c 69 6e 6b 73 20 3c 62 3e 63 61 6e 3c 2f 62   Links <b>can</b
0a50: 3e 20 65 76 65 6e 74 75 61 6c 6c 79 20 64 65 66  > eventually def
0a60: 69 6e 65 20 61 20 6c 69 6e 65 61 72 20 47 65 6f  ine a linear Geo
0a70: 6d 65 74 72 79 20 28 3c 62 3e 4c 49 4e 45 53 54  metry (<b>LINEST
0a80: 52 49 4e 47 3c 2f 62 3e 29 20 67 6f 69 6e 67 20  RING</b>) going 
0a90: 66 72 6f 6d 20 74 68 65 20 3c 62 3e 53 74 61 72  from the <b>Star
0aa0: 74 2d 4e 6f 64 65 3c 2f 62 3e 20 74 6f 20 74 68  t-Node</b> to th
0ab0: 65 20 3c 62 3e 45 6e 64 2d 4e 6f 64 65 3c 2f 62  e <b>End-Node</b
0ac0: 3e 2c 20 62 75 74 20 74 68 69 73 20 69 73 20 61  >, but this is a
0ad0: 6e 20 6f 70 74 69 6f 6e 61 6c 20 66 65 61 74 75  n optional featu
0ae0: 72 65 2c 20 6e 6f 74 20 61 20 6d 61 6e 64 61 74  re, not a mandat
0af0: 6f 72 79 20 72 65 71 75 69 72 65 6d 65 6e 74 2e  ory requirement.
0b00: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 57 68 61 74 20  </li>..<li>What 
0b10: 69 73 20 61 62 73 6f 6c 75 74 65 6c 79 20 6d 61  is absolutely ma
0b20: 6e 64 61 74 6f 72 79 20 69 73 20 74 68 61 74 20  ndatory is that 
0b30: 65 61 63 68 20 3c 62 3e 4c 69 6e 6b 3c 2f 62 3e  each <b>Link</b>
0b40: 20 6d 75 73 74 20 65 78 70 6c 69 63 69 74 6c 79   must explicitly
0b50: 20 72 65 66 65 72 65 6e 63 65 20 69 74 73 20 3c   reference its <
0b60: 62 3e 4e 6f 64 65 73 3c 2f 62 3e 2e 3c 2f 6c 69  b>Nodes</b>.</li
0b70: 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c  >..</ul></li>..<
0b80: 6c 69 3e 41 20 4e 65 74 77 6f 72 6b 20 73 75 70  li>A Network sup
0b90: 70 6f 72 74 69 6e 67 20 47 65 6f 6d 65 74 72 69  porting Geometri
0ba0: 65 73 20 69 73 20 61 20 3c 62 3e 53 70 61 74 69  es is a <b>Spati
0bb0: 61 6c 20 4e 65 74 77 6f 72 6b 3c 2f 62 3e 3b 20  al Network</b>; 
0bc0: 6f 74 68 65 72 77 69 73 65 20 61 20 4e 65 74 77  otherwise a Netw
0bd0: 6f 72 6b 20 6c 61 63 6b 69 6e 67 20 61 6e 79 20  ork lacking any 
0be0: 47 65 6f 6d 65 74 72 79 20 69 73 20 61 20 3c 62  Geometry is a <b
0bf0: 3e 4c 6f 67 69 63 61 6c 20 4e 65 74 77 6f 72 6b  >Logical Network
0c00: 3c 2f 62 3e 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69  </b>...<ul>..<li
0c10: 3e 49 6e 20 61 20 3c 62 3e 53 70 61 74 69 61 6c  >In a <b>Spatial
0c20: 20 4e 65 74 77 6f 72 6b 3c 2f 62 3e 20 61 6c 6c   Network</b> all
0c30: 20 4c 69 6e 6b 73 20 3c 62 3e 6d 75 73 74 3c 2f   Links <b>must</
0c40: 62 3e 20 68 61 76 65 20 61 20 63 6f 72 72 65 73  b> have a corres
0c50: 70 6f 6e 64 69 6e 67 20 47 65 6f 6d 65 74 72 79  ponding Geometry
0c60: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 49 6e 20 61  .</li>..<li>In a
0c70: 20 3c 62 3e 4c 6f 67 69 63 61 6c 20 4e 65 74 77   <b>Logical Netw
0c80: 6f 72 6b 3c 2f 62 3e 20 61 6c 6c 20 4c 69 6e 6b  ork</b> all Link
0c90: 73 20 3c 62 3e 61 72 65 20 73 74 72 69 63 74 6c  s <b>are strictl
0ca0: 79 20 66 6f 72 62 69 64 64 65 6e 3c 2f 62 3e 20  y forbidden</b> 
0cb0: 74 6f 20 68 61 76 65 20 61 6e 79 20 47 65 6f 6d  to have any Geom
0cc0: 65 74 72 79 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  etry.</li>..<li>
0cd0: 49 6e 20 61 20 3c 62 3e 53 70 61 74 69 61 6c 20  In a <b>Spatial 
0ce0: 4e 65 74 77 6f 72 6b 3c 2f 62 3e 20 62 6f 74 68  Network</b> both
0cf0: 20 74 68 65 20 3c 62 3e 53 74 61 72 74 50 6f 69   the <b>StartPoi
0d00: 6e 74 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 45 6e  nt</b> and <b>En
0d10: 64 50 6f 69 6e 74 3c 2f 62 3e 20 6f 66 20 65 61  dPoint</b> of ea
0d20: 63 68 20 4c 69 6e 6b 27 73 20 3c 62 3e 4c 49 4e  ch Link's <b>LIN
0d30: 45 53 54 52 49 4e 47 3c 2f 62 3e 20 61 72 65 20  ESTRING</b> are 
0d40: 61 6c 77 61 79 73 20 65 78 70 65 63 74 65 64 20  always expected 
0d50: 74 6f 20 65 78 61 63 74 6c 79 20 63 6f 69 6e 63  to exactly coinc
0d60: 69 64 65 20 77 69 74 68 20 74 68 65 20 63 6f 72  ide with the cor
0d70: 72 65 73 70 6f 6e 64 69 6e 67 20 3c 62 3e 4e 6f  responding <b>No
0d80: 64 65 73 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c  des</b>.</li>..<
0d90: 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 49  /ul></li>..<li>I
0da0: 6e 20 61 20 3c 62 3e 53 70 61 74 69 61 6c 20 4e  n a <b>Spatial N
0db0: 65 74 77 6f 72 6b 3c 2f 62 3e 20 61 6c 6c 20 72  etwork</b> all r
0dc0: 65 66 65 72 65 6e 63 65 73 20 74 6f 20 74 68 65  eferences to the
0dd0: 20 73 61 6d 65 20 3c 62 3e 4e 6f 64 65 3c 2f 62   same <b>Node</b
0de0: 3e 20 62 79 20 64 69 66 66 65 72 65 6e 74 20 4c  > by different L
0df0: 69 6e 6b 73 20 3c 62 3e 6d 75 73 74 3c 2f 62 3e  inks <b>must</b>
0e00: 20 62 65 20 61 6e 20 65 78 61 63 74 20 6d 61 74   be an exact mat
0e10: 63 68 2e 3c 62 72 3e 0d 0a 3c 75 3e 45 78 61 6d  ch.<br>..<u>Exam
0e20: 70 6c 65 3c 2f 75 3e 3a 20 4e 6f 64 65 20 3c 62  ple</u>: Node <b
0e30: 3e 4e 35 3c 2f 62 3e 20 69 73 20 73 68 61 72 65  >N5</b> is share
0e40: 64 20 62 79 20 4c 69 6e 6b 73 20 3c 62 3e 4c 33  d by Links <b>L3
0e50: 3c 2f 62 3e 2c 20 3c 62 3e 4c 36 3c 2f 62 3e 2c  </b>, <b>L6</b>,
0e60: 20 3c 62 3e 4c 37 3c 2f 62 3e 2c 20 3c 62 3e 4c   <b>L7</b>, <b>L
0e70: 39 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 4c 31 30  9</b> and <b>L10
0e80: 3c 2f 62 3e 2c 20 73 6f 20 61 6c 6c 20 74 68 65  </b>, so all the
0e90: 69 72 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67  ir corresponding
0ea0: 20 4c 49 4e 45 53 54 52 49 4e 47 53 20 61 72 65   LINESTRINGS are
0eb0: 20 65 78 70 65 63 74 65 64 20 74 6f 20 68 61 76   expected to hav
0ec0: 65 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64  e the correspond
0ed0: 69 6e 67 20 65 78 74 72 65 6d 69 74 79 20 28 3c  ing extremity (<
0ee0: 62 3e 53 74 61 72 74 2d 3c 2f 62 3e 20 6f 72 20  b>Start-</b> or 
0ef0: 3c 62 3e 45 6e 64 2d 3c 2f 62 3e 2c 20 64 65 70  <b>End-</b>, dep
0f00: 65 6e 64 69 6e 67 20 6f 6e 20 74 68 65 20 6f 72  ending on the or
0f10: 69 65 6e 74 61 74 69 6f 6e 29 20 70 6f 69 6e 74  ientation) point
0f20: 73 20 74 68 61 74 20 6d 75 73 74 20 65 78 61 63  s that must exac
0f30: 74 6c 79 20 6d 61 74 63 68 20 74 68 65 20 6f 74  tly match the ot
0f40: 68 65 72 2e 3c 62 72 3e 0d 0a 41 20 3c 62 3e 74  her.<br>..A <b>t
0f50: 6f 70 6f 6c 6f 67 69 63 61 6c 20 69 6e 63 6f 6e  opological incon
0f60: 73 69 73 74 65 6e 63 79 3c 2f 62 3e 20 65 78 69  sistency</b> exi
0f70: 73 74 73 20 69 66 20 61 6e 79 20 6f 66 20 74 68  sts if any of th
0f80: 65 73 65 20 63 6f 6e 64 69 74 69 6f 6e 73 20 61  ese conditions a
0f90: 72 65 20 6e 6f 74 20 73 61 74 69 73 66 69 65 64  re not satisfied
0fa0: 2c 20 77 68 69 63 68 20 6c 65 61 64 73 20 74 6f  , which leads to
0fb0: 20 61 6e 20 3c 62 3e 69 6e 76 61 6c 69 64 3c 2f   an <b>invalid</
0fc0: 62 3e 20 4e 65 74 77 6f 72 6b 2e 3c 2f 6c 69 3e  b> Network.</li>
0fd0: 0d 0a 3c 6c 69 3e 49 6e 20 61 20 3c 62 3e 53 70  ..<li>In a <b>Sp
0fe0: 61 74 69 61 6c 20 4e 65 74 77 6f 72 6b 3c 2f 62  atial Network</b
0ff0: 3e 20 74 77 6f 0d 0a 3c 6c 69 3e 41 63 63 6f 72  > two..<li>Accor
1000: 64 69 6e 67 6c 79 20 74 6f 20 74 68 65 20 61 62  dingly to the ab
1010: 6f 76 65 20 70 72 65 6d 69 73 65 73 2c 20 3c 62  ove premises, <b
1020: 3e 4e 6f 64 65 73 3c 2f 62 3e 20 61 72 65 20 6e  >Nodes</b> are n
1030: 65 76 65 72 20 65 78 70 65 63 74 65 64 20 74 6f  ever expected to
1040: 20 62 65 20 65 78 70 6c 69 63 69 74 6c 79 20 64   be explicitly d
1050: 65 63 6c 61 72 65 64 20 69 6e 20 61 20 73 65 70  eclared in a sep
1060: 61 72 61 74 65 20 54 61 62 6c 65 2e 3c 62 72 3e  arate Table.<br>
1070: 0d 0a 4a 75 73 74 20 61 20 73 69 6e 67 6c 65 20  ..Just a single 
1080: 54 61 62 6c 65 20 64 65 63 6c 61 72 69 6e 67 20  Table declaring 
1090: 61 6c 6c 20 3c 62 3e 4c 69 6e 6b 73 3c 2f 62 3e  all <b>Links</b>
10a0: 20 69 73 20 72 65 71 75 69 72 65 64 20 69 6e 20   is required in 
10b0: 6f 72 64 65 72 20 74 6f 20 66 75 6c 6c 79 20 64  order to fully d
10c0: 65 66 69 6e 65 20 61 20 74 6f 70 6f 6c 6f 67 69  efine a topologi
10d0: 63 61 6c 6c 79 20 76 61 6c 69 64 20 4e 65 74 77  cally valid Netw
10e0: 6f 72 6b 2e 3c 62 72 3e 0d 0a 41 6c 6c 20 74 68  ork.<br>..All th
10f0: 65 20 4e 6f 64 65 73 20 63 61 6e 20 74 68 65 6e  e Nodes can then
1100: 20 62 65 20 65 61 73 69 6c 79 20 65 78 74 72 61   be easily extra
1110: 63 74 65 64 20 66 72 6f 6d 20 74 68 65 20 4c 69  cted from the Li
1120: 6e 6b 73 27 20 64 65 66 69 6e 69 74 69 6f 6e 73  nks' definitions
1130: 20 61 6e 64 20 74 68 65 20 63 6f 6f 72 64 69 6e   and the coordin
1140: 61 74 65 73 20 66 6f 72 20 65 61 63 68 20 4e 6f  ates for each No
1150: 64 65 20 63 61 6e 20 62 65 20 64 69 72 65 63 74  de can be direct
1160: 6c 79 20 73 65 74 20 62 79 20 65 78 74 72 61 63  ly set by extrac
1170: 74 69 6e 67 20 74 68 65 20 65 78 74 72 65 6d 65  ting the extreme
1180: 20 50 6f 69 6e 74 20 6f 66 20 74 68 65 20 63 6f   Point of the co
1190: 72 72 65 73 70 6f 6e 64 69 6e 67 20 4c 69 6e 65  rresponding Line
11a0: 73 74 72 69 6e 67 73 2e 3c 62 72 3e 0d 0a 49 66  strings.<br>..If
11b0: 20 61 6e 79 20 6d 69 73 6d 61 74 63 68 20 69 73   any mismatch is
11c0: 20 64 65 74 65 63 74 65 64 20 74 68 69 73 20 73   detected this s
11d0: 75 72 65 6c 79 20 6d 65 61 6e 73 20 74 68 61 74  urely means that
11e0: 20 74 68 65 20 4e 65 74 77 6f 72 6b 20 69 73 20   the Network is 
11f0: 69 6e 76 61 6c 69 64 2e 3c 2f 6c 69 3e 0d 0a 3c  invalid.</li>..<
1200: 6c 69 3e 41 20 3c 62 3e 4c 69 6e 6b 3c 2f 62 3e  li>A <b>Link</b>
1210: 20 6d 61 79 20 6c 65 67 69 74 69 6d 61 74 65 6c   may legitimatel
1220: 79 20 73 65 6c 66 2d 69 6e 74 65 72 73 65 63 74  y self-intersect
1230: 20 69 74 73 65 6c 66 20 28 65 2e 67 2e 20 66 6f   itself (e.g. fo
1240: 72 6d 69 6e 67 20 61 20 6c 6f 6f 70 29 2c 20 61  rming a loop), a
1250: 73 20 73 68 6f 77 6e 20 69 6e 20 74 68 65 20 61  s shown in the a
1260: 62 6f 76 65 20 66 69 67 75 72 65 20 62 79 20 4c  bove figure by L
1270: 69 6e 6b 20 3c 62 3e 4c 31 35 3c 2f 62 3e 20 28  ink <b>L15</b> (
1280: 6f 72 61 6e 67 65 20 73 70 6f 74 29 2e 3c 2f 6c  orange spot).</l
1290: 69 3e 0d 0a 3c 6c 69 3e 54 77 6f 20 3c 62 3e 4c  i>..<li>Two <b>L
12a0: 69 6e 6b 73 3c 2f 62 3e 20 6d 61 79 20 6c 65 67  inks</b> may leg
12b0: 69 74 69 6d 61 74 65 6c 79 20 69 6e 74 65 72 73  itimately inters
12c0: 65 63 74 20 77 68 65 72 65 20 6e 6f 20 4e 6f 64  ect where no Nod
12d0: 65 20 65 78 69 73 74 73 2c 20 61 73 20 65 78 65  e exists, as exe
12e0: 6d 70 6c 69 66 69 65 64 20 6f 6e 20 74 68 65 20  mplified on the 
12f0: 61 62 6f 76 65 20 66 69 67 75 72 65 20 62 79 20  above figure by 
1300: 4c 69 6e 6b 73 20 3c 62 3e 4c 34 3c 2f 62 3e 20  Links <b>L4</b> 
1310: 61 6e 64 20 3c 62 3e 4c 37 3c 2f 62 3e 20 28 67  and <b>L7</b> (g
1320: 72 65 65 6e 20 73 70 6f 74 29 2e 3c 62 72 3e 0d  reen spot).<br>.
1330: 0a 54 68 69 73 20 75 73 75 61 6c 6c 79 20 68 61  .This usually ha
1340: 70 70 65 6e 73 20 77 68 65 6e 20 6f 6e 65 20 6f  ppens when one o
1350: 66 20 74 68 65 20 74 77 6f 20 4c 69 6e 6b 73 20  f the two Links 
1360: 6f 76 65 72 70 61 73 73 65 73 20 74 68 65 20 6f  overpasses the o
1370: 74 68 65 72 2c 20 6f 72 20 77 68 65 72 65 20 73  ther, or where s
1380: 6f 6d 65 20 74 65 63 68 6e 69 63 61 6c 20 72 65  ome technical re
1390: 73 74 72 69 63 74 69 6f 6e 20 65 78 69 73 74 73  striction exists
13a0: 20 28 65 2e 67 2e 20 74 77 6f 20 69 6e 73 75 6c   (e.g. two insul
13b0: 61 74 65 64 20 77 69 72 65 73 20 69 6e 20 61 6e  ated wires in an
13c0: 20 45 6c 65 63 74 72 69 63 61 6c 20 4e 65 74 77   Electrical Netw
13d0: 6f 72 6b 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  ork).</li>..<li>
13e0: 3c 62 3e 4c 69 6e 6b 73 3c 2f 62 3e 20 61 72 65  <b>Links</b> are
13f0: 6e 27 74 20 73 74 72 69 63 74 6c 79 20 72 65 71  n't strictly req
1400: 75 69 72 65 64 20 74 6f 20 62 65 20 61 73 73 6f  uired to be asso
1410: 63 69 61 74 65 64 20 77 69 74 68 20 61 6e 79 20  ciated with any 
1420: 73 70 65 63 69 66 69 63 20 61 74 74 72 69 62 75  specific attribu
1430: 74 65 2c 20 62 75 74 20 74 68 65 20 66 6f 6c 6c  te, but the foll
1440: 6f 77 69 6e 67 20 61 74 74 72 69 62 75 74 65 73  owing attributes
1450: 20 61 72 65 20 61 6c 6d 6f 73 74 20 75 6e 69 76   are almost univ
1460: 65 72 73 61 6c 6c 79 20 73 75 70 70 6f 72 74 65  ersally supporte
1470: 64 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61 20  d:..<ul>..<li>a 
1480: 3c 62 3e 6e 61 6d 65 3c 2f 62 3e 20 69 64 65 6e  <b>name</b> iden
1490: 74 69 66 79 69 6e 67 20 74 68 65 20 4c 69 6e 6b  tifying the Link
14a0: 2e 3c 62 72 3e 0d 0a 3c 75 3e 45 78 61 6d 70 6c  .<br>..<u>Exampl
14b0: 65 73 3c 2f 75 3e 3a 20 74 68 65 20 3c 69 3e 72  es</u>: the <i>r
14c0: 6f 61 64 20 74 6f 70 6f 6e 79 6d 3c 2f 69 3e 20  oad toponym</i> 
14d0: 69 6e 20 61 20 3c 62 3e 72 6f 61 64 20 6e 65 74  in a <b>road net
14e0: 77 6f 72 6b 3c 2f 62 3e 2c 20 6f 72 20 74 68 65  work</b>, or the
14f0: 20 3c 69 3e 72 69 76 65 72 20 6e 61 6d 65 3c 2f   <i>river name</
1500: 69 3e 20 69 6e 20 61 6e 20 3c 62 3e 68 79 64 72  i> in an <b>hydr
1510: 6f 67 72 61 70 68 69 63 20 6e 65 74 77 6f 72 6b  ographic network
1520: 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  </b>.</li>..<li>
1530: 6f 6e 65 20 28 6f 72 20 65 76 65 6e 20 6d 6f 72  one (or even mor
1540: 65 29 20 61 70 70 72 6f 70 72 69 61 74 65 20 3c  e) appropriate <
1550: 62 3e 63 6f 73 74 20 76 61 6c 75 65 3c 2f 62 3e  b>cost value</b>
1560: 28 73 29 2e 3c 62 72 3e 0d 0a 3c 75 3e 45 78 61  (s).<br>..<u>Exa
1570: 6d 70 6c 65 3c 2f 75 3e 3a 20 74 68 65 20 3c 69  mple</u>: the <i
1580: 3e 74 69 6d 65 3c 2f 69 3e 20 72 65 71 75 69 72  >time</i> requir
1590: 65 64 20 74 6f 20 74 72 61 76 65 72 73 65 20 74  ed to traverse t
15a0: 68 65 20 4c 69 6e 6b 20 28 6d 61 79 20 62 65 20  he Link (may be 
15b0: 64 69 73 74 69 6e 67 75 69 73 68 65 64 20 62 65  distinguished be
15c0: 74 77 65 65 6e 20 70 65 64 65 73 74 72 69 61 6e  tween pedestrian
15d0: 73 2c 20 62 69 63 79 63 6c 65 73 2c 20 63 61 72  s, bicycles, car
15e0: 73 2c 20 6c 6f 72 72 69 65 73 20 61 6e 64 20 73  s, lorries and s
15f0: 6f 20 6f 6e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  o on).</li>..<li
1600: 3e 61 20 70 61 69 72 20 6f 66 20 3c 62 3e 62 6f  >a pair of <b>bo
1610: 6f 6c 65 61 6e 20 66 6c 61 67 73 3c 2f 62 3e 20  olean flags</b> 
1620: 28 3c 62 3e 66 72 6f 6d 2d 74 6f 3c 2f 62 3e 20  (<b>from-to</b> 
1630: 61 6e 64 20 3c 62 3e 74 6f 2d 66 72 6f 6d 3c 2f  and <b>to-from</
1640: 62 3e 29 20 61 72 65 20 69 6e 74 65 6e 64 65 6e  b>) are intenden
1650: 64 20 74 6f 20 73 70 65 63 69 66 79 20 69 66 20  d to specify if 
1660: 74 68 65 20 4c 69 6e 6b 20 63 61 6e 20 62 65 20  the Link can be 
1670: 74 72 61 76 65 72 73 65 64 20 6f 6e 20 62 6f 74  traversed on bot
1680: 68 20 64 69 72 65 63 74 69 6f 6e 73 20 6f 72 20  h directions or 
1690: 6a 75 73 74 20 69 6e 20 6f 6e 65 20 28 3c 62 3e  just in one (<b>
16a0: 6f 6e 65 2d 77 61 79 3c 2f 62 3e 29 2e 3c 2f 6c  one-way</b>).</l
16b0: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a  i>..</ul></li>..
16c0: 3c 2f 75 6c 3e 0d 0a 3c 68 34 3e 4c 6f 67 69 63  </ul>..<h4>Logic
16d0: 61 6c 20 63 6f 6e 63 6c 75 73 69 6f 6e 73 3c 2f  al conclusions</
16e0: 68 34 3e 0d 0a 41 6e 79 20 74 6f 70 6f 6c 6f 67  h4>..Any topolog
16f0: 69 63 61 6c 6c 79 20 76 61 6c 69 64 20 3c 62 3e  ically valid <b>
1700: 4e 65 74 77 6f 72 6b 3c 2f 62 3e 20 28 69 72 72  Network</b> (irr
1710: 65 73 70 65 63 74 69 76 65 20 6f 66 20 77 68 65  espective of whe
1720: 74 68 65 72 20 69 74 20 69 73 20 61 20 3c 62 3e  ther it is a <b>
1730: 53 70 61 74 69 61 6c 3c 2f 62 3e 20 6f 72 20 3c  Spatial</b> or <
1740: 62 3e 4c 6f 67 69 63 61 6c 3c 2f 62 3e 20 74 79  b>Logical</b> ty
1750: 70 65 29 20 69 73 20 61 20 76 61 6c 69 64 20 3c  pe) is a valid <
1760: 62 3e 47 72 61 70 68 3c 2f 62 3e 2e 3c 62 72 3e  b>Graph</b>.<br>
1770: 0d 0a 41 20 4e 65 74 77 6f 72 6b 20 61 6c 6c 6f  ..A Network allo
1780: 77 69 6e 67 20 74 68 65 20 73 75 70 70 6f 72 74  wing the support
1790: 20 28 64 69 72 65 63 74 20 6f 72 20 69 6e 64 69   (direct or indi
17a0: 72 65 63 74 29 20 6f 66 20 73 6f 6d 65 20 61 70  rect) of some ap
17b0: 70 72 6f 70 72 69 61 74 65 20 3c 62 3e 63 6f 73  propriate <b>cos
17c0: 74 20 76 61 6c 75 65 3c 2f 62 3e 20 69 73 20 61  t value</b> is a
17d0: 20 76 61 6c 69 64 20 3c 62 3e 57 65 69 67 68 74   valid <b>Weight
17e0: 65 64 20 47 72 61 70 68 3c 2f 62 3e 2c 20 61 6e  ed Graph</b>, an
17f0: 64 20 63 61 6e 20 63 6f 6e 73 65 71 75 65 6e 74  d can consequent
1800: 6c 79 20 73 75 70 70 6f 72 74 20 3c 62 3e 52 6f  ly support <b>Ro
1810: 75 74 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d 73  uting algorithms
1820: 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 41 6c 6c 20 52  </b>.<br>..All R
1830: 6f 75 74 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d  outing algorithm
1840: 73 20 61 72 65 20 69 6e 74 65 6e 64 65 64 20 74  s are intended t
1850: 6f 20 69 64 65 6e 74 69 66 79 20 74 68 65 20 3c  o identify the <
1860: 62 3e 53 68 6f 72 74 65 73 74 20 50 61 74 68 3c  b>Shortest Path<
1870: 2f 62 3e 20 73 6f 6c 75 74 69 6f 6e 20 63 6f 6e  /b> solution con
1880: 6e 65 63 74 69 6e 67 20 74 77 6f 20 3c 62 3e 4e  necting two <b>N
1890: 6f 64 65 73 3c 2f 62 3e 20 69 6e 20 61 20 3c 62  odes</b> in a <b
18a0: 3e 77 65 69 67 68 74 65 64 20 67 72 61 70 68 3c  >weighted graph<
18b0: 2f 62 3e 20 28 3c 69 3e 61 6b 61 3c 2f 69 3e 20  /b> (<i>aka</i> 
18c0: 3c 62 3e 4e 65 74 77 6f 72 6b 3c 2f 62 3e 29 2e  <b>Network</b>).
18d0: 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 62 3e 3c 75 3e  <br><br>..<b><u>
18e0: 4e 6f 74 65 3c 2f 75 3e 3c 2f 62 3e 3a 20 74 68  Note</u></b>: th
18f0: 65 20 74 65 72 6d 20 3c 62 3e 3c 69 3e 53 68 6f  e term <b><i>Sho
1900: 72 74 65 73 74 20 50 61 74 68 3c 2f 69 3e 3c 2f  rtest Path</i></
1910: 62 3e 20 63 61 6e 20 62 65 20 65 61 73 69 6c 79  b> can be easily
1920: 20 6d 69 73 75 6e 64 65 72 73 74 6f 6f 64 2e 3c   misunderstood.<
1930: 62 72 3e 0d 0a 44 75 65 20 74 6f 20 68 69 73 74  br>..Due to hist
1940: 6f 72 69 63 61 6c 20 72 65 61 73 6f 6e 73 20 74  orical reasons t
1950: 68 65 20 6d 6f 73 74 20 63 6f 6d 6d 6f 6e 20 61  he most common a
1960: 70 70 6c 69 63 61 74 69 6f 6e 20 66 69 65 6c 64  pplication field
1970: 20 66 6f 72 20 52 6f 75 74 69 6e 67 20 61 6c 67   for Routing alg
1980: 6f 72 69 74 68 6d 73 20 69 73 20 72 65 6c 61 74  orithms is relat
1990: 65 64 20 74 6f 20 3c 62 3e 52 6f 61 64 20 4e 65  ed to <b>Road Ne
19a0: 74 77 6f 72 6b 73 3c 2f 62 3e 2c 20 62 75 74 20  tworks</b>, but 
19b0: 61 6c 73 6f 20 6d 61 6e 79 20 6f 74 68 65 72 20  also many other 
19c0: 6b 69 6e 64 73 20 6f 66 20 4e 65 74 77 6f 72 6b  kinds of Network
19d0: 73 20 65 78 69 73 74 3a 0d 0a 3c 75 6c 3e 0d 0a  s exist:..<ul>..
19e0: 3c 6c 69 3e 48 79 64 72 6f 67 72 61 70 68 69 63  <li>Hydrographic
19f0: 20 4e 65 74 77 6f 72 6b 73 2e 3c 2f 6c 69 3e 0d   Networks.</li>.
1a00: 0a 3c 6c 69 3e 47 61 73 20 2f 20 57 61 74 65 72  .<li>Gas / Water
1a10: 20 2f 20 4f 69 6c 20 4e 65 74 77 6f 72 6b 73 2e   / Oil Networks.
1a20: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 45 6c 65 63 74  </li>..<li>Elect
1a30: 72 69 63 61 6c 20 4e 65 74 77 6f 72 6b 73 2e 3c  rical Networks.<
1a40: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 65 6c 65 63 6f  /li>..<li>Teleco
1a50: 6d 75 6e 69 63 61 74 69 6f 6e 20 4e 65 74 77 6f  munication Netwo
1a60: 72 6b 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 53  rks.</li>..<li>S
1a70: 6f 63 69 61 6c 20 6f 72 20 45 63 6f 6e 6f 6d 69  ocial or Economi
1a80: 63 61 6c 20 4e 65 74 77 6f 72 6b 73 20 72 65 70  cal Networks rep
1a90: 72 65 73 65 6e 74 69 6e 67 20 72 65 6c 61 74 69  resenting relati
1aa0: 6f 6e 73 68 69 70 73 20 62 65 74 77 65 65 6e 20  onships between 
1ab0: 69 6e 64 69 76 69 64 75 61 6c 73 20 6f 72 20 63  individuals or c
1ac0: 6f 6d 70 61 6e 69 65 73 2e 3c 2f 6c 69 3e 0d 0a  ompanies.</li>..
1ad0: 3c 6c 69 3e 45 70 69 64 65 6d 69 6f 6c 6f 67 69  <li>Epidemiologi
1ae0: 63 61 6c 20 4e 65 74 77 6f 72 6b 73 20 72 65 70  cal Networks rep
1af0: 72 65 73 65 6e 74 69 6e 67 20 74 68 65 20 70 72  resenting the pr
1b00: 6f 70 61 67 61 74 69 6f 6e 20 6f 66 20 69 6e 66  opagation of inf
1b10: 65 63 74 69 76 65 20 64 69 73 65 61 73 65 73 20  ective diseases 
1b20: 62 65 74 77 65 65 6e 20 69 6e 64 69 76 69 64 75  between individu
1b30: 61 6c 73 20 6f 72 20 67 72 6f 75 70 73 2e 3c 2f  als or groups.</
1b40: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 20  li>..</ul></li> 
1b50: 0d 0a 3c 62 72 3e 0d 0a 49 6e 20 61 6c 6c 20 74  ..<br>..In all t
1b60: 68 65 20 61 62 6f 76 65 20 63 61 73 65 73 20 77  he above cases w
1b70: 65 20 63 65 72 74 61 69 6e 6c 79 20 68 61 76 65  e certainly have
1b80: 20 76 61 6c 69 64 20 4e 65 74 77 6f 72 6b 73 20   valid Networks 
1b90: 73 75 70 70 6f 72 74 69 6e 67 20 52 6f 75 74 69  supporting Routi
1ba0: 6e 67 20 61 6c 67 6f 72 69 74 68 6e 73 2c 20 62  ng algorithns, b
1bb0: 75 74 20 6e 6f 74 20 61 6c 6c 20 6f 66 20 74 68  ut not all of th
1bc0: 65 6d 20 63 61 6e 20 69 6d 70 6c 79 20 73 6f 6d  em can imply som
1bd0: 65 74 68 69 6e 67 20 6c 69 6b 65 20 61 20 3c 69  ething like a <i
1be0: 3e 73 70 61 74 69 61 6c 20 64 69 73 74 61 6e 63  >spatial distanc
1bf0: 65 3c 2f 69 3e 20 28 3c 69 3e 67 65 6f 6d 65 74  e</i> (<i>geomet
1c00: 72 69 63 20 6c 65 6e 67 74 68 3c 2f 69 3e 29 20  ric length</i>) 
1c10: 6f 72 20 61 20 3c 69 3e 74 72 61 76 65 6c 20 74  or a <i>travel t
1c20: 69 6d 65 3c 2f 69 3e 2e 3c 62 72 3e 0d 0a 49 6e  ime</i>.<br>..In
1c30: 20 74 68 65 20 6d 6f 73 74 20 67 65 6e 65 72 61   the most genera
1c40: 6c 20 61 63 63 65 70 74 69 6f 6e 20 3c 62 3e 63  l acception <b>c
1c50: 6f 73 74 73 3c 2f 62 3e 20 63 61 6e 20 62 65 20  osts</b> can be 
1c60: 72 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 61  represented by a
1c70: 6e 79 20 72 65 61 73 6f 6e 61 62 6c 65 20 70 68  ny reasonable ph
1c80: 79 73 69 63 61 6c 20 71 75 61 6e 74 69 74 79 2e  ysical quantity.
1c90: 3c 62 72 3e 0d 0a 53 6f 20 61 20 6d 6f 72 65 20  <br>..So a more 
1ca0: 67 65 6e 65 72 61 6c 69 7a 65 64 20 64 65 66 69  generalized defi
1cb0: 6e 69 74 69 6f 6e 20 69 73 20 61 73 73 75 6d 69  nition is assumi
1cc0: 6e 67 20 74 68 61 74 20 52 6f 75 74 69 6e 67 20  ng that Routing 
1cd0: 61 6c 67 6f 72 69 74 68 6d 73 20 61 72 65 20 69  algorithms are i
1ce0: 6e 74 65 6e 64 65 64 20 74 6f 20 69 64 65 6e 74  ntended to ident
1cf0: 69 66 79 20 3c 62 3e 6c 65 73 73 65 72 20 63 6f  ify <b>lesser co
1d00: 73 74 3c 2f 62 3e 20 73 6f 6c 75 74 69 6f 6e 73  st</b> solutions
1d10: 20 6f 6e 20 61 20 3c 62 3e 77 65 69 67 68 74 65   on a <b>weighte
1d20: 64 20 67 72 61 70 68 3c 2f 62 3e 2e 3c 62 72 3e  d graph</b>.<br>
1d30: 0d 0a 54 68 65 20 65 78 61 63 74 20 69 6e 74 65  ..The exact inte
1d40: 72 70 72 65 74 61 74 69 6f 6e 20 6f 66 20 74 68  rpretation of th
1d50: 65 20 69 6e 76 6f 6c 76 65 64 20 3c 62 3e 63 6f  e involved <b>co
1d60: 73 74 73 3c 2f 62 3e 20 28 3c 69 3e 61 6b 61 3c  sts</b> (<i>aka<
1d70: 2f 69 3e 20 3c 62 3e 77 65 69 67 68 74 73 3c 2f  /i> <b>weights</
1d80: 62 3e 29 20 73 74 72 69 63 74 6c 79 20 64 65 70  b>) strictly dep
1d90: 65 6e 64 73 20 6f 6e 20 74 68 65 20 76 65 72 79  ends on the very
1da0: 20 73 70 65 63 69 66 69 63 20 6e 61 74 75 72 65   specific nature
1db0: 20 6f 66 20 65 61 63 68 20 4e 65 74 77 6f 72 6b   of each Network
1dc0: 2e 0d 0a 3c 68 33 3e 54 68 65 20 44 69 6a 6b 73  ...<h3>The Dijks
1dd0: 74 72 61 27 73 20 61 6c 67 6f 72 69 74 68 6d 3c  tra's algorithm<
1de0: 2f 68 33 3e 0d 0a 54 68 69 73 20 77 65 6c 6c 20  /h3>..This well 
1df0: 6b 6e 6f 77 6e 20 3c 61 20 68 72 65 66 3d 22 68  known <a href="h
1e00: 74 74 70 73 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65  ttps://en.wikipe
1e10: 64 69 61 2e 6f 72 67 2f 77 69 6b 69 2f 44 69 6a  dia.org/wiki/Dij
1e20: 6b 73 74 72 61 25 32 37 73 5f 61 6c 67 6f 72 69  kstra%27s_algori
1e30: 74 68 6d 22 3e 61 6c 67 6f 72 69 74 68 6d 3c 2f  thm">algorithm</
1e40: 61 3e 20 69 73 6e 27 74 20 6e 65 63 65 73 73 61  a> isn't necessa
1e50: 72 69 6c 79 20 74 68 65 20 66 61 73 74 65 73 74  rily the fastest
1e60: 20 6f 6e 65 2c 20 62 75 74 20 69 74 20 61 6c 77   one, but it alw
1e70: 61 79 73 20 65 6e 73 75 72 65 73 20 3c 62 3e 66  ays ensures <b>f
1e80: 75 6c 6c 20 63 6f 72 72 65 63 74 6e 65 73 73 3c  ull correctness<
1e90: 2f 62 3e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  /b>:..<ul>..<li>
1ea0: 41 6e 79 20 4e 6f 64 65 2d 74 6f 2d 4e 6f 64 65  Any Node-to-Node
1eb0: 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 69 64 65 6e   connection iden
1ec0: 74 69 66 69 65 64 20 62 79 20 44 69 6a 6b 73 74  tified by Dijkst
1ed0: 72 61 27 73 20 69 73 20 63 65 72 74 61 69 6e 6c  ra's is certainl
1ee0: 79 20 65 6e 73 75 72 65 64 20 74 6f 20 62 65 20  y ensured to be 
1ef0: 3c 62 3e 6f 70 74 69 6d 61 6c 3c 2f 62 3e 2e 3c  <b>optimal</b>.<
1f00: 62 72 3e 0d 0a 49 6e 20 6f 74 68 65 72 20 77 6f  br>..In other wo
1f10: 72 64 73 2c 20 6e 6f 20 63 6f 6e 6e 65 74 63 74  rds, no connetct
1f20: 69 6f 6e 20 70 72 65 73 65 6e 74 69 6e 67 20 61  ion presenting a
1f30: 20 6c 6f 77 65 72 20 63 6f 73 74 20 63 61 6e 20   lower cost can 
1f40: 63 6f 6e 63 65 70 74 75 61 6c 6c 79 20 65 78 69  conceptually exi
1f50: 73 74 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 57 68  st.</li>..<li>Wh
1f60: 65 6e 20 44 69 6a 73 6a 74 72 61 27 73 20 66 61  en Dijsjtra's fa
1f70: 69 6c 73 20 74 6f 20 69 64 65 6e 74 69 66 79 20  ils to identify 
1f80: 61 20 73 6f 6c 75 74 69 6f 6e 20 74 68 69 73 20  a solution this 
1f90: 73 75 72 65 6c 79 20 6d 65 61 6e 73 20 74 68 61  surely means tha
1fa0: 74 20 6e 6f 20 73 6f 6c 75 74 69 6f 6e 20 69 73  t no solution is
1fb0: 20 70 6f 73 73 69 62 6c 65 2e 3c 2f 6c 69 3e 0d   possible.</li>.
1fc0: 0a 3c 2f 75 6c 3e 0d 0a 3c 68 33 3e 54 68 65 20  .</ul>..<h3>The 
1fd0: 41 2a 20 61 6c 67 6f 72 69 74 68 6d 3c 2f 68 33  A* algorithm</h3
1fe0: 3e 0d 0a 4d 61 6e 79 20 61 6c 74 65 72 6e 61 74  >..Many alternat
1ff0: 69 76 65 20 52 6f 75 74 69 6e 67 20 61 6c 67 6f  ive Routing algo
2000: 72 69 74 68 6d 73 20 68 61 76 65 20 62 65 65 6e  rithms have been
2010: 20 69 6e 76 65 6e 74 65 64 20 64 75 72 69 6e 67   invented during
2020: 20 74 68 65 20 79 65 61 72 73 2e 3c 62 72 3e 0d   the years.<br>.
2030: 0a 41 6c 6c 20 74 68 65 6d 20 61 72 65 20 62 61  .All them are ba
2040: 73 65 64 20 6f 6e 20 68 65 75 72 69 73 74 69 63  sed on heuristic
2050: 20 61 73 73 75 6d 70 74 69 6f 6e 73 20 61 6e 64   assumptions and
2060: 20 61 72 65 20 69 6e 74 65 6e 64 65 64 20 74 6f   are intended to
2070: 20 62 65 20 66 61 73 74 65 72 20 74 68 61 6e 20   be faster than 
2080: 44 69 6a 6b 73 74 72 61 27 73 2c 20 62 75 74 20  Dijkstra's, but 
2090: 6e 6f 6e 65 20 6f 66 20 74 68 65 6d 20 63 61 6e  none of them can
20a0: 20 65 6e 73 75 72 65 20 3c 62 3e 66 75 6c 6c 20   ensure <b>full 
20b0: 63 6f 72 72 65 63 74 6e 65 73 73 3c 2f 62 3e 20  correctness</b> 
20c0: 61 73 20 44 69 6a 6b 73 74 72 61 27 73 20 64 6f  as Dijkstra's do
20d0: 65 73 2e 3c 62 72 3e 0d 0a 54 68 65 20 3c 61 20  es.<br>..The <a 
20e0: 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 65 6e  href="https://en
20f0: 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72 67 2f 77  .wikipedia.org/w
2100: 69 6b 69 2f 41 2a 5f 73 65 61 72 63 68 5f 61 6c  iki/A*_search_al
2110: 67 6f 72 69 74 68 6d 22 3e 41 2a 20 61 6c 67 6f  gorithm">A* algo
2120: 72 69 74 68 6d 3c 2f 61 3e 20 61 70 70 6c 69 65  rithm</a> applie
2130: 73 20 61 20 6d 69 6c 64 20 68 65 75 72 69 73 74  s a mild heurist
2140: 69 63 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 2c  ic optimization,
2150: 20 61 6e 64 20 63 61 6e 20 62 65 20 61 20 72 65   and can be a re
2160: 61 6c 69 73 74 69 63 20 61 6c 74 65 72 6e 61 74  alistic alternat
2170: 69 76 65 20 74 6f 20 44 69 6a 6b 73 74 72 61 27  ive to Dijkstra'
2180: 73 20 69 6e 20 6d 61 6e 79 20 63 61 73 65 73 2e  s in many cases.
2190: 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a  <br><br>..<hr>..
21a0: 3c 68 32 3e 43 72 65 61 74 69 6e 67 20 61 20 56  <h2>Creating a V
21b0: 69 72 74 75 61 6c 52 6f 75 74 69 6e 67 20 54 61  irtualRouting Ta
21c0: 62 6c 65 3c 2f 68 32 3e 0d 0a 41 6c 6c 20 56 69  ble</h2>..All Vi
21d0: 72 74 75 61 6c 52 6f 75 74 69 6e 67 20 71 75 65  rtualRouting que
21e0: 72 69 65 73 20 61 72 65 20 62 61 73 65 64 20 6f  ries are based o
21f0: 6e 20 73 6f 6d 65 20 3c 62 3e 56 69 72 74 75 61  n some <b>Virtua
2200: 6c 52 6f 75 74 69 6e 67 20 54 61 62 6c 65 3c 2f  lRouting Table</
2210: 62 3e 2c 20 61 6e 64 20 69 6e 20 74 75 72 6e 20  b>, and in turn 
2220: 61 20 56 69 72 74 75 61 6c 52 6f 75 74 69 6e 67  a VirtualRouting
2230: 20 54 61 62 6c 65 20 69 73 20 62 61 73 65 64 20   Table is based 
2240: 6f 6e 20 73 6f 6d 65 20 61 70 70 72 6f 70 72 69  on some appropri
2250: 61 74 65 20 3c 62 3e 42 69 6e 61 72 79 20 44 61  ate <b>Binary Da
2260: 74 61 20 54 61 62 6c 65 3c 2f 62 3e 20 73 75 70  ta Table</b> sup
2270: 70 6f 72 74 69 6e 67 20 61 6e 20 65 66 66 69 63  porting an effic
2280: 69 65 6e 74 20 72 65 70 72 65 73 65 6e 74 61 74  ient representat
2290: 69 6f 6e 20 6f 66 20 74 68 65 20 75 6e 64 65 72  ion of the under
22a0: 6c 79 69 6e 67 20 4e 65 74 77 6f 72 6b 2e 3c 62  lying Network.<b
22b0: 72 3e 0d 0a 53 6f 20 77 65 27 6c 6c 20 73 74 61  r>..So we'll sta
22c0: 72 74 20 66 69 72 73 74 20 62 79 20 63 72 65 61  rt first by crea
22d0: 74 69 6e 67 20 73 75 63 68 20 74 61 62 6c 65 73  ting such tables
22e0: 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68 65 20 6f  .<br><br>..The o
22f0: 6c 64 20 61 6e 64 20 6e 6f 77 20 73 75 70 65 72  ld and now super
2300: 73 65 64 65 64 20 3c 62 3e 56 69 72 74 75 61 6c  seded <b>Virtual
2310: 4e 65 74 77 6f 72 6b 3c 2f 62 3e 20 72 65 71 75  Network</b> requ
2320: 69 72 65 64 20 75 73 69 6e 67 20 61 20 73 65 70  ired using a sep
2330: 61 72 61 74 65 20 43 4c 49 20 74 6f 6f 6c 20 28  arate CLI tool (
2340: 3c 62 3e 73 70 61 74 69 61 6c 69 74 65 5f 6e 65  <b>spatialite_ne
2350: 74 77 6f 72 6b 3c 2f 62 3e 29 20 69 6e 20 6f 72  twork</b>) in or
2360: 64 65 72 20 74 6f 20 70 72 6f 70 65 72 6c 79 20  der to properly 
2370: 69 6e 69 74 69 61 6c 69 7a 65 20 61 20 56 69 72  initialize a Vir
2380: 74 75 61 6c 4e 65 74 77 6f 72 6b 20 54 61 62 6c  tualNetwork Tabl
2390: 65 20 61 6e 64 20 69 74 73 20 63 6f 6d 70 61 6e  e and its compan
23a0: 69 6f 6e 20 42 69 6e 61 72 79 20 44 61 74 61 20  ion Binary Data 
23b0: 54 61 62 6c 65 3b 0d 0a 61 6c 74 65 72 6e 61 74  Table;..alternat
23c0: 69 76 65 6c 79 20 3c 62 3e 73 70 61 74 69 61 6c  ively <b>spatial
23d0: 69 74 65 5f 67 75 69 3c 2f 62 3e 20 73 75 70 70  ite_gui</b> supp
23e0: 6f 72 74 65 64 20 61 20 3c 62 3e 47 55 49 20 77  orted a <b>GUI w
23f0: 69 7a 61 72 64 3c 2f 62 3e 20 66 6f 72 20 74 68  izard</b> for th
2400: 65 20 73 61 6d 65 20 74 61 73 6b 2e 20 53 69 6e  e same task. Sin
2410: 63 65 20 76 65 72 73 69 6f 6e 20 3c 62 3e 35 2e  ce version <b>5.
2420: 30 2e 30 3c 2f 62 3e 20 6e 6f 77 20 53 70 61 74  0.0</b> now Spat
2430: 69 61 4c 69 74 65 20 64 69 72 65 63 6c 79 20 73  iaLite direcly s
2440: 75 70 70 6f 72 74 73 20 61 20 73 70 65 63 69 66  upports a specif
2450: 69 63 20 3c 62 3e 43 72 65 61 74 65 52 6f 75 74  ic <b>CreateRout
2460: 69 6e 67 28 29 3c 2f 62 3e 20 53 51 4c 20 66 75  ing()</b> SQL fu
2470: 6e 63 74 69 6f 6e 2e 0d 0a 3c 76 65 72 62 61 74  nction...<verbat
2480: 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 72 65 61  im>..SELECT Crea
2490: 74 65 52 6f 75 74 69 6e 67 28 27 62 79 66 6f 6f  teRouting('byfoo
24a0: 74 5f 64 61 74 61 27 2c 20 27 62 79 66 6f 6f 74  t_data', 'byfoot
24b0: 27 2c 20 27 72 6f 61 64 73 5f 76 77 27 2c 20 27  ', 'roads_vw', '
24c0: 6e 6f 64 65 5f 66 72 6f 6d 27 2c 20 27 6e 6f 64  node_from', 'nod
24d0: 65 74 6f 27 2c 20 27 67 65 6f 6d 27 2c 20 4e 55  eto', 'geom', NU
24e0: 4c 4c 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 43  LL);....SELECT C
24f0: 72 65 61 74 65 52 6f 75 74 69 6e 67 5f 47 65 74  reateRouting_Get
2500: 4c 61 73 74 45 72 72 6f 72 28 29 3b 0d 0a 2d 2d  LastError();..--
2510: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2520: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2530: 2d 2d 0d 0a 54 6f 4e 6f 64 65 20 43 6f 6c 75 6d  --..ToNode Colum
2540: 6e 20 22 6e 6f 64 65 74 6f 22 20 69 73 20 6e 6f  n "nodeto" is no
2550: 74 20 64 65 66 69 6e 65 64 20 69 6e 20 74 68 65  t defined in the
2560: 20 49 6e 70 75 74 20 54 61 62 6c 65 0d 0a 3c 2f   Input Table..</
2570: 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 3e 4e 6f  verbatim>..<u>No
2580: 74 65 3c 2f 75 3e 3a 20 74 68 69 73 20 66 69 72  te</u>: this fir
2590: 73 74 20 71 75 65 72 79 20 63 6f 6e 74 61 69 6e  st query contain
25a0: 73 20 61 6e 20 69 6e 74 65 6e 64 65 64 20 65 72  s an intended er
25b0: 72 6f 72 20 63 61 75 73 69 6e 67 20 3c 62 3e 43  ror causing <b>C
25c0: 72 65 61 74 65 52 6f 75 74 69 6e 67 28 29 3c 2f  reateRouting()</
25d0: 62 3e 20 74 6f 20 66 61 69 6c 20 72 61 69 73 69  b> to fail raisi
25e0: 6e 67 20 61 6e 20 65 78 63 65 70 74 69 6f 6e 2e  ng an exception.
25f0: 3c 62 72 3e 0d 0a 43 72 65 61 74 65 52 6f 75 74  <br>..CreateRout
2600: 69 6e 67 28 29 20 63 61 6e 20 66 61 69 6c 20 66  ing() can fail f
2610: 6f 72 20 6d 75 6c 74 69 70 6c 65 20 72 65 61 73  or multiple reas
2620: 6f 6e 73 2c 20 61 6e 64 20 62 79 20 63 61 6c 6c  ons, and by call
2630: 69 6e 67 20 3c 62 3e 43 72 65 61 74 65 52 6f 75  ing <b>CreateRou
2640: 74 69 6e 67 5f 47 65 74 4c 61 73 74 45 72 72 6f  ting_GetLastErro
2650: 72 28 29 3c 2f 62 3e 20 79 6f 75 20 63 61 6e 20  r()</b> you can 
2660: 65 61 73 69 6c 79 20 69 64 65 6e 74 69 66 79 20  easily identify 
2670: 74 68 65 20 65 78 61 63 74 20 72 65 61 73 6f 6e  the exact reason
2680: 20 77 68 79 20 74 68 65 20 6d 6f 73 74 20 72 65   why the most re
2690: 63 65 6e 74 20 63 61 6c 6c 20 74 6f 20 43 72 65  cent call to Cre
26a0: 61 74 65 52 6f 75 74 69 6e 67 28 29 20 66 61 69  ateRouting() fai
26b0: 6c 65 64 2e 3c 62 72 3e 0d 0a 3c 76 65 72 62 61  led.<br>..<verba
26c0: 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 72 65  tim>..SELECT Cre
26d0: 61 74 65 52 6f 75 74 69 6e 67 28 27 62 79 66 6f  ateRouting('byfo
26e0: 6f 74 5f 64 61 74 61 27 2c 20 27 62 79 66 6f 6f  ot_data', 'byfoo
26f0: 74 27 2c 20 27 72 6f 61 64 73 5f 76 77 27 2c 20  t', 'roads_vw', 
2700: 27 6e 6f 64 65 5f 66 72 6f 6d 27 2c 20 27 6e 6f  'node_from', 'no
2710: 64 65 5f 74 6f 27 2c 20 27 67 65 6f 6d 27 2c 20  de_to', 'geom', 
2720: 4e 55 4c 4c 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d  NULL);..--------
2730: 2d 2d 2d 2d 2d 0d 0a 31 0d 0a 0d 0a 53 45 4c 45  -----..1....SELE
2740: 43 54 20 43 72 65 61 74 65 52 6f 75 74 69 6e 67  CT CreateRouting
2750: 5f 47 65 74 4c 61 73 74 45 72 72 6f 72 28 29 3b  _GetLastError();
2760: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ..--------------
2770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2780: 2d 2d 2d 2d 2d 2d 0d 0a 4e 55 4c 4c 0d 0a 3c 2f  ------..NULL..</
2790: 76 65 72 62 61 74 69 6d 3e 0d 0a 54 68 69 73 20  verbatim>..This 
27a0: 73 65 63 6f 6e 64 20 61 74 74 65 6d 70 74 20 69  second attempt i
27b0: 66 20 66 69 6e 61 6c 6c 79 20 73 75 63 63 65 73  f finally succes
27c0: 66 75 6c 2c 20 61 6e 64 20 6e 6f 77 20 43 72 65  ful, and now Cre
27d0: 61 74 65 52 6f 75 74 69 6e 67 28 29 20 72 65 74  ateRouting() ret
27e0: 75 72 6e 73 20 3c 62 3e 31 3c 2f 62 3e 20 28 3c  urns <b>1</b> (<
27f0: 69 3e 61 6b 61 3c 2f 69 3e 20 3c 62 3e 54 52 55  i>aka</i> <b>TRU
2800: 45 3c 2f 62 3e 29 2c 20 61 6e 64 20 61 73 20 79  E</b>), and as y
2810: 6f 75 20 63 61 6e 20 65 61 73 69 6c 79 20 63 68  ou can easily ch
2820: 65 63 6b 20 6e 6f 77 20 74 68 65 20 44 61 74 61  eck now the Data
2830: 62 61 73 65 20 63 6f 6e 74 61 69 6e 73 20 74 77  base contains tw
2840: 6f 20 6e 65 77 20 54 61 62 6c 65 73 3a 20 3c 62  o new Tables: <b
2850: 3e 62 79 66 6f 6f 74 3c 2f 62 3e 20 61 6e 64 20  >byfoot</b> and 
2860: 3c 62 3e 62 79 66 6f 6f 74 5f 64 61 74 61 3c 2f  <b>byfoot_data</
2870: 62 3e 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65  b>.<br>..<u>Note
2880: 3c 2f 75 3e 3a 20 61 66 74 65 72 20 61 20 73 75  </u>: after a su
2890: 63 63 65 73 66 75 6c 6c 20 63 61 6c 6c 20 74 6f  ccesfull call to
28a0: 20 43 72 65 61 74 65 52 6f 75 74 69 6e 67 28 29   CreateRouting()
28b0: 20 3c 62 3e 43 72 65 61 74 65 52 6f 75 74 69 6e   <b>CreateRoutin
28c0: 67 5f 47 65 74 4c 61 73 74 45 72 72 6f 72 28 29  g_GetLastError()
28d0: 3c 2f 62 3e 20 77 69 6c 6c 20 61 6c 77 61 79 73  </b> will always
28e0: 20 72 65 74 75 72 6e 20 3c 62 3e 4e 55 4c 4c 3c   return <b>NULL<
28f0: 2f 62 3e 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 59 6f  /b>.<br><br>..Yo
2900: 75 27 76 65 20 6a 75 73 74 20 75 73 65 64 20 74  u've just used t
2910: 68 65 20 3c 69 3e 72 65 64 75 63 65 64 20 66 6f  he <i>reduced fo
2920: 72 6d 3c 2f 69 3e 20 6f 66 20 43 72 65 61 74 65  rm</i> of Create
2930: 52 6f 75 74 69 6e 67 28 29 3b 20 6c 65 74 27 73  Routing(); let's
2940: 20 73 65 65 20 69 6e 20 6d 6f 72 65 20 64 65 70   see in more dep
2950: 74 68 20 61 6c 6c 20 74 68 65 20 61 72 67 75 6d  th all the argum
2960: 65 6e 74 73 20 61 6e 64 20 74 68 65 69 72 20 6d  ents and their m
2970: 65 61 6e 69 6e 67 3a 0d 0a 3c 6f 6c 3e 0d 0a 3c  eaning:..<ol>..<
2980: 6c 69 3e 3c 69 3e 62 79 66 6f 6f 74 5f 64 61 74  li><i>byfoot_dat
2990: 61 3c 2f 69 3e 3a 20 74 68 65 20 6e 61 6d 65 20  a</i>: the name 
29a0: 6f 66 20 74 68 65 20 4e 65 74 77 6f 72 6b 20 42  of the Network B
29b0: 69 6e 61 72 79 20 44 61 74 61 20 74 6f 20 62 65  inary Data to be
29c0: 20 63 72 65 61 74 65 64 2e 3c 2f 6c 69 3e 0d 0a   created.</li>..
29d0: 3c 6c 69 3e 3c 69 3e 62 79 66 6f 6f 74 3c 2f 69  <li><i>byfoot</i
29e0: 3e 3a 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74  >: the name of t
29f0: 68 65 20 56 69 72 74 75 61 6c 52 6f 75 74 69 6e  he VirtualRoutin
2a00: 67 20 54 61 62 6c 65 20 74 6f 20 62 65 20 63 72  g Table to be cr
2a10: 65 61 74 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  eated.</li>..<li
2a20: 3e 3c 69 3e 72 6f 61 64 73 5f 76 77 3c 2f 69 3e  ><i>roads_vw</i>
2a30: 3a 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68  : the name of th
2a40: 65 20 3c 62 3e 53 70 61 74 69 61 6c 20 54 61 62  e <b>Spatial Tab
2a50: 6c 65 3c 2f 62 3e 20 6f 72 20 3c 62 3e 53 70 61  le</b> or <b>Spa
2a60: 74 69 61 6c 20 56 69 65 77 3c 2f 62 3e 20 72 65  tial View</b> re
2a70: 70 72 65 73 65 6e 74 69 6e 67 20 74 68 65 20 75  presenting the u
2a80: 6e 64 65 72 6c 79 69 6e 67 20 4e 65 74 77 6f 72  nderlying Networ
2a90: 6b 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c  k.<br>..<u>Note<
2aa0: 2f 75 3e 3a 20 69 6e 20 74 68 69 73 20 63 61 73  /u>: in this cas
2ab0: 65 20 77 65 20 61 63 74 75 61 6c 6c 79 20 75 73  e we actually us
2ac0: 65 64 20 61 20 53 70 61 74 69 61 6c 20 56 69 65  ed a Spatial Vie
2ad0: 77 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e  w.</li>..<li><i>
2ae0: 6e 6f 64 65 5f 66 72 6f 6d 3c 2f 69 3e 3a 20 6e  node_from</i>: n
2af0: 61 6d 65 20 6f 66 20 74 68 65 20 63 6f 6c 75 6d  ame of the colum
2b00: 6e 20 28 69 6e 20 74 68 65 20 61 62 6f 76 65 20  n (in the above 
2b10: 54 61 62 6c 65 20 6f 72 20 56 69 65 77 29 20 65  Table or View) e
2b20: 78 70 65 63 74 65 64 20 74 6f 20 63 6f 6e 74 61  xpected to conta
2b30: 69 6e 20 3c 62 3e 6e 6f 64 65 2d 66 72 6f 6d 3c  in <b>node-from<
2b40: 2f 62 3e 20 76 61 6c 75 65 73 2e 3c 2f 6c 69 3e  /b> values.</li>
2b50: 0d 0a 3c 6c 69 3e 3c 69 3e 6e 6f 64 65 5f 74 6f  ..<li><i>node_to
2b60: 3c 2f 69 3e 3a 20 6e 61 6d 65 20 6f 66 20 74 68  </i>: name of th
2b70: 65 20 63 6f 6c 75 6d 6e 20 28 69 6e 20 74 68 65  e column (in the
2b80: 20 61 62 6f 76 65 20 54 61 62 6c 65 20 6f 72 20   above Table or 
2b90: 56 69 65 77 29 20 65 78 70 65 63 74 65 64 20 74  View) expected t
2ba0: 6f 20 63 6f 6e 74 61 69 6e 20 3c 62 3e 6e 6f 64  o contain <b>nod
2bb0: 65 2d 74 6f 3c 2f 62 3e 20 76 61 6c 75 65 73 2e  e-to</b> values.
2bc0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e 67 65  </li>..<li><i>ge
2bd0: 6f 6d 3c 2f 69 3e 3a 20 6e 61 6d 65 20 6f 66 20  om</i>: name of 
2be0: 74 68 65 20 63 6f 6c 75 6d 6e 20 28 69 6e 20 74  the column (in t
2bf0: 68 65 20 61 62 6f 76 65 20 54 61 62 6c 65 20 6f  he above Table o
2c00: 72 20 56 69 65 77 29 20 65 78 70 65 63 74 65 64  r View) expected
2c10: 20 74 6f 20 63 6f 6e 74 61 69 6e 20 3c 62 3e 4c   to contain <b>L
2c20: 69 6e 65 73 74 72 69 6e 67 73 3c 2f 62 3e 2e 3c  inestrings</b>.<
2c30: 62 72 3e 0d 0a 57 65 20 63 6f 75 6c 64 20 68 61  br>..We could ha
2c40: 76 65 20 6c 65 67 69 74 69 6d 61 74 65 6c 79 20  ve legitimately 
2c50: 70 61 73 73 65 64 20 61 20 3c 62 3e 4e 55 4c 4c  passed a <b>NULL
2c60: 3c 2f 62 3e 20 76 61 6c 75 65 20 66 6f 72 20 74  </b> value for t
2c70: 68 69 73 20 61 72 67 75 6d 65 6e 74 20 69 6e 20  his argument in 
2c80: 74 68 65 20 63 61 73 65 20 6f 66 20 61 20 3c 62  the case of a <b
2c90: 3e 4c 6f 67 69 63 61 6c 20 4e 65 74 77 6f 72 6b  >Logical Network
2ca0: 3c 2f 62 3e 20 6f 72 20 69 66 20 77 65 20 77 65  </b> or if we we
2cb0: 72 65 6e 27 74 20 69 6e 74 65 72 65 73 74 65 64  ren't interested
2cc0: 20 74 6f 20 67 65 74 20 61 20 3c 62 3e 47 65 6f   to get a <b>Geo
2cd0: 6d 65 74 72 79 3c 2f 62 3e 20 72 65 70 72 65 73  metry</b> repres
2ce0: 65 6e 74 69 6e 67 20 61 6e 79 20 52 6f 75 74 69  enting any Routi
2cf0: 6e 67 20 73 6f 6c 75 74 69 6f 6e 2e 3c 2f 6c 69  ng solution.</li
2d00: 3e 0d 0a 3c 6c 69 3e 3c 69 3e 4e 55 4c 4c 3c 2f  >..<li><i>NULL</
2d10: 69 3e 3a 20 6e 61 6d 65 20 6f 66 20 74 68 65 20  i>: name of the 
2d20: 63 6f 6c 75 6d 6e 20 28 69 6e 20 74 68 65 20 61  column (in the a
2d30: 62 6f 76 65 20 54 61 62 6c 65 20 6f 72 20 56 69  bove Table or Vi
2d40: 65 77 29 20 65 78 70 65 63 74 65 64 20 74 6f 20  ew) expected to 
2d50: 63 6f 6e 74 61 69 6e 20 3c 62 3e 63 6f 73 74 3c  contain <b>cost<
2d60: 2f 62 3e 20 76 61 6c 75 65 73 2e 3c 62 72 3e 0d  /b> values.<br>.
2d70: 0a 49 6e 20 74 68 69 73 20 63 61 73 65 20 77 65  .In this case we
2d80: 20 68 61 76 65 20 70 61 73 73 65 64 20 61 20 3c   have passed a <
2d90: 62 3e 4e 55 4c 4c 3c 2f 62 3e 20 76 61 6c 75 65  b>NULL</b> value
2da0: 2c 20 61 6e 64 20 63 6f 6e 73 65 71 75 65 6e 74  , and consequent
2db0: 6c 79 20 74 68 65 20 3c 62 3e 63 6f 73 74 3c 2f  ly the <b>cost</
2dc0: 62 3e 20 6f 66 20 65 61 63 68 20 4c 69 6e 6b 20  b> of each Link 
2dd0: 77 69 6c 6c 20 62 65 20 61 73 73 75 6d 65 64 20  will be assumed 
2de0: 74 6f 20 62 65 20 72 65 70 72 65 73 65 6e 74 65  to be represente
2df0: 64 20 62 79 20 74 68 65 20 3c 62 3e 67 65 6f 6d  d by the <b>geom
2e00: 65 74 72 69 63 20 6c 65 6e 67 74 68 3c 2f 62 3e  etric length</b>
2e10: 20 6f 66 20 74 68 65 20 63 6f 72 72 65 73 70 6f   of the correspo
2e20: 6e 64 69 6e 67 20 4c 69 6e 65 73 74 72 69 6e 67  nding Linestring
2e30: 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 20 23  .<br>..<u>Note #
2e40: 31 3c 2f 75 3e 3a 20 69 6e 20 74 68 65 20 63 61  1</u>: in the ca
2e50: 73 65 20 6f 66 20 4e 65 74 77 6f 72 6b 73 20 62  se of Networks b
2e60: 61 73 65 64 20 6f 6e 20 61 6e 79 20 3c 62 3e 6c  ased on any <b>l
2e70: 6f 6e 67 2f 6c 61 74 3c 2f 62 3e 20 28 3c 69 3e  ong/lat</b> (<i>
2e80: 61 6b 61 3c 2f 69 3e 20 3c 62 3e 67 65 6f 67 72  aka</i> <b>geogr
2e90: 61 70 68 69 63 3c 2f 62 3e 29 20 52 65 66 65 72  aphic</b>) Refer
2ea0: 65 6e 63 65 20 53 79 73 74 65 6d 20 74 68 65 20  ence System the 
2eb0: 67 65 6f 6d 65 74 72 79 20 6c 65 6e 67 74 68 20  geometry length 
2ec0: 6f 66 20 61 6c 6c 20 4c 69 6e 65 73 74 72 69 6e  of all Linestrin
2ed0: 67 73 20 77 69 6c 6c 20 62 65 20 70 72 65 63 69  gs will be preci
2ee0: 73 65 6c 79 20 3c 62 3e 6d 65 61 73 75 72 65 64  sely <b>measured
2ef0: 20 6f 6e 20 74 68 65 20 65 6c 6c 69 70 73 6f 69   on the ellipsoi
2f00: 64 3c 2f 62 3e 20 62 79 20 61 70 70 6c 79 69 6e  d</b> by applyin
2f10: 67 20 74 68 65 20 6d 6f 73 74 20 61 63 63 75 72  g the most accur
2f20: 61 74 65 20 3c 62 3e 67 65 6f 64 65 73 69 63 20  ate <b>geodesic 
2f30: 66 6f 72 6d 75 6c 61 65 3c 2f 62 3e 20 61 6e 64  formulae</b> and
2f40: 20 77 69 6c 6c 20 62 65 20 63 6f 6e 73 65 71 75   will be consequ
2f50: 65 6e 74 6c 79 20 65 78 70 72 65 73 73 65 64 20  ently expressed 
2f60: 69 6e 20 3c 62 3e 6d 65 74 65 72 73 3c 2f 62 3e  in <b>meters</b>
2f70: 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 20 23  .<br>..<u>Note #
2f80: 32 3c 2f 75 3e 3a 20 74 68 65 20 3c 62 3e 67 65  2</u>: the <b>ge
2f90: 6f 6d 2d 63 6f 6c 75 6d 6e 3c 2f 62 3e 20 61 6e  om-column</b> an
2fa0: 64 20 3c 62 3e 63 6f 73 74 2d 63 6f 6c 75 6d 6e  d <b>cost-column
2fb0: 3c 2f 62 3e 20 61 72 67 75 6d 65 6e 74 73 20 61  </b> arguments a
2fc0: 72 65 20 6e 65 76 65 72 20 61 6c 6c 6f 77 65 64  re never allowed
2fd0: 20 74 6f 20 62 65 20 3c 62 3e 4e 55 4c 4c 3c 2f   to be <b>NULL</
2fe0: 62 3e 20 61 74 20 74 68 65 20 73 61 6d 65 20 74  b> at the same t
2ff0: 69 6d 65 2e 3c 2f 6c 69 3e 20 0d 0a 3c 2f 6f 6c  ime.</li> ..</ol
3000: 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f  >..<table bgcolo
3010: 72 3d 22 23 63 30 66 66 63 30 22 20 63 65 6c 6c  r="#c0ffc0" cell
3020: 73 70 61 63 69 6e 67 3d 22 31 30 22 20 63 65 6c  spacing="10" cel
3030: 6c 70 61 64 64 69 6e 67 3d 22 36 22 3e 3c 74 72  lpadding="6"><tr
3040: 3e 3c 74 64 3e 0d 0a 3c 68 33 3e 54 65 63 68 6e  ><td>..<h3>Techn
3050: 69 63 61 6c 20 6e 6f 74 65 3c 2f 68 33 3e 0d 0a  ical note</h3>..
3060: 54 68 65 20 69 6e 74 65 72 6e 61 6c 20 65 6e 63  The internal enc
3070: 6f 64 69 6e 67 20 61 64 6f 70 74 65 64 20 62 79  oding adopted by
3080: 20 74 68 65 20 3c 62 3e 42 69 6e 61 72 61 79 20   the <b>Binaray 
3090: 44 61 74 61 20 54 61 62 6c 65 3c 2f 62 3e 20 69  Data Table</b> i
30a0: 73 20 75 6e 63 68 61 6e 67 65 64 20 61 6e 64 20  s unchanged and 
30b0: 69 73 20 74 68 65 20 73 61 6d 65 20 66 6f 72 20  is the same for 
30c0: 62 6f 74 68 20 3c 62 3e 56 69 72 74 75 61 6c 4e  both <b>VirtualN
30d0: 65 78 74 77 6f 6b 3c 2f 62 3e 20 61 6e 64 20 3c  extwok</b> and <
30e0: 62 3e 56 69 72 74 75 61 6c 52 6f 75 74 69 6e 67  b>VirtualRouting
30f0: 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 59 6f 75 20 63  </b>.<br>..You c
3100: 61 6e 20 73 61 66 65 6c 79 20 62 61 73 65 20 61  an safely base a
3110: 20 3c 62 3e 56 69 72 74 75 61 6c 52 6f 75 74 69   <b>VirtualRouti
3120: 6e 67 20 54 61 62 6c 65 3c 2f 62 3e 20 6f 6e 20  ng Table</b> on 
3130: 61 6e 79 20 65 78 69 73 74 69 6e 67 20 42 69 6e  any existing Bin
3140: 61 72 79 20 44 61 74 61 0d 0a 54 61 62 6c 65 20  ary Data..Table 
3150: 63 72 65 61 74 65 64 20 62 79 20 74 68 65 20 3c  created by the <
3160: 62 3e 73 70 61 74 69 61 6c 69 74 65 2d 6e 65 74  b>spatialite-net
3170: 77 6f 72 6b 3c 2f 62 3e 20 43 4c 49 20 74 6f 6f  work</b> CLI too
3180: 6c 2c 20 65 78 61 63 74 6c 79 20 61 73 20 79 6f  l, exactly as yo
3190: 75 20 63 61 6e 20 62 61 73 65 20 61 20 3c 62 3e  u can base a <b>
31a0: 56 69 72 74 75 61 6c 4e 65 74 77 6f 72 6b 20 54  VirtualNetwork T
31b0: 61 62 6c 65 3c 2f 62 3e 20 6f 6e 20 61 6e 79 20  able</b> on any 
31c0: 42 69 6e 61 72 79 20 44 61 74 61 20 54 61 62 6c  Binary Data Tabl
31d0: 65 20 63 72 65 61 74 65 64 20 62 79 20 74 68 65  e created by the
31e0: 20 3c 62 3e 43 72 65 61 74 65 52 6f 75 74 69 6e   <b>CreateRoutin
31f0: 67 28 29 3c 2f 62 3e 20 53 51 4c 20 66 75 6e 63  g()</b> SQL func
3200: 74 69 6f 6e 2e 0d 0a 3c 76 65 72 62 61 74 69 6d  tion...<verbatim
3210: 3e 0d 0a 43 52 45 41 54 45 20 56 49 52 54 55 41  >..CREATE VIRTUA
3220: 4c 20 54 41 42 4c 45 20 74 65 73 74 5f 6e 65 74  L TABLE test_net
3230: 77 6f 72 6b 20 55 53 49 4e 47 20 56 69 72 74 75  work USING Virtu
3240: 61 6c 4e 65 74 77 6f 72 6b 28 27 73 6f 6d 65 5f  alNetwork('some_
3250: 64 61 74 61 5f 74 61 62 6c 65 27 29 3b 0d 0a 0d  data_table');...
3260: 0a 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20  .CREATE VIRTUAL 
3270: 54 41 42 4c 45 20 74 65 73 74 5f 72 6f 75 74 69  TABLE test_routi
3280: 6e 67 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c  ng USING Virtual
3290: 52 6f 75 74 69 6e 67 28 27 73 6f 6d 65 5f 64 61  Routing('some_da
32a0: 74 61 5f 74 61 62 6c 65 27 29 3b 0d 0a 3c 2f 76  ta_table');..</v
32b0: 65 72 62 61 74 69 6d 3e 0d 0a 49 6e 20 6f 72 64  erbatim>..In ord
32c0: 65 72 20 74 6f 20 64 6f 20 73 75 63 68 20 61 20  er to do such a 
32d0: 74 68 69 6e 67 20 79 6f 75 20 6a 75 73 74 20 68  thing you just h
32e0: 61 76 65 20 74 6f 20 65 78 65 63 75 74 65 20 61  ave to execute a
32f0: 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20 3c 62  n appropriate <b
3300: 3e 43 52 45 41 54 45 20 56 49 52 54 55 41 4c 20  >CREATE VIRTUAL 
3310: 54 41 42 4c 45 3c 2f 62 3e 20 73 74 61 74 65 6d  TABLE</b> statem
3320: 65 6e 74 2e 0d 0a 3c 68 34 3e 57 61 72 6e 69 6e  ent...<h4>Warnin
3330: 67 3c 2f 68 34 3e 0d 0a 49 6e 20 74 68 65 20 63  g</h4>..In the c
3340: 61 73 65 20 6f 66 20 3c 62 3e 53 70 61 74 69 61  ase of <b>Spatia
3350: 6c 20 4e 65 74 77 6f 72 6b 73 3c 2f 62 3e 20 62  l Networks</b> b
3360: 61 73 65 64 20 6f 6e 20 61 6e 79 20 3c 62 3e 67  ased on any <b>g
3370: 65 6f 67 72 61 70 68 69 63 3c 2f 62 3e 20 52 65  eographic</b> Re
3380: 66 65 72 65 6e 63 65 20 53 79 73 74 65 6d 20 28  ference System (
3390: 75 69 6e 67 20 3c 62 3e 6c 6f 6e 67 69 74 75 64  uing <b>longitud
33a0: 65 73 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 6c 61  es</b> and <b>la
33b0: 74 69 74 75 64 65 73 3c 2f 62 3e 29 20 74 68 65  titudes</b>) the
33c0: 72 65 20 69 73 20 61 6e 20 69 6d 70 6f 72 74 61  re is an importa
33d0: 6e 74 20 64 69 66 66 65 72 65 6e 63 65 20 62 65  nt difference be
33e0: 74 77 65 65 6e 20 42 69 6e 61 72 79 20 44 61 74  tween Binary Dat
33f0: 61 20 54 61 62 6c 65 73 20 63 72 65 61 74 65 64  a Tables created
3400: 20 62 79 20 74 68 65 20 3c 62 3e 73 70 61 74 69   by the <b>spati
3410: 61 6c 69 74 65 5f 6e 65 74 77 6f 72 6b 3c 2f 62  alite_network</b
3420: 3e 20 47 55 49 20 74 6f 6f 6c 20 61 6e 64 20 20  > GUI tool and  
3430: 42 69 6e 61 72 79 20 44 61 74 61 20 54 61 62 6c  Binary Data Tabl
3440: 65 73 20 63 72 65 61 74 65 64 20 62 79 20 74 68  es created by th
3450: 65 20 3c 62 3e 43 72 65 61 74 65 52 6f 75 74 69  e <b>CreateRouti
3460: 6e 67 3c 2f 62 3e 20 53 51 4c 20 66 75 6e 63 74  ng</b> SQL funct
3470: 69 6f 6e 20 77 68 65 6e 20 74 68 65 20 3c 62 3e  ion when the <b>
3480: 63 6f 73 74 3c 2f 62 3e 20 69 73 20 69 6d 70 6c  cost</b> is impl
3490: 69 63 69 74 6c 79 20 62 61 73 65 64 20 6f 6e 20  icitly based on 
34a0: 74 68 65 20 67 65 6f 6d 65 74 72 69 63 20 6c 65  the geometric le
34b0: 6e 67 74 68 20 6f 66 20 74 68 65 20 4c 69 6e 6b  ngth of the Link
34c0: 27 73 20 4c 69 6e 65 73 74 72 69 6e 67 3a 0d 0a  's Linestring:..
34d0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 3c 62  <ul>..<li>the <b
34e0: 3e 73 70 61 74 69 61 6c 69 74 65 5f 6e 65 74 77  >spatialite_netw
34f0: 6f 72 6b 3c 2f 62 3e 20 43 4c 49 20 74 6f 6f 6c  ork</b> CLI tool
3500: 20 28 61 6e 64 20 74 68 65 20 3c 62 3e 47 55 49   (and the <b>GUI
3510: 20 77 69 7a 61 72 64 3c 2f 62 3e 20 69 6d 70 6c   wizard</b> impl
3520: 65 6d 65 6e 74 65 64 20 62 79 20 70 72 65 76 69  emented by previ
3530: 6f 75 73 20 76 65 72 73 69 6f 6e 73 20 6f 66 20  ous versions of 
3540: 3c 62 3e 73 70 61 74 69 61 6c 69 74 65 5f 67 75  <b>spatialite_gu
3550: 69 3c 2f 62 3e 29 20 63 6f 6d 70 75 74 65 20 74  i</b>) compute t
3560: 68 65 20 4c 69 6e 65 73 74 72 69 6e 67 27 73 20  he Linestring's 
3570: 6c 65 6e 67 74 68 20 61 73 20 61 6e 20 3c 62 3e  length as an <b>
3580: 61 6e 67 75 6c 61 72 20 64 69 73 74 61 6e 63 65  angular distance
3590: 3c 2f 62 3e 20 65 78 70 72 65 73 73 65 64 20 69  </b> expressed i
35a0: 6e 20 3c 62 3e 64 65 67 72 65 65 73 3c 2f 62 3e  n <b>degrees</b>
35b0: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20  .</li>..<li>the 
35c0: 3c 62 3e 43 72 65 61 74 65 52 6f 75 74 69 6e 67  <b>CreateRouting
35d0: 28 29 3c 2f 62 3e 20 53 51 4c 20 66 75 6e 63 74  ()</b> SQL funct
35e0: 69 6f 6e 20 63 6f 6d 70 75 74 65 73 20 74 68 65  ion computes the
35f0: 20 4c 69 6e 65 73 74 72 69 6e 67 27 73 20 6c 65   Linestring's le
3600: 6e 67 74 68 20 61 73 20 61 20 3c 62 3e 6c 69 6e  ngth as a <b>lin
3610: 65 61 72 20 64 69 73 74 61 6e 63 65 3c 2f 62 3e  ear distance</b>
3620: 20 65 78 70 72 65 73 73 65 64 20 69 6e 20 3c 62   expressed in <b
3630: 3e 6d 65 74 72 65 73 3c 2f 62 3e 20 62 79 20 61  >metres</b> by a
3640: 70 70 6c 79 69 6e 67 20 74 68 65 20 6d 6f 73 74  pplying the most
3650: 20 61 63 63 75 72 61 74 65 20 3c 62 3e 67 65 6f   accurate <b>geo
3660: 64 65 73 69 63 20 66 6f 72 6d 75 6c 61 65 3c 2f  desic formulae</
3670: 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d  b>.</li>..</ul>.
3680: 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62  .</td></tr></tab
3690: 6c 65 3e 0d 0a 0d 0a 0d 0a 3c 68 72 3e 3c 62 72  le>......<hr><br
36a0: 3e 0d 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 70  >..<a href="http
36b0: 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73  s://www.gaia-gis
36c0: 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70  .it/fossil/libsp
36d0: 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61  atialite/wiki?na
36e0: 6d 65 3d 34 2e 33 2e 30 2d 64 6f 63 22 3e 62 61  me=4.3.0-doc">ba
36f0: 63 6b 3c 2f 61 3e 0a 5a 20 31 39 64 35 37 32 65  ck</a>.Z 19d572e
3700: 65 32 61 61 66 61 62 31 65 39 66 66 32 37 33 64  e2aafab1e9ff273d
3710: 64 33 64 32 36 30 32 61 30 0a                    d3d2602a0.