Wiki page
[VirtualRouting] by
sandro
2018-04-02 12:35:39.
0000: 44 20 32 30 31 38 2d 30 34 2d 30 32 54 31 32 3a D 2018-04-02T12:
0010: 33 35 3a 33 39 2e 38 32 34 0a 4c 20 56 69 72 74 35:39.824.L Virt
0020: 75 61 6c 52 6f 75 74 69 6e 67 0a 50 20 32 35 39 ualRouting.P 259
0030: 61 62 31 63 39 38 38 32 32 64 32 34 34 39 65 65 ab1c98822d2449ee
0040: 63 37 64 62 35 30 39 64 32 61 64 31 66 38 33 66 c7db509d2ad1f83f
0050: 61 33 31 37 66 0a 55 20 73 61 6e 64 72 6f 0a 57 a317f.U sandro.W
0060: 20 32 38 30 36 34 0a 3c 61 20 68 72 65 66 3d 22 28064.<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 54 61 62 6c 65 20 6f 66 r>..<h1>Table of
00d0: 20 43 6f 6e 74 65 6e 74 73 3c 2f 68 31 3e 0d 0a Contents</h1>..
00e0: 31 20 2d 20 3c 61 20 68 72 65 66 3d 22 23 69 6e 1 - <a href="#in
00f0: 74 72 6f 22 3e 49 6e 74 72 6f 64 75 63 74 69 6f tro">Introductio
0100: 6e 3c 2f 61 3e 3c 62 72 3e 0d 0a 32 20 2d 20 3c n</a><br>..2 - <
0110: 61 20 68 72 65 66 3d 22 23 73 61 6d 70 6c 65 22 a href="#sample"
0120: 3e 54 68 65 20 73 61 6d 70 6c 65 2f 74 65 73 74 >The sample/test
0130: 20 44 42 3c 2f 61 3e 3c 62 72 3e 0d 0a 33 20 2d DB</a><br>..3 -
0140: 20 3c 61 20 68 72 65 66 3d 22 23 63 72 65 61 74 <a href="#creat
0150: 65 22 3e 43 72 65 61 74 69 6e 67 20 56 69 72 74 e">Creating Virt
0160: 75 61 6c 52 6f 75 74 69 6e 67 20 54 61 62 6c 65 ualRouting Table
0170: 73 3c 2f 61 3e 3c 62 72 3e 0d 0a 3c 62 72 3e 3c s</a><br>..<br><
0180: 68 72 3e 0d 0a 3c 68 31 3e 3c 61 20 6e 61 6d 65 hr>..<h1><a name
0190: 3d 22 69 6e 74 72 6f 22 3e 31 20 2d 20 49 6e 74 ="intro">1 - Int
01a0: 72 6f 64 75 63 74 69 6f 6e 3c 2f 61 3e 3c 2f 68 roduction</a></h
01b0: 31 3e 0d 0a 50 72 65 76 69 6f 75 73 20 76 65 72 1>..Previous ver
01c0: 73 69 6f 6e 73 20 6f 66 20 53 70 61 74 69 61 4c sions of SpatiaL
01d0: 69 74 65 20 74 72 61 64 69 74 69 6f 6e 61 6c 6c ite traditionall
01e0: 79 20 73 75 70 70 6f 72 74 65 64 20 61 20 3c 62 y supported a <b
01f0: 3e 70 75 72 65 20 53 51 4c 20 72 6f 75 74 69 6e >pure SQL routin
0200: 67 20 6d 6f 64 75 6c 65 3c 2f 62 3e 20 74 68 61 g module</b> tha
0210: 74 20 77 61 73 20 6e 61 6d 65 64 20 3c 61 20 68 t was named <a h
0220: 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 ref="https://www
0230: 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73 .gaia-gis.it/fos
0240: 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c 69 74 sil/libspatialit
0250: 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 56 69 72 74 e/wiki?name=Virt
0260: 75 61 6c 4e 65 74 77 6f 72 6b 2b 72 65 6c 6f 61 ualNetwork+reloa
0270: 64 65 64 22 3e 56 69 72 74 75 61 6c 4e 65 74 77 ded">VirtualNetw
0280: 6f 72 6b 3c 2f 61 3e 2e 3c 62 72 3e 3c 62 72 3e ork</a>.<br><br>
0290: 0d 0a 53 69 6e 63 65 20 76 65 72 73 69 6f 6e 20 ..Since version
02a0: 3c 62 3e 35 2e 30 2e 30 3c 2f 62 3e 20 61 20 62 <b>5.0.0</b> a b
02b0: 72 61 6e 64 20 6e 65 77 20 3c 62 3e 72 6f 75 74 rand new <b>rout
02c0: 69 6e 67 20 6d 6f 64 75 6c 65 3c 2f 62 3e 20 28 ing module</b> (
02d0: 6d 6f 72 65 20 61 64 76 61 6e 63 65 64 20 61 6e more advanced an
02e0: 64 20 73 6f 70 68 69 73 74 69 63 61 74 65 64 29 d sophisticated)
02f0: 20 69 73 20 61 76 61 69 6c 61 62 6c 65 2c 20 74 is available, t
0300: 68 61 74 20 69 73 20 63 61 6c 6c 65 64 20 3c 62 hat is called <b
0310: 3e 56 69 72 74 75 61 6c 52 6f 75 74 69 6e 67 3c >VirtualRouting<
0320: 2f 62 3e 2e 3c 62 72 3e 0d 0a 54 68 65 20 6e 6f /b>.<br>..The no
0330: 77 20 6f 62 73 6f 6c 65 74 65 20 3c 62 3e 56 69 w obsolete <b>Vi
0340: 72 74 75 61 6c 4e 65 74 77 6f 72 6b 3c 2f 62 3e rtualNetwork</b>
0350: 20 69 73 20 73 74 69 6c 6c 20 73 75 70 70 6f 72 is still suppor
0360: 74 65 64 20 62 79 20 76 65 72 73 69 6f 6e 20 3c ted by version <
0370: 62 3e 35 2e 30 2e 30 3c 2f 62 3e 20 73 6f 20 61 b>5.0.0</b> so a
0380: 73 20 74 6f 20 6e 6f 74 20 63 61 75 73 65 20 61 s to not cause a
0390: 6e 20 61 62 72 75 70 74 20 62 72 65 61 6b 20 74 n abrupt break t
03a0: 6f 20 61 6c 72 65 61 64 79 20 65 78 69 73 74 69 o already existi
03b0: 6e 67 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 2c ng applications,
03c0: 20 62 75 74 20 77 69 6c 6c 20 70 72 65 73 75 6d but will presum
03d0: 61 62 6c 79 20 62 65 20 64 69 73 63 6f 6e 74 69 ably be disconti
03e0: 6e 75 65 64 20 69 6e 20 66 75 74 75 72 65 20 76 nued in future v
03f0: 65 72 73 69 6f 6e 73 2e 3c 62 72 3e 0d 0a 55 73 ersions.<br>..Us
0400: 69 6e 67 20 3c 62 3e 56 69 72 74 75 61 6c 52 6f ing <b>VirtualRo
0410: 75 74 69 6e 67 3c 2f 62 3e 20 69 6e 73 74 65 61 uting</b> instea
0420: 64 20 6f 66 20 3c 62 3e 56 69 72 74 75 61 6c 4e d of <b>VirtualN
0430: 65 74 77 69 72 6b 3c 2f 62 3e 20 69 73 20 77 61 etwirk</b> is wa
0440: 72 6d 6c 79 20 72 65 63 6f 6d 6d 65 6e 64 65 64 rmly recommended
0450: 20 66 6f 72 20 61 6e 79 20 6e 65 77 20 64 65 76 for any new dev
0460: 65 6c 6f 70 6d 65 6e 74 2e 20 0d 0a 3c 68 32 3e elopment. ..<h2>
0470: 54 68 65 6f 72 65 74 69 63 61 6c 20 66 6f 75 6e Theoretical foun
0480: 64 61 74 69 6f 6e 73 20 2d 20 61 6e 20 75 6c 74 dations - an ult
0490: 72 61 2d 71 75 69 63 6b 20 72 65 63 61 6c 6c 3c ra-quick recall<
04a0: 2f 68 32 3e 0d 0a 41 6c 6c 20 3c 62 3e 52 6f 75 /h2>..All <b>Rou
04b0: 74 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d 73 3c ting algorithms<
04c0: 2f 62 3e 20 28 3c 69 3e 61 6b 61 3c 2f 69 3e 20 /b> (<i>aka</i>
04d0: 3c 62 3e 53 68 6f 72 74 65 73 74 20 50 61 74 68 <b>Shortest Path
04e0: 3c 2f 62 3e 20 61 6c 67 6f 72 69 74 68 6d 73 29 </b> algorithms)
04f0: 20 61 72 65 20 62 61 73 65 64 20 6f 6e 20 74 68 are based on th
0500: 65 20 6d 61 74 68 65 6d 61 74 69 63 73 20 6f 66 e mathematics of
0510: 20 74 68 65 20 3c 61 20 68 72 65 66 3d 22 68 74 the <a href="ht
0520: 74 70 73 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 64 tps://en.wikiped
0530: 69 61 2e 6f 72 67 2f 77 69 6b 69 2f 47 72 61 70 ia.org/wiki/Grap
0540: 68 5f 74 68 65 6f 72 79 22 3e 47 72 61 70 68 20 h_theory">Graph
0550: 74 68 65 6f 72 79 3c 2f 61 3e 20 6f 72 20 74 6f theory</a> or to
0560: 20 62 65 20 6d 6f 72 65 20 70 72 65 63 69 73 65 be more precise
0570: 3a 20 6f 6e 20 3c 62 3e 57 65 69 67 68 74 65 64 : on <b>Weighted
0580: 20 47 72 61 70 68 73 3c 2f 62 3e 2e 0d 0a 3c 62 Graphs</b>...<b
0590: 72 3e 0d 0a 3c 69 6d 67 20 73 72 63 3d 22 68 74 r>..<img src="ht
05a0: 74 70 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 tp://www.gaia-gi
05b0: 73 2e 69 74 2f 67 61 69 61 2d 73 69 6e 73 2f 6e s.it/gaia-sins/n
05c0: 65 74 77 6f 72 6b 2e 70 6e 67 22 20 61 6c 74 3d etwork.png" alt=
05d0: 22 6e 65 74 77 6f 72 6b 22 3e 0d 0a 3c 62 72 3e "network">..<br>
05e0: 0d 0a 41 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 6c ..A topologicall
05f0: 79 20 76 61 6c 69 64 20 3c 62 3e 4e 65 74 77 6f y valid <b>Netwo
0600: 72 6b 3c 2f 62 3e 20 69 73 20 61 20 64 61 74 61 rk</b> is a data
0610: 73 65 74 20 74 68 61 74 20 66 75 6c 66 69 6c 6c set that fulfill
0620: 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 s the following
0630: 72 65 71 75 69 72 65 6d 65 6e 74 73 3a 0d 0a 3c requirements:..<
0640: 75 6c 3e 0d 0a 3c 6c 69 3e 41 6c 6c 20 69 74 65 ul>..<li>All ite
0650: 6d 73 20 69 6e 20 74 68 65 20 64 61 74 61 73 65 ms in the datase
0660: 74 20 61 72 65 20 63 61 6c 6c 65 64 20 3c 62 3e t are called <b>
0670: 4c 69 6e 6b 73 3c 2f 62 3e 20 28 3c 69 3e 61 6b Links</b> (<i>ak
0680: 61 3c 2f 69 3e 20 3c 62 3e 41 72 63 73 3c 2f 62 a</i> <b>Arcs</b
0690: 3e 29 2c 20 61 6e 64 20 61 72 65 20 65 78 70 65 >), and are expe
06a0: 63 74 65 64 20 74 6f 20 72 65 70 72 65 73 65 6e cted to represen
06b0: 74 20 73 6f 6d 65 20 6f 72 69 65 6e 74 65 64 20 t some oriented
06c0: 63 6f 6e 6e 65 63 74 69 6f 6e 20 6a 6f 69 6e 69 connection joini
06d0: 6e 67 20 74 77 6f 20 3c 62 3e 4e 6f 64 65 73 3c ng two <b>Nodes<
06e0: 2f 62 3e 2e 3c 62 72 3e 0d 0a 3c 75 3e 45 78 61 /b>.<br>..<u>Exa
06f0: 6d 70 6c 65 3c 2f 75 3e 3a 20 69 6e 20 74 68 65 mple</u>: in the
0700: 20 61 62 6f 76 65 20 66 69 67 75 72 65 20 4c 69 above figure Li
0710: 6e 6b 20 3c 62 3e 4c 33 3c 2f 62 3e 20 63 6f 6e nk <b>L3</b> con
0720: 6e 65 63 74 73 20 4e 6f 64 65 73 20 3c 62 3e 4e nects Nodes <b>N
0730: 32 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 4e 35 3c 2</b> and <b>N5<
0740: 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 53 /b>.</li>..<li>S
0750: 6f 20 61 6c 6c 20 3c 62 3e 4c 69 6e 6b 73 3c 2f o all <b>Links</
0760: 62 3e 20 61 72 65 20 61 6c 77 61 79 73 20 65 78 b> are always ex
0770: 70 65 63 74 65 64 20 74 6f 20 65 78 70 6c 69 63 pected to explic
0780: 69 74 6c 79 20 72 65 66 65 72 65 6e 63 65 20 61 itly reference a
0790: 20 3c 62 3e 53 74 61 72 74 2d 4e 6f 64 65 3c 2f <b>Start-Node</
07a0: 62 3e 20 28 3c 69 3e 61 6b 61 3c 2f 69 3e 20 3c b> (<i>aka</i> <
07b0: 62 3e 4e 6f 64 65 2d 46 72 6f 6d 3c 2f 62 3e 29 b>Node-From</b>)
07c0: 20 61 6e 64 20 61 6e 20 3c 62 3e 45 6e 64 2d 4e and an <b>End-N
07d0: 6f 64 65 3c 2f 62 3e 20 28 3c 69 3e 61 6b 61 3c ode</b> (<i>aka<
07e0: 2f 69 3e 20 3c 62 3e 4e 6f 64 65 2d 54 6f 3c 2f /i> <b>Node-To</
07f0: 62 3e 29 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e b>)...<ul>..<li>
0800: 4c 69 6e 6b 73 20 61 72 65 20 61 6c 77 61 79 73 Links are always
0810: 20 3c 62 3e 6f 72 69 65 6e 74 65 64 3c 2f 62 3e <b>oriented</b>
0820: 2c 20 61 6e 64 20 74 68 65 69 72 20 6e 61 74 75 , and their natu
0830: 72 61 6c 20 64 69 72 65 63 74 69 6f 6e 20 69 73 ral direction is
0840: 20 3c 62 3e 46 72 6f 6d 2d 54 6f 3c 2f 62 3e 3a <b>From-To</b>:
0850: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69 6e 20 61 ..<ul>..<li>in a
0860: 6e 20 3c 62 3e 75 6e 69 64 69 72 65 63 74 69 6f n <b>unidirectio
0870: 6e 61 6c 3c 2f 62 3e 20 4e 65 74 77 6f 72 6b 20 nal</b> Network
0880: 65 61 63 68 20 4c 69 6e 6b 20 69 73 20 61 6e 20 each Link is an
0890: 3c 62 3e 6f 6e 65 2d 77 61 79 3c 2f 62 3e 20 63 <b>one-way</b> c
08a0: 6f 6e 6e 65 63 74 69 6f 6e 2e 3c 62 72 3e 0d 0a onnection.<br>..
08b0: 49 66 20 74 68 65 20 63 6f 6e 6e 65 63 74 69 6f If the connectio
08c0: 6e 20 69 73 20 61 76 61 69 6c 61 62 6c 65 20 69 n is available i
08d0: 6e 20 74 68 65 20 6f 70 70 6f 73 69 74 65 20 64 n the opposite d
08e0: 69 72 65 63 74 69 6f 6e 20 61 20 73 65 63 6f 6e irection a secon
08f0: 64 20 4c 69 6e 6b 20 6d 75 73 74 20 62 65 20 65 d Link must be e
0900: 78 70 6c 69 63 69 74 6c 79 20 64 65 63 6c 61 72 xplicitly declar
0910: 65 64 2e 3c 62 72 3e 0d 0a 3c 75 3e 45 78 61 6d ed.<br>..<u>Exam
0920: 70 6c 65 3c 2f 75 3e 3a 20 4c 69 6e 6b 20 3c 62 ple</u>: Link <b
0930: 3e 58 31 3c 2f 62 3e 20 67 6f 65 73 20 66 72 6f >X1</b> goes fro
0940: 6d 20 4e 6f 64 65 20 3c 62 3e 41 3c 2f 62 3e 20 m Node <b>A</b>
0950: 74 6f 20 4e 6f 64 65 20 3c 62 3e 42 3c 2f 62 3e to Node <b>B</b>
0960: 2c 20 61 6e 64 20 4c 69 6e 6b 20 3c 62 3e 58 32 , and Link <b>X2
0970: 3c 2f 62 3e 20 67 6f 65 73 20 66 72 6f 6d 20 4e </b> goes from N
0980: 6f 64 65 20 3c 62 3e 42 3c 2f 62 3e 20 74 6f 20 ode <b>B</b> to
0990: 4e 6f 64 65 20 3c 62 3e 41 3c 2f 62 3e 2e 3c 2f Node <b>A</b>.</
09a0: 6c 69 3e 0d 0a 3c 6c 69 3e 69 6e 20 61 20 3c 62 li>..<li>in a <b
09b0: 3e 62 69 64 69 72 65 63 74 69 6f 6e 61 6c 3c 2f >bidirectional</
09c0: 62 3e 20 4e 65 74 77 6f 72 6b 20 61 6c 6c 20 4c b> Network all L
09d0: 69 6e 6b 73 20 61 72 65 20 61 73 73 75 6d 65 64 inks are assumed
09e0: 20 74 6f 20 65 73 74 61 62 6c 69 73 68 20 61 20 to establish a
09f0: 63 6f 6e 6e 65 63 74 69 6f 6e 20 69 6e 20 62 6f connection in bo
0a00: 74 68 20 64 69 72 65 63 74 69 6f 6e 73 2e 3c 62 th directions.<b
0a10: 72 3e 0d 0a 44 65 66 69 6e 69 74 69 6e 67 20 61 r>..Definiting a
0a20: 6e 20 3c 62 3e 6f 6e 65 2d 77 61 79 20 63 6f 6e n <b>one-way con
0a30: 6e 65 63 74 69 6f 6e 3c 2f 62 3e 20 72 65 71 75 nection</b> requ
0a40: 69 72 65 73 20 61 6e 20 61 70 70 72 6f 70 72 69 ires an appropri
0a50: 61 74 65 20 61 74 74 72 69 62 75 74 65 20 74 6f ate attribute to
0a60: 20 62 65 20 73 65 74 20 28 73 65 65 20 62 65 6c be set (see bel
0a70: 6f 77 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e ow).</li>..</ul>
0a80: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 65 20 3c </li>..<li>The <
0a90: 62 3e 53 74 61 72 74 2d 3c 2f 62 3e 20 61 6e 64 b>Start-</b> and
0aa0: 20 3c 62 3e 45 6e 64 2d 4e 6f 64 65 3c 2f 62 3e <b>End-Node</b>
0ab0: 20 63 6f 75 6c 64 20 65 76 65 6e 74 75 61 6c 6c could eventuall
0ac0: 79 20 62 65 20 74 68 65 20 73 61 6d 65 2c 20 61 y be the same, a
0ad0: 6e 64 20 69 6e 20 74 68 69 73 20 63 61 73 65 20 nd in this case
0ae0: 77 65 27 6c 6c 20 68 61 76 65 20 61 20 3c 62 3e we'll have a <b>
0af0: 73 65 6c 66 2d 63 6c 6f 73 65 64 3c 2f 62 3e 20 self-closed</b>
0b00: 4c 69 6e 6b 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e Link.</li>..<li>
0b10: 4e 65 74 77 6f 72 6b 27 73 20 4c 69 6e 6b 73 20 Network's Links
0b20: 3c 62 3e 63 61 6e 3c 2f 62 3e 20 65 76 65 6e 74 <b>can</b> event
0b30: 75 61 6c 6c 79 20 64 65 66 69 6e 65 20 61 20 6c ually define a l
0b40: 69 6e 65 61 72 20 47 65 6f 6d 65 74 72 79 20 28 inear Geometry (
0b50: 3c 62 3e 4c 49 4e 45 53 54 52 49 4e 47 3c 2f 62 <b>LINESTRING</b
0b60: 3e 29 20 67 6f 69 6e 67 20 66 72 6f 6d 20 74 68 >) going from th
0b70: 65 20 3c 62 3e 53 74 61 72 74 2d 4e 6f 64 65 3c e <b>Start-Node<
0b80: 2f 62 3e 20 74 6f 20 74 68 65 20 3c 62 3e 45 6e /b> to the <b>En
0b90: 64 2d 4e 6f 64 65 3c 2f 62 3e 2c 20 62 75 74 20 d-Node</b>, but
0ba0: 74 68 69 73 20 69 73 20 61 6e 20 6f 70 74 69 6f this is an optio
0bb0: 6e 61 6c 20 66 65 61 74 75 72 65 2c 20 6e 6f 74 nal feature, not
0bc0: 20 61 20 6d 61 6e 64 61 74 6f 72 79 20 72 65 71 a mandatory req
0bd0: 75 69 72 65 6d 65 6e 74 2e 3c 2f 6c 69 3e 0d 0a uirement.</li>..
0be0: 3c 6c 69 3e 57 68 61 74 20 69 73 20 61 62 73 6f <li>What is abso
0bf0: 6c 75 74 65 6c 79 20 6d 61 6e 64 61 74 6f 72 79 lutely mandatory
0c00: 20 69 73 20 74 68 61 74 20 65 61 63 68 20 3c 62 is that each <b
0c10: 3e 4c 69 6e 6b 3c 2f 62 3e 20 6d 75 73 74 20 65 >Link</b> must e
0c20: 78 70 6c 69 63 69 74 6c 79 20 72 65 66 65 72 65 xplicitly refere
0c30: 6e 63 65 20 69 74 73 20 3c 62 3e 4e 6f 64 65 73 nce its <b>Nodes
0c40: 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c </b>.</li>..</ul
0c50: 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 41 20 4e 65 ></li>..<li>A Ne
0c60: 74 77 6f 72 6b 20 73 75 70 70 6f 72 74 69 6e 67 twork supporting
0c70: 20 47 65 6f 6d 65 74 72 69 65 73 20 69 73 20 61 Geometries is a
0c80: 20 3c 62 3e 53 70 61 74 69 61 6c 20 4e 65 74 77 <b>Spatial Netw
0c90: 6f 72 6b 3c 2f 62 3e 3b 20 6f 74 68 65 72 77 69 ork</b>; otherwi
0ca0: 73 65 20 61 20 4e 65 74 77 6f 72 6b 20 6c 61 63 se a Network lac
0cb0: 6b 69 6e 67 20 61 6e 79 20 47 65 6f 6d 65 74 72 king any Geometr
0cc0: 79 20 69 73 20 61 20 3c 62 3e 4c 6f 67 69 63 61 y is a <b>Logica
0cd0: 6c 20 4e 65 74 77 6f 72 6b 3c 2f 62 3e 2e 0d 0a l Network</b>...
0ce0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 49 6e 20 61 20 3c <ul>..<li>In a <
0cf0: 62 3e 53 70 61 74 69 61 6c 20 4e 65 74 77 6f 72 b>Spatial Networ
0d00: 6b 3c 2f 62 3e 20 61 6c 6c 20 4c 69 6e 6b 73 20 k</b> all Links
0d10: 3c 62 3e 6d 75 73 74 3c 2f 62 3e 20 68 61 76 65 <b>must</b> have
0d20: 20 61 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 a corresponding
0d30: 20 47 65 6f 6d 65 74 72 79 2e 3c 2f 6c 69 3e 0d Geometry.</li>.
0d40: 0a 3c 6c 69 3e 49 6e 20 61 20 3c 62 3e 4c 6f 67 .<li>In a <b>Log
0d50: 69 63 61 6c 20 4e 65 74 77 6f 72 6b 3c 2f 62 3e ical Network</b>
0d60: 20 61 6c 6c 20 4c 69 6e 6b 73 20 3c 62 3e 61 72 all Links <b>ar
0d70: 65 20 73 74 72 69 63 74 6c 79 20 66 6f 72 62 69 e strictly forbi
0d80: 64 64 65 6e 3c 2f 62 3e 20 74 6f 20 68 61 76 65 dden</b> to have
0d90: 20 61 6e 79 20 47 65 6f 6d 65 74 72 79 2e 3c 2f any Geometry.</
0da0: 6c 69 3e 0d 0a 3c 6c 69 3e 49 6e 20 61 20 3c 62 li>..<li>In a <b
0db0: 3e 53 70 61 74 69 61 6c 20 4e 65 74 77 6f 72 6b >Spatial Network
0dc0: 3c 2f 62 3e 20 62 6f 74 68 20 74 68 65 20 3c 62 </b> both the <b
0dd0: 3e 53 74 61 72 74 50 6f 69 6e 74 3c 2f 62 3e 20 >StartPoint</b>
0de0: 61 6e 64 20 3c 62 3e 45 6e 64 50 6f 69 6e 74 3c and <b>EndPoint<
0df0: 2f 62 3e 20 6f 66 20 65 61 63 68 20 4c 69 6e 6b /b> of each Link
0e00: 27 73 20 3c 62 3e 4c 49 4e 45 53 54 52 49 4e 47 's <b>LINESTRING
0e10: 3c 2f 62 3e 20 61 72 65 20 61 6c 77 61 79 73 20 </b> are always
0e20: 65 78 70 65 63 74 65 64 20 74 6f 20 65 78 61 63 expected to exac
0e30: 74 6c 79 20 63 6f 69 6e 63 69 64 65 20 77 69 74 tly coincide wit
0e40: 68 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 h the correspond
0e50: 69 6e 67 20 3c 62 3e 4e 6f 64 65 73 3c 2f 62 3e ing <b>Nodes</b>
0e60: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c .</li>..</ul></l
0e70: 69 3e 0d 0a 3c 6c 69 3e 49 6e 20 61 20 3c 62 3e i>..<li>In a <b>
0e80: 53 70 61 74 69 61 6c 20 4e 65 74 77 6f 72 6b 3c Spatial Network<
0e90: 2f 62 3e 20 61 6c 6c 20 72 65 66 65 72 65 6e 63 /b> all referenc
0ea0: 65 73 20 74 6f 20 74 68 65 20 73 61 6d 65 20 3c es to the same <
0eb0: 62 3e 4e 6f 64 65 3c 2f 62 3e 20 62 79 20 64 69 b>Node</b> by di
0ec0: 66 66 65 72 65 6e 74 20 4c 69 6e 6b 73 20 3c 62 fferent Links <b
0ed0: 3e 6d 75 73 74 3c 2f 62 3e 20 62 65 20 61 6e 20 >must</b> be an
0ee0: 65 78 61 63 74 20 6d 61 74 63 68 2e 3c 62 72 3e exact match.<br>
0ef0: 0d 0a 3c 75 3e 45 78 61 6d 70 6c 65 3c 2f 75 3e ..<u>Example</u>
0f00: 3a 20 4e 6f 64 65 20 3c 62 3e 4e 35 3c 2f 62 3e : Node <b>N5</b>
0f10: 20 69 73 20 73 68 61 72 65 64 20 62 79 20 4c 69 is shared by Li
0f20: 6e 6b 73 20 3c 62 3e 4c 33 3c 2f 62 3e 2c 20 3c nks <b>L3</b>, <
0f30: 62 3e 4c 36 3c 2f 62 3e 2c 20 3c 62 3e 4c 37 3c b>L6</b>, <b>L7<
0f40: 2f 62 3e 2c 20 3c 62 3e 4c 39 3c 2f 62 3e 20 61 /b>, <b>L9</b> a
0f50: 6e 64 20 3c 62 3e 4c 31 30 3c 2f 62 3e 2c 20 73 nd <b>L10</b>, s
0f60: 6f 20 61 6c 6c 20 74 68 65 69 72 20 63 6f 72 72 o all their corr
0f70: 65 73 70 6f 6e 64 69 6e 67 20 4c 49 4e 45 53 54 esponding LINEST
0f80: 52 49 4e 47 53 20 61 72 65 20 65 78 70 65 63 74 RINGS are expect
0f90: 65 64 20 74 6f 20 68 61 76 65 20 74 68 65 20 63 ed to have the c
0fa0: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 65 78 74 orresponding ext
0fb0: 72 65 6d 69 74 79 20 28 3c 62 3e 53 74 61 72 74 remity (<b>Start
0fc0: 2d 3c 2f 62 3e 20 6f 72 20 3c 62 3e 45 6e 64 2d -</b> or <b>End-
0fd0: 3c 2f 62 3e 2c 20 64 65 70 65 6e 64 69 6e 67 20 </b>, depending
0fe0: 6f 6e 20 74 68 65 20 6f 72 69 65 6e 74 61 74 69 on the orientati
0ff0: 6f 6e 29 20 70 6f 69 6e 74 73 20 74 68 61 74 20 on) points that
1000: 6d 75 73 74 20 65 78 61 63 74 6c 79 20 6d 61 74 must exactly mat
1010: 63 68 20 74 68 65 20 6f 74 68 65 72 2e 3c 62 72 ch the other.<br
1020: 3e 0d 0a 41 20 3c 62 3e 74 6f 70 6f 6c 6f 67 69 >..A <b>topologi
1030: 63 61 6c 20 69 6e 63 6f 6e 73 69 73 74 65 6e 63 cal inconsistenc
1040: 79 3c 2f 62 3e 20 65 78 69 73 74 73 20 69 66 20 y</b> exists if
1050: 61 6e 79 20 6f 66 20 74 68 65 73 65 20 63 6f 6e any of these con
1060: 64 69 74 69 6f 6e 73 20 61 72 65 20 6e 6f 74 20 ditions are not
1070: 73 61 74 69 73 66 69 65 64 2c 20 77 68 69 63 68 satisfied, which
1080: 20 6c 65 61 64 73 20 74 6f 20 61 6e 20 3c 62 3e leads to an <b>
1090: 69 6e 76 61 6c 69 64 3c 2f 62 3e 20 4e 65 74 77 invalid</b> Netw
10a0: 6f 72 6b 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 49 ork.</li>..<li>I
10b0: 6e 20 61 20 3c 62 3e 53 70 61 74 69 61 6c 20 4e n a <b>Spatial N
10c0: 65 74 77 6f 72 6b 3c 2f 62 3e 20 74 77 6f 0d 0a etwork</b> two..
10d0: 3c 6c 69 3e 41 63 63 6f 72 64 69 6e 67 6c 79 20 <li>Accordingly
10e0: 74 6f 20 74 68 65 20 61 62 6f 76 65 20 70 72 65 to the above pre
10f0: 6d 69 73 65 73 2c 20 3c 62 3e 4e 6f 64 65 73 3c mises, <b>Nodes<
1100: 2f 62 3e 20 61 72 65 20 6e 65 76 65 72 20 65 78 /b> are never ex
1110: 70 65 63 74 65 64 20 74 6f 20 62 65 20 65 78 70 pected to be exp
1120: 6c 69 63 69 74 6c 79 20 64 65 63 6c 61 72 65 64 licitly declared
1130: 20 69 6e 20 61 20 73 65 70 61 72 61 74 65 20 54 in a separate T
1140: 61 62 6c 65 2e 3c 62 72 3e 0d 0a 4a 75 73 74 20 able.<br>..Just
1150: 61 20 73 69 6e 67 6c 65 20 54 61 62 6c 65 20 64 a single Table d
1160: 65 63 6c 61 72 69 6e 67 20 61 6c 6c 20 3c 62 3e eclaring all <b>
1170: 4c 69 6e 6b 73 3c 2f 62 3e 20 69 73 20 72 65 71 Links</b> is req
1180: 75 69 72 65 64 20 69 6e 20 6f 72 64 65 72 20 74 uired in order t
1190: 6f 20 66 75 6c 6c 79 20 64 65 66 69 6e 65 20 61 o fully define a
11a0: 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 6c 79 20 76 topologically v
11b0: 61 6c 69 64 20 4e 65 74 77 6f 72 6b 2e 3c 62 72 alid Network.<br
11c0: 3e 0d 0a 41 6c 6c 20 74 68 65 20 4e 6f 64 65 73 >..All the Nodes
11d0: 20 63 61 6e 20 74 68 65 6e 20 62 65 20 65 61 73 can then be eas
11e0: 69 6c 79 20 65 78 74 72 61 63 74 65 64 20 66 72 ily extracted fr
11f0: 6f 6d 20 74 68 65 20 4c 69 6e 6b 73 27 20 64 65 om the Links' de
1200: 66 69 6e 69 74 69 6f 6e 73 20 61 6e 64 20 74 68 finitions and th
1210: 65 20 63 6f 6f 72 64 69 6e 61 74 65 73 20 66 6f e coordinates fo
1220: 72 20 65 61 63 68 20 4e 6f 64 65 20 63 61 6e 20 r each Node can
1230: 62 65 20 64 69 72 65 63 74 6c 79 20 73 65 74 20 be directly set
1240: 62 79 20 65 78 74 72 61 63 74 69 6e 67 20 74 68 by extracting th
1250: 65 20 65 78 74 72 65 6d 65 20 50 6f 69 6e 74 20 e extreme Point
1260: 6f 66 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e of the correspon
1270: 64 69 6e 67 20 4c 69 6e 65 73 74 72 69 6e 67 73 ding Linestrings
1280: 2e 3c 62 72 3e 0d 0a 49 66 20 61 6e 79 20 6d 69 .<br>..If any mi
1290: 73 6d 61 74 63 68 20 69 73 20 64 65 74 65 63 74 smatch is detect
12a0: 65 64 20 74 68 69 73 20 73 75 72 65 6c 79 20 6d ed this surely m
12b0: 65 61 6e 73 20 74 68 61 74 20 74 68 65 20 4e 65 eans that the Ne
12c0: 74 77 6f 72 6b 20 69 73 20 69 6e 76 61 6c 69 64 twork is invalid
12d0: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 41 20 3c 62 .</li>..<li>A <b
12e0: 3e 4c 69 6e 6b 3c 2f 62 3e 20 6d 61 79 20 6c 65 >Link</b> may le
12f0: 67 69 74 69 6d 61 74 65 6c 79 20 73 65 6c 66 2d gitimately self-
1300: 69 6e 74 65 72 73 65 63 74 20 69 74 73 65 6c 66 intersect itself
1310: 20 28 65 2e 67 2e 20 66 6f 72 6d 69 6e 67 20 61 (e.g. forming a
1320: 20 6c 6f 6f 70 29 2c 20 61 73 20 73 68 6f 77 6e loop), as shown
1330: 20 69 6e 20 74 68 65 20 61 62 6f 76 65 20 66 69 in the above fi
1340: 67 75 72 65 20 62 79 20 4c 69 6e 6b 20 3c 62 3e gure by Link <b>
1350: 4c 31 35 3c 2f 62 3e 20 28 6f 72 61 6e 67 65 20 L15</b> (orange
1360: 73 70 6f 74 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 spot).</li>..<li
1370: 3e 54 77 6f 20 3c 62 3e 4c 69 6e 6b 73 3c 2f 62 >Two <b>Links</b
1380: 3e 20 6d 61 79 20 6c 65 67 69 74 69 6d 61 74 65 > may legitimate
1390: 6c 79 20 69 6e 74 65 72 73 65 63 74 20 77 68 65 ly intersect whe
13a0: 72 65 20 6e 6f 20 4e 6f 64 65 20 65 78 69 73 74 re no Node exist
13b0: 73 2c 20 61 73 20 65 78 65 6d 70 6c 69 66 69 65 s, as exemplifie
13c0: 64 20 6f 6e 20 74 68 65 20 61 62 6f 76 65 20 66 d on the above f
13d0: 69 67 75 72 65 20 62 79 20 4c 69 6e 6b 73 20 3c igure by Links <
13e0: 62 3e 4c 34 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e b>L4</b> and <b>
13f0: 4c 37 3c 2f 62 3e 20 28 67 72 65 65 6e 20 73 70 L7</b> (green sp
1400: 6f 74 29 2e 3c 62 72 3e 0d 0a 54 68 69 73 20 75 ot).<br>..This u
1410: 73 75 61 6c 6c 79 20 68 61 70 70 65 6e 73 20 77 sually happens w
1420: 68 65 6e 20 6f 6e 65 20 6f 66 20 74 68 65 20 74 hen one of the t
1430: 77 6f 20 4c 69 6e 6b 73 20 6f 76 65 72 70 61 73 wo Links overpas
1440: 73 65 73 20 74 68 65 20 6f 74 68 65 72 2c 20 6f ses the other, o
1450: 72 20 77 68 65 72 65 20 73 6f 6d 65 20 74 65 63 r where some tec
1460: 68 6e 69 63 61 6c 20 72 65 73 74 72 69 63 74 69 hnical restricti
1470: 6f 6e 20 65 78 69 73 74 73 20 28 65 2e 67 2e 20 on exists (e.g.
1480: 74 77 6f 20 69 6e 73 75 6c 61 74 65 64 20 77 69 two insulated wi
1490: 72 65 73 20 69 6e 20 61 6e 20 45 6c 65 63 74 72 res in an Electr
14a0: 69 63 61 6c 20 4e 65 74 77 6f 72 6b 29 2e 3c 2f ical Network).</
14b0: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4c 69 6e 6b li>..<li><b>Link
14c0: 73 3c 2f 62 3e 20 61 72 65 6e 27 74 20 73 74 72 s</b> aren't str
14d0: 69 63 74 6c 79 20 72 65 71 75 69 72 65 64 20 74 ictly required t
14e0: 6f 20 62 65 20 61 73 73 6f 63 69 61 74 65 64 20 o be associated
14f0: 77 69 74 68 20 61 6e 79 20 73 70 65 63 69 66 69 with any specifi
1500: 63 20 61 74 74 72 69 62 75 74 65 2c 20 62 75 74 c attribute, but
1510: 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 the following a
1520: 74 74 72 69 62 75 74 65 73 20 61 72 65 20 61 6c ttributes are al
1530: 6d 6f 73 74 20 75 6e 69 76 65 72 73 61 6c 6c 79 most universally
1540: 20 73 75 70 70 6f 72 74 65 64 3a 0d 0a 3c 75 6c supported:..<ul
1550: 3e 0d 0a 3c 6c 69 3e 61 20 3c 62 3e 6e 61 6d 65 >..<li>a <b>name
1560: 3c 2f 62 3e 20 69 64 65 6e 74 69 66 79 69 6e 67 </b> identifying
1570: 20 74 68 65 20 4c 69 6e 6b 2e 3c 62 72 3e 0d 0a the Link.<br>..
1580: 3c 75 3e 45 78 61 6d 70 6c 65 73 3c 2f 75 3e 3a <u>Examples</u>:
1590: 20 74 68 65 20 3c 69 3e 72 6f 61 64 20 74 6f 70 the <i>road top
15a0: 6f 6e 79 6d 3c 2f 69 3e 20 69 6e 20 61 20 3c 62 onym</i> in a <b
15b0: 3e 72 6f 61 64 20 6e 65 74 77 6f 72 6b 3c 2f 62 >road network</b
15c0: 3e 2c 20 6f 72 20 74 68 65 20 3c 69 3e 72 69 76 >, or the <i>riv
15d0: 65 72 20 6e 61 6d 65 3c 2f 69 3e 20 69 6e 20 61 er name</i> in a
15e0: 6e 20 3c 62 3e 68 79 64 72 6f 67 72 61 70 68 69 n <b>hydrographi
15f0: 63 20 6e 65 74 77 6f 72 6b 3c 2f 62 3e 2e 3c 2f c network</b>.</
1600: 6c 69 3e 0d 0a 3c 6c 69 3e 6f 6e 65 20 28 6f 72 li>..<li>one (or
1610: 20 65 76 65 6e 20 6d 6f 72 65 29 20 61 70 70 72 even more) appr
1620: 6f 70 72 69 61 74 65 20 3c 62 3e 63 6f 73 74 20 opriate <b>cost
1630: 76 61 6c 75 65 3c 2f 62 3e 28 73 29 2e 3c 62 72 value</b>(s).<br
1640: 3e 0d 0a 3c 75 3e 45 78 61 6d 70 6c 65 3c 2f 75 >..<u>Example</u
1650: 3e 3a 20 74 68 65 20 3c 69 3e 74 69 6d 65 3c 2f >: the <i>time</
1660: 69 3e 20 72 65 71 75 69 72 65 64 20 74 6f 20 74 i> required to t
1670: 72 61 76 65 72 73 65 20 74 68 65 20 4c 69 6e 6b raverse the Link
1680: 20 28 6d 61 79 20 62 65 20 64 69 73 74 69 6e 67 (may be disting
1690: 75 69 73 68 65 64 20 62 65 74 77 65 65 6e 20 70 uished between p
16a0: 65 64 65 73 74 72 69 61 6e 73 2c 20 62 69 63 79 edestrians, bicy
16b0: 63 6c 65 73 2c 20 63 61 72 73 2c 20 6c 6f 72 72 cles, cars, lorr
16c0: 69 65 73 20 61 6e 64 20 73 6f 20 6f 6e 29 2e 3c ies and so on).<
16d0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 70 61 69 72 /li>..<li>a pair
16e0: 20 6f 66 20 3c 62 3e 62 6f 6f 6c 65 61 6e 20 66 of <b>boolean f
16f0: 6c 61 67 73 3c 2f 62 3e 20 28 3c 62 3e 66 72 6f lags</b> (<b>fro
1700: 6d 2d 74 6f 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e m-to</b> and <b>
1710: 74 6f 2d 66 72 6f 6d 3c 2f 62 3e 29 20 61 72 65 to-from</b>) are
1720: 20 69 6e 74 65 6e 64 65 6e 64 20 74 6f 20 73 70 intendend to sp
1730: 65 63 69 66 79 20 69 66 20 74 68 65 20 4c 69 6e ecify if the Lin
1740: 6b 20 63 61 6e 20 62 65 20 74 72 61 76 65 72 73 k can be travers
1750: 65 64 20 6f 6e 20 62 6f 74 68 20 64 69 72 65 63 ed on both direc
1760: 74 69 6f 6e 73 20 6f 72 20 6a 75 73 74 20 69 6e tions or just in
1770: 20 6f 6e 65 20 28 3c 62 3e 6f 6e 65 2d 77 61 79 one (<b>one-way
1780: 3c 2f 62 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 </b>).</li>..</u
1790: 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a l></li>..</ul>..
17a0: 3c 68 34 3e 4c 6f 67 69 63 61 6c 20 63 6f 6e 63 <h4>Logical conc
17b0: 6c 75 73 69 6f 6e 73 3c 2f 68 34 3e 0d 0a 41 6e lusions</h4>..An
17c0: 79 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 6c 79 20 y topologically
17d0: 76 61 6c 69 64 20 3c 62 3e 4e 65 74 77 6f 72 6b valid <b>Network
17e0: 3c 2f 62 3e 20 28 69 72 72 65 73 70 65 63 74 69 </b> (irrespecti
17f0: 76 65 20 6f 66 20 77 68 65 74 68 65 72 20 69 74 ve of whether it
1800: 20 69 73 20 61 20 3c 62 3e 53 70 61 74 69 61 6c is a <b>Spatial
1810: 3c 2f 62 3e 20 6f 72 20 3c 62 3e 4c 6f 67 69 63 </b> or <b>Logic
1820: 61 6c 3c 2f 62 3e 20 74 79 70 65 29 20 69 73 20 al</b> type) is
1830: 61 20 76 61 6c 69 64 20 3c 62 3e 47 72 61 70 68 a valid <b>Graph
1840: 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 41 20 4e 65 74 </b>.<br>..A Net
1850: 77 6f 72 6b 20 61 6c 6c 6f 77 69 6e 67 20 74 68 work allowing th
1860: 65 20 73 75 70 70 6f 72 74 20 28 64 69 72 65 63 e support (direc
1870: 74 20 6f 72 20 69 6e 64 69 72 65 63 74 29 20 6f t or indirect) o
1880: 66 20 73 6f 6d 65 20 61 70 70 72 6f 70 72 69 61 f some appropria
1890: 74 65 20 3c 62 3e 63 6f 73 74 20 76 61 6c 75 65 te <b>cost value
18a0: 3c 2f 62 3e 20 69 73 20 61 20 76 61 6c 69 64 20 </b> is a valid
18b0: 3c 62 3e 57 65 69 67 68 74 65 64 20 47 72 61 70 <b>Weighted Grap
18c0: 68 3c 2f 62 3e 2c 20 61 6e 64 20 63 61 6e 20 63 h</b>, and can c
18d0: 6f 6e 73 65 71 75 65 6e 74 6c 79 20 73 75 70 70 onsequently supp
18e0: 6f 72 74 20 3c 62 3e 52 6f 75 74 69 6e 67 20 61 ort <b>Routing a
18f0: 6c 67 6f 72 69 74 68 6d 73 3c 2f 62 3e 2e 3c 62 lgorithms</b>.<b
1900: 72 3e 0d 0a 41 6c 6c 20 52 6f 75 74 69 6e 67 20 r>..All Routing
1910: 61 6c 67 6f 72 69 74 68 6d 73 20 61 72 65 20 69 algorithms are i
1920: 6e 74 65 6e 64 65 64 20 74 6f 20 69 64 65 6e 74 ntended to ident
1930: 69 66 79 20 74 68 65 20 3c 62 3e 53 68 6f 72 74 ify the <b>Short
1940: 65 73 74 20 50 61 74 68 3c 2f 62 3e 20 73 6f 6c est Path</b> sol
1950: 75 74 69 6f 6e 20 63 6f 6e 6e 65 63 74 69 6e 67 ution connecting
1960: 20 74 77 6f 20 3c 62 3e 4e 6f 64 65 73 3c 2f 62 two <b>Nodes</b
1970: 3e 20 69 6e 20 61 20 3c 62 3e 77 65 69 67 68 74 > in a <b>weight
1980: 65 64 20 67 72 61 70 68 3c 2f 62 3e 20 28 3c 69 ed graph</b> (<i
1990: 3e 61 6b 61 3c 2f 69 3e 20 3c 62 3e 4e 65 74 77 >aka</i> <b>Netw
19a0: 6f 72 6b 3c 2f 62 3e 29 2e 3c 62 72 3e 3c 62 72 ork</b>).<br><br
19b0: 3e 0d 0a 3c 62 3e 3c 75 3e 4e 6f 74 65 3c 2f 75 >..<b><u>Note</u
19c0: 3e 3c 2f 62 3e 3a 20 74 68 65 20 74 65 72 6d 20 ></b>: the term
19d0: 3c 62 3e 3c 69 3e 53 68 6f 72 74 65 73 74 20 50 <b><i>Shortest P
19e0: 61 74 68 3c 2f 69 3e 3c 2f 62 3e 20 63 61 6e 20 ath</i></b> can
19f0: 62 65 20 65 61 73 69 6c 79 20 6d 69 73 75 6e 64 be easily misund
1a00: 65 72 73 74 6f 6f 64 2e 3c 62 72 3e 0d 0a 44 75 erstood.<br>..Du
1a10: 65 20 74 6f 20 68 69 73 74 6f 72 69 63 61 6c 20 e to historical
1a20: 72 65 61 73 6f 6e 73 20 74 68 65 20 6d 6f 73 74 reasons the most
1a30: 20 63 6f 6d 6d 6f 6e 20 61 70 70 6c 69 63 61 74 common applicat
1a40: 69 6f 6e 20 66 69 65 6c 64 20 66 6f 72 20 52 6f ion field for Ro
1a50: 75 74 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d 73 uting algorithms
1a60: 20 69 73 20 72 65 6c 61 74 65 64 20 74 6f 20 3c is related to <
1a70: 62 3e 52 6f 61 64 20 4e 65 74 77 6f 72 6b 73 3c b>Road Networks<
1a80: 2f 62 3e 2c 20 62 75 74 20 61 6c 73 6f 20 6d 61 /b>, but also ma
1a90: 6e 79 20 6f 74 68 65 72 20 6b 69 6e 64 73 20 6f ny other kinds o
1aa0: 66 20 4e 65 74 77 6f 72 6b 73 20 65 78 69 73 74 f Networks exist
1ab0: 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 48 79 64 :..<ul>..<li>Hyd
1ac0: 72 6f 67 72 61 70 68 69 63 20 4e 65 74 77 6f 72 rographic Networ
1ad0: 6b 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 47 61 ks.</li>..<li>Ga
1ae0: 73 20 2f 20 57 61 74 65 72 20 2f 20 4f 69 6c 20 s / Water / Oil
1af0: 4e 65 74 77 6f 72 6b 73 2e 3c 2f 6c 69 3e 0d 0a Networks.</li>..
1b00: 3c 6c 69 3e 45 6c 65 63 74 72 69 63 61 6c 20 4e <li>Electrical N
1b10: 65 74 77 6f 72 6b 73 2e 3c 2f 6c 69 3e 0d 0a 3c etworks.</li>..<
1b20: 6c 69 3e 54 65 6c 65 63 6f 6d 75 6e 69 63 61 74 li>Telecomunicat
1b30: 69 6f 6e 20 4e 65 74 77 6f 72 6b 73 2e 3c 2f 6c ion Networks.</l
1b40: 69 3e 0d 0a 3c 6c 69 3e 53 6f 63 69 61 6c 20 6f i>..<li>Social o
1b50: 72 20 45 63 6f 6e 6f 6d 69 63 61 6c 20 4e 65 74 r Economical Net
1b60: 77 6f 72 6b 73 20 72 65 70 72 65 73 65 6e 74 69 works representi
1b70: 6e 67 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 73 ng relationships
1b80: 20 62 65 74 77 65 65 6e 20 69 6e 64 69 76 69 64 between individ
1b90: 75 61 6c 73 20 6f 72 20 63 6f 6d 70 61 6e 69 65 uals or companie
1ba0: 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 45 70 69 s.</li>..<li>Epi
1bb0: 64 65 6d 69 6f 6c 6f 67 69 63 61 6c 20 4e 65 74 demiological Net
1bc0: 77 6f 72 6b 73 20 72 65 70 72 65 73 65 6e 74 69 works representi
1bd0: 6e 67 20 74 68 65 20 70 72 6f 70 61 67 61 74 69 ng the propagati
1be0: 6f 6e 20 6f 66 20 69 6e 66 65 63 74 69 76 65 20 on of infective
1bf0: 64 69 73 65 61 73 65 73 20 62 65 74 77 65 65 6e diseases between
1c00: 20 69 6e 64 69 76 69 64 75 61 6c 73 20 6f 72 20 individuals or
1c10: 67 72 6f 75 70 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f groups.</li>..</
1c20: 75 6c 3e 3c 2f 6c 69 3e 20 0d 0a 3c 62 72 3e 0d ul></li> ..<br>.
1c30: 0a 49 6e 20 61 6c 6c 20 74 68 65 20 61 62 6f 76 .In all the abov
1c40: 65 20 63 61 73 65 73 20 77 65 20 63 65 72 74 61 e cases we certa
1c50: 69 6e 6c 79 20 68 61 76 65 20 76 61 6c 69 64 20 inly have valid
1c60: 4e 65 74 77 6f 72 6b 73 20 73 75 70 70 6f 72 74 Networks support
1c70: 69 6e 67 20 52 6f 75 74 69 6e 67 20 61 6c 67 6f ing Routing algo
1c80: 72 69 74 68 6e 73 2c 20 62 75 74 20 6e 6f 74 20 rithns, but not
1c90: 61 6c 6c 20 6f 66 20 74 68 65 6d 20 63 61 6e 20 all of them can
1ca0: 69 6d 70 6c 79 20 73 6f 6d 65 74 68 69 6e 67 20 imply something
1cb0: 6c 69 6b 65 20 61 20 3c 69 3e 73 70 61 74 69 61 like a <i>spatia
1cc0: 6c 20 64 69 73 74 61 6e 63 65 3c 2f 69 3e 20 28 l distance</i> (
1cd0: 3c 69 3e 67 65 6f 6d 65 74 72 69 63 20 6c 65 6e <i>geometric len
1ce0: 67 74 68 3c 2f 69 3e 29 20 6f 72 20 61 20 3c 69 gth</i>) or a <i
1cf0: 3e 74 72 61 76 65 6c 20 74 69 6d 65 3c 2f 69 3e >travel time</i>
1d00: 2e 3c 62 72 3e 0d 0a 49 6e 20 74 68 65 20 6d 6f .<br>..In the mo
1d10: 73 74 20 67 65 6e 65 72 61 6c 20 61 63 63 65 70 st general accep
1d20: 74 69 6f 6e 20 3c 62 3e 63 6f 73 74 73 3c 2f 62 tion <b>costs</b
1d30: 3e 20 63 61 6e 20 62 65 20 72 65 70 72 65 73 65 > can be represe
1d40: 6e 74 65 64 20 62 79 20 61 6e 79 20 72 65 61 73 nted by any reas
1d50: 6f 6e 61 62 6c 65 20 70 68 79 73 69 63 61 6c 20 onable physical
1d60: 71 75 61 6e 74 69 74 79 2e 3c 62 72 3e 0d 0a 53 quantity.<br>..S
1d70: 6f 20 61 20 6d 6f 72 65 20 67 65 6e 65 72 61 6c o a more general
1d80: 69 7a 65 64 20 64 65 66 69 6e 69 74 69 6f 6e 20 ized definition
1d90: 69 73 20 61 73 73 75 6d 69 6e 67 20 74 68 61 74 is assuming that
1da0: 20 52 6f 75 74 69 6e 67 20 61 6c 67 6f 72 69 74 Routing algorit
1db0: 68 6d 73 20 61 72 65 20 69 6e 74 65 6e 64 65 64 hms are intended
1dc0: 20 74 6f 20 69 64 65 6e 74 69 66 79 20 3c 62 3e to identify <b>
1dd0: 6c 65 73 73 65 72 20 63 6f 73 74 3c 2f 62 3e 20 lesser cost</b>
1de0: 73 6f 6c 75 74 69 6f 6e 73 20 6f 6e 20 61 20 3c solutions on a <
1df0: 62 3e 77 65 69 67 68 74 65 64 20 67 72 61 70 68 b>weighted graph
1e00: 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 54 68 65 20 65 </b>.<br>..The e
1e10: 78 61 63 74 20 69 6e 74 65 72 70 72 65 74 61 74 xact interpretat
1e20: 69 6f 6e 20 6f 66 20 74 68 65 20 69 6e 76 6f 6c ion of the invol
1e30: 76 65 64 20 3c 62 3e 63 6f 73 74 73 3c 2f 62 3e ved <b>costs</b>
1e40: 20 28 3c 69 3e 61 6b 61 3c 2f 69 3e 20 3c 62 3e (<i>aka</i> <b>
1e50: 77 65 69 67 68 74 73 3c 2f 62 3e 29 20 73 74 72 weights</b>) str
1e60: 69 63 74 6c 79 20 64 65 70 65 6e 64 73 20 6f 6e ictly depends on
1e70: 20 74 68 65 20 76 65 72 79 20 73 70 65 63 69 66 the very specif
1e80: 69 63 20 6e 61 74 75 72 65 20 6f 66 20 65 61 63 ic nature of eac
1e90: 68 20 4e 65 74 77 6f 72 6b 2e 0d 0a 3c 68 33 3e h Network...<h3>
1ea0: 54 68 65 20 44 69 6a 6b 73 74 72 61 27 73 20 61 The Dijkstra's a
1eb0: 6c 67 6f 72 69 74 68 6d 3c 2f 68 33 3e 0d 0a 54 lgorithm</h3>..T
1ec0: 68 69 73 20 77 65 6c 6c 20 6b 6e 6f 77 6e 20 3c his well known <
1ed0: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f a href="https://
1ee0: 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72 67 en.wikipedia.org
1ef0: 2f 77 69 6b 69 2f 44 69 6a 6b 73 74 72 61 25 32 /wiki/Dijkstra%2
1f00: 37 73 5f 61 6c 67 6f 72 69 74 68 6d 22 3e 61 6c 7s_algorithm">al
1f10: 67 6f 72 69 74 68 6d 3c 2f 61 3e 20 69 73 6e 27 gorithm</a> isn'
1f20: 74 20 6e 65 63 65 73 73 61 72 69 6c 79 20 74 68 t necessarily th
1f30: 65 20 66 61 73 74 65 73 74 20 6f 6e 65 2c 20 62 e fastest one, b
1f40: 75 74 20 69 74 20 61 6c 77 61 79 73 20 65 6e 73 ut it always ens
1f50: 75 72 65 73 20 3c 62 3e 66 75 6c 6c 20 63 6f 72 ures <b>full cor
1f60: 72 65 63 74 6e 65 73 73 3c 2f 62 3e 3a 0d 0a 3c rectness</b>:..<
1f70: 75 6c 3e 0d 0a 3c 6c 69 3e 41 6e 79 20 4e 6f 64 ul>..<li>Any Nod
1f80: 65 2d 74 6f 2d 4e 6f 64 65 20 63 6f 6e 6e 65 63 e-to-Node connec
1f90: 74 69 6f 6e 20 69 64 65 6e 74 69 66 69 65 64 20 tion identified
1fa0: 62 79 20 44 69 6a 6b 73 74 72 61 27 73 20 69 73 by Dijkstra's is
1fb0: 20 63 65 72 74 61 69 6e 6c 79 20 65 6e 73 75 72 certainly ensur
1fc0: 65 64 20 74 6f 20 62 65 20 3c 62 3e 6f 70 74 69 ed to be <b>opti
1fd0: 6d 61 6c 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 49 6e mal</b>.<br>..In
1fe0: 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 6e 6f other words, no
1ff0: 20 63 6f 6e 6e 65 74 63 74 69 6f 6e 20 70 72 65 connetction pre
2000: 73 65 6e 74 69 6e 67 20 61 20 6c 6f 77 65 72 20 senting a lower
2010: 63 6f 73 74 20 63 61 6e 20 63 6f 6e 63 65 70 74 cost can concept
2020: 75 61 6c 6c 79 20 65 78 69 73 74 2e 3c 2f 6c 69 ually exist.</li
2030: 3e 0d 0a 3c 6c 69 3e 57 68 65 6e 20 44 69 6a 73 >..<li>When Dijs
2040: 6a 74 72 61 27 73 20 66 61 69 6c 73 20 74 6f 20 jtra's fails to
2050: 69 64 65 6e 74 69 66 79 20 61 20 73 6f 6c 75 74 identify a solut
2060: 69 6f 6e 20 74 68 69 73 20 73 75 72 65 6c 79 20 ion this surely
2070: 6d 65 61 6e 73 20 74 68 61 74 20 6e 6f 20 73 6f means that no so
2080: 6c 75 74 69 6f 6e 20 69 73 20 70 6f 73 73 69 62 lution is possib
2090: 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d le.</li>..</ul>.
20a0: 0a 3c 68 33 3e 54 68 65 20 41 2a 20 61 6c 67 6f .<h3>The A* algo
20b0: 72 69 74 68 6d 3c 2f 68 33 3e 0d 0a 4d 61 6e 79 rithm</h3>..Many
20c0: 20 61 6c 74 65 72 6e 61 74 69 76 65 20 52 6f 75 alternative Rou
20d0: 74 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d 73 20 ting algorithms
20e0: 68 61 76 65 20 62 65 65 6e 20 69 6e 76 65 6e 74 have been invent
20f0: 65 64 20 64 75 72 69 6e 67 20 74 68 65 20 79 65 ed during the ye
2100: 61 72 73 2e 3c 62 72 3e 0d 0a 41 6c 6c 20 74 68 ars.<br>..All th
2110: 65 6d 20 61 72 65 20 62 61 73 65 64 20 6f 6e 20 em are based on
2120: 68 65 75 72 69 73 74 69 63 20 61 73 73 75 6d 70 heuristic assump
2130: 74 69 6f 6e 73 20 61 6e 64 20 61 72 65 20 69 6e tions and are in
2140: 74 65 6e 64 65 64 20 74 6f 20 62 65 20 66 61 73 tended to be fas
2150: 74 65 72 20 74 68 61 6e 20 44 69 6a 6b 73 74 72 ter than Dijkstr
2160: 61 27 73 2c 20 62 75 74 20 6e 6f 6e 65 20 6f 66 a's, but none of
2170: 20 74 68 65 6d 20 63 61 6e 20 65 6e 73 75 72 65 them can ensure
2180: 20 3c 62 3e 66 75 6c 6c 20 63 6f 72 72 65 63 74 <b>full correct
2190: 6e 65 73 73 3c 2f 62 3e 20 61 73 20 44 69 6a 6b ness</b> as Dijk
21a0: 73 74 72 61 27 73 20 64 6f 65 73 2e 3c 62 72 3e stra's does.<br>
21b0: 0d 0a 54 68 65 20 3c 61 20 68 72 65 66 3d 22 68 ..The <a href="h
21c0: 74 74 70 73 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 ttps://en.wikipe
21d0: 64 69 61 2e 6f 72 67 2f 77 69 6b 69 2f 41 2a 5f dia.org/wiki/A*_
21e0: 73 65 61 72 63 68 5f 61 6c 67 6f 72 69 74 68 6d search_algorithm
21f0: 22 3e 41 2a 20 61 6c 67 6f 72 69 74 68 6d 3c 2f ">A* algorithm</
2200: 61 3e 20 61 70 70 6c 69 65 73 20 61 20 6d 69 6c a> applies a mil
2210: 64 20 68 65 75 72 69 73 74 69 63 20 6f 70 74 69 d heuristic opti
2220: 6d 69 7a 61 74 69 6f 6e 2c 20 61 6e 64 20 63 61 mization, and ca
2230: 6e 20 62 65 20 61 20 72 65 61 6c 69 73 74 69 63 n be a realistic
2240: 20 61 6c 74 65 72 6e 61 74 69 76 65 20 74 6f 20 alternative to
2250: 44 69 6a 6b 73 74 72 61 27 73 20 69 6e 20 6d 61 Dijkstra's in ma
2260: 6e 79 20 63 61 73 65 73 2e 3c 62 72 3e 3c 62 72 ny cases.<br><br
2270: 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 31 3e 32 20 2d >..<hr>..<h1>2 -
2280: 20 54 68 65 20 73 61 6d 70 6c 65 2f 74 65 73 74 The sample/test
2290: 20 44 42 3c 2f 68 31 3e 0d 0a 59 6f 75 20 61 72 DB</h1>..You ar
22a0: 65 20 65 78 70 65 63 74 65 64 20 74 6f 20 66 6f e expected to fo
22b0: 6c 6c 6f 77 20 74 68 65 20 63 75 72 72 65 6e 74 llow the current
22c0: 20 74 75 74 6f 72 69 61 6c 20 61 62 6f 75 74 20 tutorial about
22d0: 3c 62 3e 56 69 72 74 75 61 6c 52 6f 75 74 69 6e <b>VirtualRoutin
22e0: 67 3c 2f 62 3e 20 62 79 20 64 69 72 65 63 74 6c g</b> by directl
22f0: 79 20 74 65 73 74 69 6e 67 20 61 6c 6c 20 53 51 y testing all SQ
2300: 4c 20 71 75 65 72 69 65 73 20 64 69 73 63 75 73 L queries discus
2310: 73 65 64 20 62 65 6c 6f 77 20 6f 6e 20 62 65 68 sed below on beh
2320: 61 6c 66 20 6f 66 20 74 68 65 20 3c 61 20 68 72 alf of the <a hr
2330: 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e ef="https://www.
2340: 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 gaia-gis.it/gaia
2350: 2d 73 69 6e 73 2f 72 6f 75 74 69 6e 67 2d 73 61 -sins/routing-sa
2360: 6d 70 6c 65 2d 35 2e 30 2e 30 2e 37 7a 22 3e 73 mple-5.0.0.7z">s
2370: 61 6d 70 6c 65 2f 74 65 73 74 20 44 42 20 74 68 ample/test DB th
2380: 61 74 20 79 6f 75 20 63 61 6e 20 64 6f 77 6e 6c at you can downl
2390: 6f 61 64 20 66 72 6f 6d 20 68 65 72 65 3c 2f 61 oad from here</a
23a0: 3e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68 65 20 73 ><br><br>..The s
23b0: 61 6d 70 6c 65 20 44 42 20 63 6f 6e 74 61 69 6e ample DB contain
23c0: 73 20 74 68 65 20 66 75 6c 6c 20 3c 62 3e 72 6f s the full <b>ro
23d0: 61 64 20 6e 65 74 77 6f 72 6b 3c 2f 62 3e 20 6f ad network</b> o
23e0: 66 20 3c 62 3e 54 75 73 63 61 6e 79 20 52 65 67 f <b>Tuscany Reg
23f0: 69 6f 6e 20 28 49 74 61 6c 79 29 3c 2f 62 3e 20 ion (Italy)</b>
2400: 28 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f (<a href="http:/
2410: 2f 77 77 77 35 30 32 2e 72 65 67 69 6f 6e 65 2e /www502.regione.
2420: 74 6f 73 63 61 6e 61 2e 69 74 2f 67 65 6f 73 63 toscana.it/geosc
2430: 6f 70 69 6f 2f 64 6f 77 6e 6c 6f 61 64 2f 67 72 opio/download/gr
2440: 61 66 6f 5f 73 74 72 61 64 61 6c 65 2f 69 74 65 afo_stradale/ite
2450: 72 6e 65 74 2e 7a 69 70 22 3e 49 74 65 72 2e 4e rnet.zip">Iter.N
2460: 65 74 20 64 61 74 61 73 65 74 3c 2f 61 3e 29 20 et dataset</a>)
2470: 6b 69 6e 64 6c 79 20 72 65 6c 65 61 73 65 64 20 kindly released
2480: 75 6e 64 65 72 20 74 68 65 20 3c 62 3e 43 43 2d under the <b>CC-
2490: 42 59 2d 53 41 20 34 2e 30 3c 2f 62 3e 20 6c 69 BY-SA 4.0</b> li
24a0: 63 65 6e 63 65 20 74 65 72 6d 73 2e 3c 62 72 3e cence terms.<br>
24b0: 0d 0a 54 68 65 20 63 6f 6e 74 65 6e 74 73 20 73 ..The contents s
24c0: 74 6f 72 65 64 20 69 6e 74 6f 20 74 68 65 20 73 tored into the s
24d0: 61 6d 70 6c 65 20 64 61 74 61 62 61 73 65 20 77 ample database w
24e0: 65 72 65 20 6f 70 70 6f 72 74 75 6e 65 6c 79 20 ere opportunely
24f0: 72 65 61 72 72 61 6e 67 65 64 2c 20 61 6e 64 20 rearranged, and
2500: 61 72 65 20 73 74 69 6c 6c 20 73 75 62 6a 65 63 are still subjec
2510: 74 20 74 6f 20 74 68 65 20 69 6e 69 74 69 61 6c t to the initial
2520: 20 3c 62 3e 43 43 2d 42 59 2d 53 41 20 34 2e 30 <b>CC-BY-SA 4.0
2530: 3c 2f 62 3e 20 63 6c 61 75 73 65 73 20 28 3c 69 </b> clauses (<i
2540: 3e 64 65 72 69 76 65 64 20 77 6f 72 6b 3c 2f 69 >derived work</i
2550: 3e 29 2e 0d 0a 3c 62 72 3e 3c 62 72 3e 0d 0a 3c >)...<br><br>..<
2560: 75 6c 3e 0d 0a 3c 6c 69 3e 61 6c 6c 20 72 6f 61 ul>..<li>all roa
2570: 64 20 6e 61 6d 65 73 20 61 72 65 20 73 74 6f 72 d names are stor
2580: 65 64 20 77 69 74 68 69 6e 20 74 68 65 20 3c 62 ed within the <b
2590: 3e 74 6f 70 6f 6e 79 6d 73 3c 2f 62 3e 20 54 61 >toponyms</b> Ta
25a0: 62 6c 65 2e 3c 62 72 3e 0d 0a 74 68 65 20 73 61 ble.<br>..the sa
25b0: 6d 65 20 72 6f 61 64 20 6e 61 6d 65 20 63 6f 75 me road name cou
25c0: 6c 64 20 62 65 20 75 73 65 64 20 69 6e 20 64 69 ld be used in di
25d0: 66 66 65 72 65 6e 74 20 4d 75 6e 69 63 69 70 61 fferent Municipa
25e0: 6c 69 74 69 65 73 2c 20 73 6f 20 74 68 65 20 3c lities, so the <
25f0: 62 3e 74 6f 70 6f 6e 79 6d 73 3c 2f 62 3e 20 54 b>toponyms</b> T
2600: 61 62 6c 65 20 72 65 6c 61 74 69 6f 6e 61 6c 6c able relationall
2610: 79 20 72 65 66 65 72 65 6e 63 65 73 20 74 68 65 y references the
2620: 20 3c 62 3e 6d 75 6e 69 63 69 70 61 6c 69 74 69 <b>municipaliti
2630: 65 73 3c 2f 62 3e 20 54 61 62 6c 65 20 28 76 69 es</b> Table (vi
2640: 61 20 3c 62 3e 50 52 49 4d 41 52 59 3c 2f 62 3e a <b>PRIMARY</b>
2650: 20 2f 20 3c 62 3e 46 4f 52 45 49 47 4e 20 4b 45 / <b>FOREIGN KE
2660: 59 3c 2f 62 3e 20 72 65 6c 61 74 69 6f 6e 73 68 Y</b> relationsh
2670: 69 70 73 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e ips).</li>..<li>
2680: 74 68 65 20 3c 62 3e 72 6f 61 64 73 3c 2f 62 3e the <b>roads</b>
2690: 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65 20 63 Spatial Table c
26a0: 6f 6e 74 61 69 6e 73 20 61 62 6f 75 74 20 3c 62 ontains about <b
26b0: 3e 33 38 30 2c 30 30 30 3c 2f 62 3e 20 4c 69 6e >380,000</b> Lin
26c0: 6b 73 2c 20 61 6e 64 20 68 61 73 20 74 68 65 20 ks, and has the
26d0: 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 6c 75 6d 6e following column
26e0: 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 s:..<ul>..<li><b
26f0: 3e 69 64 3c 2f 62 3e 3a 20 75 6e 69 71 75 65 20 >id</b>: unique
2700: 69 64 65 6e 74 69 66 69 65 72 20 6f 66 20 65 61 identifier of ea
2710: 63 68 20 4c 69 6e 6b 20 28 3c 62 3e 50 52 49 4d ch Link (<b>PRIM
2720: 41 52 59 20 4b 45 59 3c 2f 62 3e 29 2e 3c 2f 6c ARY KEY</b>).</l
2730: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 6e 6f 64 65 5f i>..<li><b>node_
2740: 66 72 6f 6d 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e from</b> and <b>
2750: 6e 6f 64 65 5f 74 6f 3c 2f 62 3e 3a 20 4e 6f 64 node_to</b>: Nod
2760: 65 20 69 64 65 6e 74 69 66 69 65 72 73 2e 0d 0a e identifiers...
2770: 54 68 65 20 6f 72 69 67 69 6e 61 6c 20 49 74 65 The original Ite
2780: 72 2e 4e 65 74 20 64 61 74 61 73 65 74 20 61 64 r.Net dataset ad
2790: 6f 70 74 73 20 76 65 72 79 20 6c 6f 6e 67 20 61 opts very long a
27a0: 6e 20 63 6f 6d 70 6c 65 78 20 61 6c 70 68 61 6e n complex alphan
27b0: 75 6d 65 72 69 63 20 4e 6f 64 65 20 63 6f 64 65 umeric Node code
27c0: 73 3b 20 74 68 65 20 69 6e 74 65 67 65 72 20 4e s; the integer N
27d0: 6f 64 65 20 49 44 73 20 77 65 72 65 20 6f 62 74 ode IDs were obt
27e0: 61 69 6e 65 64 20 62 79 20 63 61 6c 6c 69 6e 67 ained by calling
27f0: 20 74 68 65 20 3c 62 3e 43 72 65 61 74 65 52 6f the <b>CreateRo
2800: 75 74 69 6e 67 4e 6f 64 65 73 28 29 3c 2f 62 3e utingNodes()</b>
2810: 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e 20 64 69 SQL function di
2820: 73 63 75 73 73 65 64 20 69 6e 20 61 20 66 6f 6c scussed in a fol
2830: 6c 6f 77 69 6e 67 20 73 65 63 74 69 6f 6e 2e 3c lowing section.<
2840: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 69 64 5f /li>..<li><b>id_
2850: 74 6f 70 6f 6e 79 6d 3c 2f 62 3e 3a 20 72 65 6c toponym</b>: rel
2860: 61 74 69 6f 6e 61 6c 20 72 65 66 65 72 65 6e 63 ational referenc
2870: 65 20 74 6f 20 74 68 65 20 63 6f 72 72 65 73 70 e to the corresp
2880: 6f 6e 64 69 6e 67 20 72 6f 61 64 20 6e 61 6d 65 onding road name
2890: 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e 74 6f 20 contained into
28a0: 74 68 65 20 3c 62 3e 74 6f 70 6f 6e 79 6d 73 3c the <b>toponyms<
28b0: 2f 62 3e 20 54 61 62 6c 65 20 28 3c 62 3e 46 4f /b> Table (<b>FO
28c0: 52 45 49 47 4e 20 4b 45 59 3c 2f 62 3e 29 2e 3c REIGN KEY</b>).<
28d0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 73 70 65 /li>..<li><b>spe
28e0: 65 64 5f 6b 6d 68 3c 2f 62 3e 3a 20 74 68 65 20 ed_kmh</b>: the
28f0: 65 73 74 69 6d 61 74 65 64 20 61 76 65 72 61 67 estimated averag
2900: 65 20 73 70 65 65 64 20 73 75 70 70 6f 72 74 65 e speed supporte
2910: 64 20 62 79 20 74 68 65 20 4c 69 6e 6b 2c 20 65 d by the Link, e
2920: 78 70 72 65 73 73 65 64 20 69 6e 20 3c 62 3e 6b xpressed in <b>k
2930: 6d 2f 68 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 3c 75 m/h</b>.<br>..<u
2940: 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 3c 62 3e 6e 65 >Note</u>: <b>ne
2950: 67 61 74 69 76 65 3c 2f 62 3e 20 73 70 65 65 64 gative</b> speed
2960: 73 20 69 6e 74 65 6e 64 20 61 20 66 6f 72 62 69 s intend a forbi
2970: 64 64 65 6e 20 4c 69 6e 6b 2e 3c 2f 6c 69 3e 0d dden Link.</li>.
2980: 0a 3c 6c 69 3e 3c 62 3e 6f 6e 65 77 61 79 5f 66 .<li><b>oneway_f
2990: 72 6f 6d 74 6f 3c 2f 62 3e 20 61 6e 64 20 3c 62 romto</b> and <b
29a0: 3e 6f 6e 65 77 61 79 5f 74 6f 66 72 6f 6d 3c 2f >oneway_tofrom</
29b0: 62 3e 3a 20 62 6f 6f 6c 65 61 6e 20 66 6c 61 67 b>: boolean flag
29c0: 73 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 73 74 s intended to st
29d0: 61 74 65 20 69 66 20 61 20 4c 69 6e 6b 20 63 61 ate if a Link ca
29e0: 6e 20 62 65 20 74 72 61 76 65 72 73 65 64 20 69 n be traversed i
29f0: 6e 20 62 6f 74 68 20 64 69 72 65 63 74 69 6f 6e n both direction
2a00: 73 20 6f 72 20 6a 75 73 74 20 69 6e 20 61 20 73 s or just in a s
2a10: 69 6e 67 6c 65 20 64 69 72 65 63 74 69 6f 6e 20 ingle direction
2a20: 28 3c 62 3e 6f 6e 65 2d 77 61 79 3c 2f 62 3e 29 (<b>one-way</b>)
2a30: 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f .<br>..<u>Note</
2a40: 75 3e 3a 20 61 6c 6c 20 4c 69 6e 6b 73 20 64 65 u>: all Links de
2a50: 63 6c 61 72 69 6e 67 20 3c 62 3e 6f 6e 65 77 61 claring <b>onewa
2a60: 79 5f 66 72 6f 6d 74 6f 3d 30 3c 2f 62 3e 20 61 y_fromto=0</b> a
2a70: 6e 64 20 3c 62 3e 6f 6e 65 77 61 79 5f 74 6f 66 nd <b>oneway_tof
2a80: 72 6f 6d 3d 30 3c 2f 62 3e 20 61 72 65 20 69 6e rom=0</b> are in
2a90: 74 65 6e 64 65 64 20 74 6f 20 62 65 20 61 6c 77 tended to be alw
2aa0: 61 79 73 20 66 6f 72 62 69 64 64 65 6e 2e 3c 2f ays forbidden.</
2ab0: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 6f 73 74 li>..<li><b>cost
2ac0: 3c 2f 62 3e 3a 20 74 68 65 20 3c 62 3e 74 69 6d </b>: the <b>tim
2ad0: 65 3c 2f 62 3e 20 65 78 70 72 65 73 73 65 64 20 e</b> expressed
2ae0: 69 6e 20 3c 62 3e 73 65 63 6f 6e 64 73 3c 2f 62 in <b>seconds</b
2af0: 3e 20 72 65 71 75 69 72 65 64 20 74 6f 20 74 72 > required to tr
2b00: 61 76 65 72 73 65 20 65 61 63 68 20 4c 69 6e 6b averse each Link
2b10: 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 20 23 .<br>..<u>Note #
2b20: 31 3c 2f 75 3e 20 61 6c 6c 20 63 6f 73 74 73 20 1</u> all costs
2b30: 77 65 72 65 20 63 61 6c 63 75 6c 61 74 65 64 20 were calculated
2b40: 61 63 63 6f 72 64 69 6e 67 6c 79 20 74 6f 20 74 accordingly to t
2b50: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 6f 72 he following for
2b60: 6d 75 6c 61 3a 20 3c 62 3e 63 6f 73 74 20 3d 20 mula: <b>cost =
2b70: 28 28 53 54 5f 4c 65 6e 67 74 68 28 67 65 6f 6d ((ST_Length(geom
2b80: 29 20 2f 20 31 30 30 30 2e 30 29 20 2f 20 73 70 ) / 1000.0) / sp
2b90: 65 65 64 5f 6b 6d 68 29 20 2a 20 33 36 30 30 2e eed_kmh) * 3600.
2ba0: 30 3c 2f 62 3e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 0</b><br>..<u>No
2bb0: 74 65 20 23 32 3c 2f 75 3e 20 61 6c 6c 20 3c 62 te #2</u> all <b
2bc0: 3e 38 36 2c 34 30 30 2e 30 3c 2f 62 3e 20 63 6f >86,400.0</b> co
2bd0: 73 74 20 76 61 6c 75 65 73 20 28 65 71 75 69 76 st values (equiv
2be0: 61 6c 65 6e 74 20 74 6f 20 31 20 64 61 79 29 20 alent to 1 day)
2bf0: 61 70 70 72 6f 78 69 6d 61 74 65 20 61 6e 20 3c approximate an <
2c00: 62 3e 69 6e 66 69 6e 69 74 69 76 65 20 63 6f 73 b>infinitive cos
2c10: 74 3c 2f 62 3e 20 74 68 75 73 20 69 6e 74 65 6e t</b> thus inten
2c20: 64 69 6e 67 20 61 20 3c 62 3e 66 6f 72 62 69 64 ding a <b>forbid
2c30: 64 65 6e 3c 2f 62 3e 20 4c 69 6e 6b 2e 3c 2f 6c den</b> Link.</l
2c40: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 67 65 6f 6d 3c i>..<li><b>geom<
2c50: 2f 62 3e 3a 20 61 20 3c 62 3e 33 44 20 4c 69 6e /b>: a <b>3D Lin
2c60: 65 73 74 72 69 6e 67 3c 2f 62 3e 20 72 65 70 72 estring</b> repr
2c70: 65 73 65 6e 74 69 6e 67 20 74 68 65 20 47 65 6f esenting the Geo
2c80: 6d 65 74 72 79 20 6f 66 20 65 61 63 68 20 4c 69 metry of each Li
2c90: 6e 6b 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 nk.<br>..<u>Note
2ca0: 3c 2f 75 3e 3a 20 74 68 65 20 6f 72 69 67 69 6e </u>: the origin
2cb0: 61 6c 20 3c 62 3e 49 74 65 72 2e 4e 65 74 3c 2f al <b>Iter.Net</
2cc0: 62 3e 20 64 61 74 61 73 65 74 20 69 73 20 6a 75 b> dataset is ju
2cd0: 73 74 20 3c 62 3e 32 44 3c 2f 62 3e 3b 20 65 6c st <b>2D</b>; el
2ce0: 65 76 61 74 69 6f 6e 73 20 28 3c 62 3e 5a 3c 2f evations (<b>Z</
2cf0: 62 3e 20 63 6f 6f 72 64 69 6e 61 74 65 73 29 20 b> coordinates)
2d00: 77 65 72 65 20 69 6e 74 65 72 70 6f 6c 61 74 65 were interpolate
2d10: 64 20 62 79 20 64 72 61 70 69 6e 67 20 74 68 65 d by draping the
2d20: 20 64 61 74 61 73 65 74 20 6f 76 65 72 20 61 6e dataset over an
2d30: 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f <a href="http:/
2d40: 2f 77 77 77 35 30 32 2e 72 65 67 69 6f 6e 65 2e /www502.regione.
2d50: 74 6f 73 63 61 6e 61 2e 69 74 2f 67 65 6f 73 63 toscana.it/geosc
2d60: 6f 70 69 6f 2f 64 6f 77 6e 6c 6f 61 64 2f 61 6c opio/download/al
2d70: 74 69 6d 65 74 72 69 61 2f 64 61 5f 63 74 72 31 timetria/da_ctr1
2d80: 30 6b 2f 67 62 2f 44 54 4d 5f 4f 72 6f 67 72 61 0k/gb/DTM_Orogra
2d90: 66 69 63 6f 2e 37 7a 22 3e 6f 72 6f 67 72 61 70 fico.7z">orograp
2da0: 68 69 63 20 44 45 4d 20 28 31 30 6d 20 58 20 31 hic DEM (10m X 1
2db0: 30 6d 20 63 65 6c 6c 73 29 3c 2f 61 3e 3c 2f 6c 0m cells)</a></l
2dc0: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a i>..</ul></li>..
2dd0: 3c 6c 69 3e 74 68 65 20 3c 62 3e 72 6f 61 64 73 <li>the <b>roads
2de0: 5f 76 77 3c 2f 62 3e 20 53 70 61 74 69 61 6c 20 _vw</b> Spatial
2df0: 56 69 65 77 20 69 73 20 6a 75 73 74 20 69 6e 74 View is just int
2e00: 65 6e 64 65 64 20 74 6f 20 66 75 6c 6c 79 20 72 ended to fully r
2e10: 65 73 6f 6c 76 65 20 61 6c 6c 20 72 65 6c 61 74 esolve all relat
2e20: 69 6f 6e 61 6c 20 72 65 66 65 72 65 6e 63 65 73 ional references
2e30: 20 62 65 74 77 65 65 6e 20 3c 62 3e 72 6f 61 64 between <b>road
2e40: 73 3c 2f 62 3e 2c 20 3c 62 3e 74 6f 70 6f 6e 79 s</b>, <b>topony
2e50: 6d 73 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 6d 75 ms</b> and <b>mu
2e60: 6e 69 63 69 70 61 6c 69 74 69 65 73 3c 2f 62 3e nicipalities</b>
2e70: 2c 20 74 68 75 73 20 61 6c 6c 6f 77 69 6e 67 20 , thus allowing
2e80: 66 6f 72 20 65 61 73 69 65 72 20 53 51 4c 20 71 for easier SQL q
2e90: 75 65 72 69 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c ueries.</li>..<l
2ea0: 69 3e 74 68 65 20 3c 62 3e 68 6f 75 73 65 5f 6e i>the <b>house_n
2eb0: 72 3c 2f 62 3e 20 53 70 61 74 69 61 6c 20 54 61 r</b> Spatial Ta
2ec0: 62 6c 65 20 63 6f 6e 74 61 69 6e 73 20 61 62 6f ble contains abo
2ed0: 75 74 20 3c 62 3e 31 2c 34 38 30 2c 30 30 30 3c ut <b>1,480,000<
2ee0: 2f 62 3e 20 48 6f 75 73 65 20 4e 75 6d 62 65 72 /b> House Number
2ef0: 73 2c 20 61 6e 64 20 68 61 73 20 74 68 65 20 66 s, and has the f
2f00: 6f 6c 6c 6f 77 69 6e 67 20 63 6f 6c 75 6d 6e 73 ollowing columns
2f10: 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e :..<ul>..<li><b>
2f20: 69 64 3c 2f 62 3e 3a 20 75 6e 69 71 75 65 20 69 id</b>: unique i
2f30: 64 65 6e 74 69 66 69 65 72 20 6f 66 20 65 61 63 dentifier of eac
2f40: 68 20 48 6f 75 73 65 20 4e 75 6d 62 65 72 20 28 h House Number (
2f50: 3c 62 3e 50 52 49 4d 41 52 59 20 4b 45 59 3c 2f <b>PRIMARY KEY</
2f60: 62 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c b>).</li>..<li><
2f70: 62 3e 69 64 5f 72 6f 61 64 3c 2f 62 3e 3a 20 72 b>id_road</b>: r
2f80: 65 6c 61 74 69 6f 6e 61 6c 20 72 65 66 65 72 65 elational refere
2f90: 6e 63 65 20 74 6f 20 74 68 65 20 63 6f 72 72 65 nce to the corre
2fa0: 73 70 6f 6e 64 69 6e 67 20 4c 69 6e 6b 20 63 6f sponding Link co
2fb0: 6e 74 61 69 6e 65 64 20 69 6e 74 6f 20 74 68 65 ntained into the
2fc0: 20 3c 62 3e 72 6f 61 64 73 3c 2f 62 3e 20 54 61 <b>roads</b> Ta
2fd0: 62 6c 65 20 28 3c 62 3e 46 4f 52 45 49 47 4e 20 ble (<b>FOREIGN
2fe0: 4b 45 59 3c 2f 62 3e 29 2e 3c 2f 6c 69 3e 0d 0a KEY</b>).</li>..
2ff0: 3c 6c 69 3e 3c 62 3e 6c 61 62 65 6c 3c 2f 62 3e <li><b>label</b>
3000: 3a 20 74 68 65 20 74 65 78 74 75 61 6c 20 6c 61 : the textual la
3010: 62 65 6c 20 66 75 6c 6c 79 20 71 75 61 6c 69 66 bel fully qualif
3020: 79 69 6e 67 20 65 61 63 68 20 48 6f 75 73 65 20 ying each House
3030: 4e 75 6d 62 65 72 2e 3c 2f 6c 69 3e 0d 0a 3c 6c Number.</li>..<l
3040: 69 3e 3c 62 3e 67 65 6f 6d 3c 2f 62 3e 3a 20 61 i><b>geom</b>: a
3050: 20 3c 62 3e 33 44 20 50 6f 69 6e 74 3c 2f 62 3e <b>3D Point</b>
3060: 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 representing th
3070: 65 20 47 65 6f 6d 65 74 72 79 20 6f 66 20 65 61 e Geometry of ea
3080: 63 68 20 48 6f 75 73 65 20 4e 75 6d 62 65 72 2e ch House Number.
3090: 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 20 23 31 <br>..<u>Note #1
30a0: 3c 2f 75 3e 3a 20 61 6c 73 6f 20 69 6e 20 74 68 </u>: also in th
30b0: 69 73 20 63 61 73 65 20 61 6c 6c 20 65 6c 65 76 is case all elev
30c0: 61 74 69 6f 6e 73 20 28 3c 62 3e 5a 3c 2f 62 3e ations (<b>Z</b>
30d0: 20 63 6f 6f 72 64 69 6e 61 74 65 73 29 20 77 65 coordinates) we
30e0: 72 65 20 69 6e 74 65 72 70 6f 6c 61 74 65 64 20 re interpolated
30f0: 62 79 20 64 72 61 70 69 6e 67 20 74 68 65 20 64 by draping the d
3100: 61 74 61 73 65 74 20 6f 76 65 72 20 74 68 65 20 ataset over the
3110: 73 61 6d 65 20 44 45 4d 20 61 73 20 61 62 6f 76 same DEM as abov
3120: 65 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 20 e.<br>..<u>Note
3130: 23 32 3c 2f 75 3e 3a 20 73 74 72 69 63 74 6c 79 #2</u>: strictly
3140: 20 73 70 65 63 6b 69 6e 67 20 74 68 65 20 48 6f specking the Ho
3150: 75 73 65 20 4e 75 6d 62 65 72 73 20 61 72 65 20 use Numbers are
3160: 6e 6f 74 20 70 61 72 74 20 6f 66 20 74 68 65 20 not part of the
3170: 52 6f 61 64 20 4e 65 74 77 6f 72 6b 3b 20 74 68 Road Network; th
3180: 65 79 20 61 72 65 20 69 6e 63 6c 75 64 65 20 69 ey are include i
3190: 6e 74 6f 20 74 68 65 20 73 61 6d 70 6c 65 2f 74 nto the sample/t
31a0: 65 73 74 20 64 61 74 61 62 61 73 65 20 6a 75 73 est database jus
31b0: 74 20 62 65 63 61 75 73 65 20 74 68 65 79 27 6c t because they'l
31c0: 6c 20 62 65 20 75 73 65 66 75 6c 20 69 6e 20 73 l be useful in s
31d0: 6f 6d 65 20 6f 66 20 74 68 65 20 65 78 61 6d 70 ome of the examp
31e0: 6c 65 73 20 65 78 70 6c 61 69 6e 65 64 20 69 6e les explained in
31f0: 20 62 65 6c 6f 77 20 70 61 72 61 67 72 61 70 68 below paragraph
3200: 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f s.</li>..</ul></
3210: 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 3c 62 3e li>..<li>the <b>
3220: 68 6f 75 73 65 5f 6e 72 5f 76 77 3c 2f 62 3e 20 house_nr_vw</b>
3230: 53 70 61 74 69 61 6c 20 56 69 65 77 20 69 73 20 Spatial View is
3240: 6a 75 73 74 20 69 6e 74 65 6e 64 65 64 20 74 6f just intended to
3250: 20 66 75 6c 6c 79 20 72 65 73 6f 6c 76 65 20 61 fully resolve a
3260: 6c 6c 20 72 65 6c 61 74 69 6f 6e 61 6c 20 72 65 ll relational re
3270: 66 65 72 65 6e 63 65 73 20 62 65 74 77 65 65 6e ferences between
3280: 20 3c 62 3e 68 6f 75 73 65 5f 6e 72 3c 2f 62 3e <b>house_nr</b>
3290: 2c 20 3c 62 3e 72 6f 61 64 73 3c 2f 62 3e 2c 20 , <b>roads</b>,
32a0: 3c 62 3e 74 6f 70 6f 6e 79 6d 73 3c 2f 62 3e 20 <b>toponyms</b>
32b0: 61 6e 64 20 3c 62 3e 6d 75 6e 69 63 69 70 61 6c and <b>municipal
32c0: 69 74 69 65 73 3c 2f 62 3e 2c 20 74 68 75 73 20 ities</b>, thus
32d0: 61 6c 6c 6f 77 69 6e 67 20 66 6f 72 20 65 61 73 allowing for eas
32e0: 69 65 72 20 53 51 4c 20 71 75 65 72 69 65 73 2e ier SQL queries.
32f0: 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 0d 0a </li>..</ul>....
3300: 3c 62 72 3e 0d 0a 20 3c 68 72 3e 0d 0a 3c 68 31 <br>.. <hr>..<h1
3310: 3e 3c 61 20 6e 61 6d 65 3d 22 63 72 65 61 74 65 ><a name="create
3320: 22 3e 33 20 2d 20 43 72 65 61 74 69 6e 67 20 56 ">3 - Creating V
3330: 69 72 74 75 61 6c 52 6f 75 74 69 6e 67 20 54 61 irtualRouting Ta
3340: 62 6c 65 73 3c 2f 61 3e 3c 2f 68 31 3e 0d 0a 41 bles</a></h1>..A
3350: 6c 6c 20 56 69 72 74 75 61 6c 52 6f 75 74 69 6e ll VirtualRoutin
3360: 67 20 71 75 65 72 69 65 73 20 61 72 65 20 62 61 g queries are ba
3370: 73 65 64 20 6f 6e 20 73 6f 6d 65 20 3c 62 3e 56 sed on some <b>V
3380: 69 72 74 75 61 6c 52 6f 75 74 69 6e 67 20 54 61 irtualRouting Ta
3390: 62 6c 65 3c 2f 62 3e 2c 20 61 6e 64 20 69 6e 20 ble</b>, and in
33a0: 74 75 72 6e 20 61 6e 79 20 56 69 72 74 75 61 6c turn any Virtual
33b0: 52 6f 75 74 69 6e 67 20 54 61 62 6c 65 20 69 73 Routing Table is
33c0: 20 62 61 73 65 64 20 6f 6e 20 73 6f 6d 65 20 61 based on some a
33d0: 70 70 72 6f 70 72 69 61 74 65 20 3c 62 3e 42 69 ppropriate <b>Bi
33e0: 6e 61 72 79 20 44 61 74 61 20 54 61 62 6c 65 3c nary Data Table<
33f0: 2f 62 3e 20 73 75 70 70 6f 72 74 69 6e 67 20 61 /b> supporting a
3400: 6e 20 65 66 66 69 63 69 65 6e 74 20 72 65 70 72 n efficient repr
3410: 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 74 68 esentation of th
3420: 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 4e 65 74 e underlying Net
3430: 77 6f 72 6b 2e 3c 62 72 3e 0d 0a 53 6f 20 77 65 work.<br>..So we
3440: 27 6c 6c 20 73 74 61 72 74 20 66 69 72 73 74 20 'll start first
3450: 62 79 20 63 72 65 61 74 69 6e 67 20 73 75 63 68 by creating such
3460: 20 74 61 62 6c 65 73 2e 3c 62 72 3e 3c 62 72 3e tables.<br><br>
3470: 0d 0a 54 68 65 20 6f 6c 64 20 61 6e 64 20 6e 6f ..The old and no
3480: 77 20 73 75 70 65 72 73 65 64 65 64 20 3c 62 3e w superseded <b>
3490: 56 69 72 74 75 61 6c 4e 65 74 77 6f 72 6b 3c 2f VirtualNetwork</
34a0: 62 3e 20 72 65 71 75 69 72 65 64 20 75 73 69 6e b> required usin
34b0: 67 20 61 20 73 65 70 61 72 61 74 65 20 43 4c 49 g a separate CLI
34c0: 20 74 6f 6f 6c 20 28 3c 62 3e 73 70 61 74 69 61 tool (<b>spatia
34d0: 6c 69 74 65 5f 6e 65 74 77 6f 72 6b 3c 2f 62 3e lite_network</b>
34e0: 29 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 70 72 ) in order to pr
34f0: 6f 70 65 72 6c 79 20 69 6e 69 74 69 61 6c 69 7a operly initializ
3500: 65 20 61 20 56 69 72 74 75 61 6c 4e 65 74 77 6f e a VirtualNetwo
3510: 72 6b 20 54 61 62 6c 65 20 61 6e 64 20 69 74 73 rk Table and its
3520: 20 63 6f 6d 70 61 6e 69 6f 6e 20 42 69 6e 61 72 companion Binar
3530: 79 20 44 61 74 61 20 54 61 62 6c 65 3b 0d 0a 61 y Data Table;..a
3540: 6c 74 65 72 6e 61 74 69 76 65 6c 79 20 3c 62 3e lternatively <b>
3550: 73 70 61 74 69 61 6c 69 74 65 5f 67 75 69 3c 2f spatialite_gui</
3560: 62 3e 20 73 75 70 70 6f 72 74 65 64 20 61 20 3c b> supported a <
3570: 62 3e 47 55 49 20 77 69 7a 61 72 64 3c 2f 62 3e b>GUI wizard</b>
3580: 20 66 6f 72 20 74 68 65 20 73 61 6d 65 20 74 61 for the same ta
3590: 73 6b 2e 20 53 69 6e 63 65 20 76 65 72 73 69 6f sk. Since versio
35a0: 6e 20 3c 62 3e 35 2e 30 2e 30 3c 2f 62 3e 20 6e n <b>5.0.0</b> n
35b0: 6f 77 20 53 70 61 74 69 61 4c 69 74 65 20 64 69 ow SpatiaLite di
35c0: 72 65 63 74 6c 79 20 73 75 70 70 6f 72 74 73 20 rectly supports
35d0: 61 20 73 70 65 63 69 66 69 63 20 3c 62 3e 43 72 a specific <b>Cr
35e0: 65 61 74 65 52 6f 75 74 69 6e 67 28 29 3c 2f 62 eateRouting()</b
35f0: 3e 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e 2e 0d > SQL function..
3600: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c .<verbatim>..SEL
3610: 45 43 54 20 43 72 65 61 74 65 52 6f 75 74 69 6e ECT CreateRoutin
3620: 67 28 27 62 79 66 6f 6f 74 5f 64 61 74 61 27 2c g('byfoot_data',
3630: 20 27 62 79 66 6f 6f 74 27 2c 20 27 72 6f 61 64 'byfoot', 'road
3640: 73 5f 76 77 27 2c 20 27 6e 6f 64 65 5f 66 72 6f s_vw', 'node_fro
3650: 6d 27 2c 20 27 6e 6f 64 65 74 6f 27 2c 20 27 67 m', 'nodeto', 'g
3660: 65 6f 6d 27 2c 20 4e 55 4c 4c 29 3b 0d 0a 0d 0a eom', NULL);....
3670: 53 45 4c 45 43 54 20 43 72 65 61 74 65 52 6f 75 SELECT CreateRou
3680: 74 69 6e 67 5f 47 65 74 4c 61 73 74 45 72 72 6f ting_GetLastErro
3690: 72 28 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d r();..----------
36a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
36b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 54 6f 4e 6f ----------..ToNo
36c0: 64 65 20 43 6f 6c 75 6d 6e 20 22 6e 6f 64 65 74 de Column "nodet
36d0: 6f 22 20 69 73 20 6e 6f 74 20 64 65 66 69 6e 65 o" is not define
36e0: 64 20 69 6e 20 74 68 65 20 49 6e 70 75 74 20 54 d in the Input T
36f0: 61 62 6c 65 0d 0a 3c 2f 76 65 72 62 61 74 69 6d able..</verbatim
3700: 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 >..<u>Note</u>:
3710: 74 68 69 73 20 66 69 72 73 74 20 71 75 65 72 79 this first query
3720: 20 63 6f 6e 74 61 69 6e 73 20 61 6e 20 69 6e 74 contains an int
3730: 65 6e 64 65 64 20 65 72 72 6f 72 20 63 61 75 73 ended error caus
3740: 69 6e 67 20 3c 62 3e 43 72 65 61 74 65 52 6f 75 ing <b>CreateRou
3750: 74 69 6e 67 28 29 3c 2f 62 3e 20 74 6f 20 66 61 ting()</b> to fa
3760: 69 6c 20 72 61 69 73 69 6e 67 20 61 6e 20 65 78 il raising an ex
3770: 63 65 70 74 69 6f 6e 2e 3c 62 72 3e 0d 0a 43 72 ception.<br>..Cr
3780: 65 61 74 65 52 6f 75 74 69 6e 67 28 29 20 63 61 eateRouting() ca
3790: 6e 20 66 61 69 6c 20 66 6f 72 20 6d 75 6c 74 69 n fail for multi
37a0: 70 6c 65 20 72 65 61 73 6f 6e 73 2c 20 61 6e 64 ple reasons, and
37b0: 20 62 79 20 63 61 6c 6c 69 6e 67 20 3c 62 3e 43 by calling <b>C
37c0: 72 65 61 74 65 52 6f 75 74 69 6e 67 5f 47 65 74 reateRouting_Get
37d0: 4c 61 73 74 45 72 72 6f 72 28 29 3c 2f 62 3e 20 LastError()</b>
37e0: 79 6f 75 20 63 61 6e 20 65 61 73 69 6c 79 20 69 you can easily i
37f0: 64 65 6e 74 69 66 79 20 74 68 65 20 65 78 61 63 dentify the exac
3800: 74 20 72 65 61 73 6f 6e 20 77 68 79 20 74 68 65 t reason why the
3810: 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 63 61 6c most recent cal
3820: 6c 20 74 6f 20 43 72 65 61 74 65 52 6f 75 74 69 l to CreateRouti
3830: 6e 67 28 29 20 66 61 69 6c 65 64 2e 3c 62 72 3e ng() failed.<br>
3840: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 ..<verbatim>..SE
3850: 4c 45 43 54 20 43 72 65 61 74 65 52 6f 75 74 69 LECT CreateRouti
3860: 6e 67 28 27 62 79 66 6f 6f 74 5f 64 61 74 61 27 ng('byfoot_data'
3870: 2c 20 27 62 79 66 6f 6f 74 27 2c 20 27 72 6f 61 , 'byfoot', 'roa
3880: 64 73 5f 76 77 27 2c 20 27 6e 6f 64 65 5f 66 72 ds_vw', 'node_fr
3890: 6f 6d 27 2c 20 27 6e 6f 64 65 5f 74 6f 27 2c 20 om', 'node_to',
38a0: 27 67 65 6f 6d 27 2c 20 4e 55 4c 4c 29 3b 0d 0a 'geom', NULL);..
38b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 31 -------------..1
38c0: 0d 0a 0d 0a 53 45 4c 45 43 54 20 43 72 65 61 74 ....SELECT Creat
38d0: 65 52 6f 75 74 69 6e 67 5f 47 65 74 4c 61 73 74 eRouting_GetLast
38e0: 45 72 72 6f 72 28 29 3b 0d 0a 2d 2d 2d 2d 2d 2d Error();..------
38f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
3900: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a --------------..
3910: 4e 55 4c 4c 0d 0a 3c 2f 76 65 72 62 61 74 69 6d NULL..</verbatim
3920: 3e 0d 0a 54 68 69 73 20 73 65 63 6f 6e 64 20 61 >..This second a
3930: 74 74 65 6d 70 74 20 69 66 20 66 69 6e 61 6c 6c ttempt if finall
3940: 79 20 73 75 63 63 65 73 73 66 75 6c 2c 20 61 6e y successful, an
3950: 64 20 6e 6f 77 20 43 72 65 61 74 65 52 6f 75 74 d now CreateRout
3960: 69 6e 67 28 29 20 72 65 74 75 72 6e 73 20 3c 62 ing() returns <b
3970: 3e 31 3c 2f 62 3e 20 28 3c 69 3e 61 6b 61 3c 2f >1</b> (<i>aka</
3980: 69 3e 20 3c 62 3e 54 52 55 45 3c 2f 62 3e 29 2c i> <b>TRUE</b>),
3990: 20 61 6e 64 20 61 73 20 79 6f 75 20 63 61 6e 20 and as you can
39a0: 65 61 73 69 6c 79 20 63 68 65 63 6b 20 6e 6f 77 easily check now
39b0: 20 74 68 65 20 44 61 74 61 62 61 73 65 20 63 6f the Database co
39c0: 6e 74 61 69 6e 73 20 74 77 6f 20 6e 65 77 20 54 ntains two new T
39d0: 61 62 6c 65 73 3a 20 3c 62 3e 62 79 66 6f 6f 74 ables: <b>byfoot
39e0: 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 62 79 66 6f </b> and <b>byfo
39f0: 6f 74 5f 64 61 74 61 3c 2f 62 3e 2e 3c 62 72 3e ot_data</b>.<br>
3a00: 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 61 ..<u>Note</u>: a
3a10: 66 74 65 72 20 61 20 73 75 63 63 65 73 73 66 75 fter a successfu
3a20: 6c 20 63 61 6c 6c 20 74 6f 20 43 72 65 61 74 65 l call to Create
3a30: 52 6f 75 74 69 6e 67 28 29 20 3c 62 3e 43 72 65 Routing() <b>Cre
3a40: 61 74 65 52 6f 75 74 69 6e 67 5f 47 65 74 4c 61 ateRouting_GetLa
3a50: 73 74 45 72 72 6f 72 28 29 3c 2f 62 3e 20 77 69 stError()</b> wi
3a60: 6c 6c 20 61 6c 77 61 79 73 20 72 65 74 75 72 6e ll always return
3a70: 20 3c 62 3e 4e 55 4c 4c 3c 2f 62 3e 2e 3c 62 72 <b>NULL</b>.<br
3a80: 3e 3c 62 72 3e 0d 0a 59 6f 75 27 76 65 20 6a 75 ><br>..You've ju
3a90: 73 74 20 75 73 65 64 20 74 68 65 20 3c 69 3e 72 st used the <i>r
3aa0: 65 64 75 63 65 64 20 66 6f 72 6d 3c 2f 69 3e 20 educed form</i>
3ab0: 6f 66 20 43 72 65 61 74 65 52 6f 75 74 69 6e 67 of CreateRouting
3ac0: 28 29 3b 20 6c 65 74 27 73 20 73 65 65 20 69 6e (); let's see in
3ad0: 20 6d 6f 72 65 20 64 65 70 74 68 20 61 6c 6c 20 more depth all
3ae0: 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 61 6e the arguments an
3af0: 64 20 74 68 65 69 72 20 6d 65 61 6e 69 6e 67 3a d their meaning:
3b00: 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e 3c 69 3e 62 ..<ol>..<li><i>b
3b10: 79 66 6f 6f 74 5f 64 61 74 61 3c 2f 69 3e 3a 20 yfoot_data</i>:
3b20: 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 the name of the
3b30: 4e 65 74 77 6f 72 6b 20 42 69 6e 61 72 79 20 44 Network Binary D
3b40: 61 74 61 20 54 61 62 6c 65 20 74 6f 20 62 65 20 ata Table to be
3b50: 63 72 65 61 74 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c created.</li>..<
3b60: 6c 69 3e 3c 69 3e 62 79 66 6f 6f 74 3c 2f 69 3e li><i>byfoot</i>
3b70: 3a 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 : the name of th
3b80: 65 20 56 69 72 74 75 61 6c 52 6f 75 74 69 6e 67 e VirtualRouting
3b90: 20 54 61 62 6c 65 20 74 6f 20 62 65 20 63 72 65 Table to be cre
3ba0: 61 74 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e ated.</li>..<li>
3bb0: 3c 69 3e 72 6f 61 64 73 5f 76 77 3c 2f 69 3e 3a <i>roads_vw</i>:
3bc0: 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 the name of the
3bd0: 20 3c 62 3e 53 70 61 74 69 61 6c 20 54 61 62 6c <b>Spatial Tabl
3be0: 65 3c 2f 62 3e 20 6f 72 20 3c 62 3e 53 70 61 74 e</b> or <b>Spat
3bf0: 69 61 6c 20 56 69 65 77 3c 2f 62 3e 20 72 65 70 ial View</b> rep
3c00: 72 65 73 65 6e 74 69 6e 67 20 74 68 65 20 75 6e resenting the un
3c10: 64 65 72 6c 79 69 6e 67 20 4e 65 74 77 6f 72 6b derlying Network
3c20: 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f .<br>..<u>Note</
3c30: 75 3e 3a 20 69 6e 20 74 68 69 73 20 63 61 73 65 u>: in this case
3c40: 20 77 65 20 61 63 74 75 61 6c 6c 79 20 75 73 65 we actually use
3c50: 64 20 61 20 53 70 61 74 69 61 6c 20 56 69 65 77 d a Spatial View
3c60: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e 6e .</li>..<li><i>n
3c70: 6f 64 65 5f 66 72 6f 6d 3c 2f 69 3e 3a 20 6e 61 ode_from</i>: na
3c80: 6d 65 20 6f 66 20 74 68 65 20 63 6f 6c 75 6d 6e me of the column
3c90: 20 28 69 6e 20 74 68 65 20 61 62 6f 76 65 20 54 (in the above T
3ca0: 61 62 6c 65 20 6f 72 20 56 69 65 77 29 20 65 78 able or View) ex
3cb0: 70 65 63 74 65 64 20 74 6f 20 63 6f 6e 74 61 69 pected to contai
3cc0: 6e 20 3c 62 3e 6e 6f 64 65 2d 66 72 6f 6d 3c 2f n <b>node-from</
3cd0: 62 3e 20 76 61 6c 75 65 73 2e 3c 2f 6c 69 3e 0d b> values.</li>.
3ce0: 0a 3c 6c 69 3e 3c 69 3e 6e 6f 64 65 5f 74 6f 3c .<li><i>node_to<
3cf0: 2f 69 3e 3a 20 6e 61 6d 65 20 6f 66 20 74 68 65 /i>: name of the
3d00: 20 63 6f 6c 75 6d 6e 20 28 69 6e 20 74 68 65 20 column (in the
3d10: 61 62 6f 76 65 20 54 61 62 6c 65 20 6f 72 20 56 above Table or V
3d20: 69 65 77 29 20 65 78 70 65 63 74 65 64 20 74 6f iew) expected to
3d30: 20 63 6f 6e 74 61 69 6e 20 3c 62 3e 6e 6f 64 65 contain <b>node
3d40: 2d 74 6f 3c 2f 62 3e 20 76 61 6c 75 65 73 2e 3c -to</b> values.<
3d50: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e 67 65 6f /li>..<li><i>geo
3d60: 6d 3c 2f 69 3e 3a 20 6e 61 6d 65 20 6f 66 20 74 m</i>: name of t
3d70: 68 65 20 63 6f 6c 75 6d 6e 20 28 69 6e 20 74 68 he column (in th
3d80: 65 20 61 62 6f 76 65 20 54 61 62 6c 65 20 6f 72 e above Table or
3d90: 20 56 69 65 77 29 20 65 78 70 65 63 74 65 64 20 View) expected
3da0: 74 6f 20 63 6f 6e 74 61 69 6e 20 3c 62 3e 4c 69 to contain <b>Li
3db0: 6e 65 73 74 72 69 6e 67 73 3c 2f 62 3e 2e 3c 62 nestrings</b>.<b
3dc0: 72 3e 0d 0a 57 65 20 63 6f 75 6c 64 20 68 61 76 r>..We could hav
3dd0: 65 20 6c 65 67 69 74 69 6d 61 74 65 6c 79 20 70 e legitimately p
3de0: 61 73 73 65 64 20 61 20 3c 62 3e 4e 55 4c 4c 3c assed a <b>NULL<
3df0: 2f 62 3e 20 76 61 6c 75 65 20 66 6f 72 20 74 68 /b> value for th
3e00: 69 73 20 61 72 67 75 6d 65 6e 74 20 69 6e 20 74 is argument in t
3e10: 68 65 20 63 61 73 65 20 6f 66 20 61 20 3c 62 3e he case of a <b>
3e20: 4c 6f 67 69 63 61 6c 20 4e 65 74 77 6f 72 6b 3c Logical Network<
3e30: 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c /b>.</li>..<li><
3e40: 69 3e 4e 55 4c 4c 3c 2f 69 3e 3a 20 6e 61 6d 65 i>NULL</i>: name
3e50: 20 6f 66 20 74 68 65 20 63 6f 6c 75 6d 6e 20 28 of the column (
3e60: 69 6e 20 74 68 65 20 61 62 6f 76 65 20 54 61 62 in the above Tab
3e70: 6c 65 20 6f 72 20 56 69 65 77 29 20 65 78 70 65 le or View) expe
3e80: 63 74 65 64 20 74 6f 20 63 6f 6e 74 61 69 6e 20 cted to contain
3e90: 3c 62 3e 63 6f 73 74 3c 2f 62 3e 20 76 61 6c 75 <b>cost</b> valu
3ea0: 65 73 2e 3c 62 72 3e 0d 0a 49 6e 20 74 68 69 73 es.<br>..In this
3eb0: 20 63 61 73 65 20 77 65 20 68 61 76 65 20 70 61 case we have pa
3ec0: 73 73 65 64 20 61 20 3c 62 3e 4e 55 4c 4c 3c 2f ssed a <b>NULL</
3ed0: 62 3e 20 76 61 6c 75 65 2c 20 61 6e 64 20 63 6f b> value, and co
3ee0: 6e 73 65 71 75 65 6e 74 6c 79 20 74 68 65 20 3c nsequently the <
3ef0: 62 3e 63 6f 73 74 3c 2f 62 3e 20 6f 66 20 65 61 b>cost</b> of ea
3f00: 63 68 20 4c 69 6e 6b 20 77 69 6c 6c 20 62 65 20 ch Link will be
3f10: 61 73 73 75 6d 65 64 20 74 6f 20 62 65 20 72 65 assumed to be re
3f20: 70 72 65 73 65 6e 74 65 64 20 62 79 20 74 68 65 presented by the
3f30: 20 3c 62 3e 67 65 6f 6d 65 74 72 69 63 20 6c 65 <b>geometric le
3f40: 6e 67 74 68 3c 2f 62 3e 20 6f 66 20 74 68 65 20 ngth</b> of the
3f50: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 4c 69 corresponding Li
3f60: 6e 65 73 74 72 69 6e 67 2e 3c 62 72 3e 0d 0a 3c nestring.<br>..<
3f70: 75 3e 4e 6f 74 65 20 23 31 3c 2f 75 3e 3a 20 69 u>Note #1</u>: i
3f80: 6e 20 74 68 65 20 63 61 73 65 20 6f 66 20 4e 65 n the case of Ne
3f90: 74 77 6f 72 6b 73 20 62 61 73 65 64 20 6f 6e 20 tworks based on
3fa0: 3c 62 3e 6c 6f 6e 67 69 74 75 64 65 73 3c 2f 62 <b>longitudes</b
3fb0: 3e 20 61 6e 64 20 3c 62 3e 6c 61 74 69 74 75 64 > and <b>latitud
3fc0: 65 73 3c 2f 62 3e 20 28 3c 69 3e 61 6b 61 3c 2f es</b> (<i>aka</
3fd0: 69 3e 20 3c 62 3e 67 65 6f 67 72 61 70 68 69 63 i> <b>geographic
3fe0: 3c 2f 62 3e 20 52 65 66 65 72 65 6e 63 65 20 53 </b> Reference S
3ff0: 79 73 74 65 6d 73 29 20 74 68 65 20 67 65 6f 6d ystems) the geom
4000: 65 74 72 79 20 6c 65 6e 67 74 68 20 6f 66 20 61 etry length of a
4010: 6c 6c 20 4c 69 6e 65 73 74 72 69 6e 67 73 20 77 ll Linestrings w
4020: 69 6c 6c 20 62 65 20 70 72 65 63 69 73 65 6c 79 ill be precisely
4030: 20 3c 62 3e 6d 65 61 73 75 72 65 64 20 6f 6e 20 <b>measured on
4040: 74 68 65 20 65 6c 6c 69 70 73 6f 69 64 3c 2f 62 the ellipsoid</b
4050: 3e 20 62 79 20 61 70 70 6c 79 69 6e 67 20 74 68 > by applying th
4060: 65 20 6d 6f 73 74 20 61 63 63 75 72 61 74 65 20 e most accurate
4070: 3c 62 3e 67 65 6f 64 65 73 69 63 20 66 6f 72 6d <b>geodesic form
4080: 75 6c 61 65 3c 2f 62 3e 20 61 6e 64 20 77 69 6c ulae</b> and wil
4090: 6c 20 62 65 20 63 6f 6e 73 65 71 75 65 6e 74 6c l be consequentl
40a0: 79 20 65 78 70 72 65 73 73 65 64 20 69 6e 20 3c y expressed in <
40b0: 62 3e 6d 65 74 65 72 73 3c 2f 62 3e 2e 20 49 6e b>meters</b>. In
40c0: 20 61 6e 79 20 6f 74 68 65 72 20 63 61 73 65 20 any other case
40d0: 28 3c 62 3e 70 72 6f 6a 65 63 74 65 64 3c 2f 62 (<b>projected</b
40e0: 3e 20 52 65 66 65 72 65 6e 63 65 20 53 79 73 74 > Reference Syst
40f0: 65 6d 73 29 20 6c 65 6e 67 74 68 73 20 77 69 6c ems) lengths wil
4100: 6c 20 62 65 20 65 78 70 72 65 73 73 65 64 20 69 l be expressed i
4110: 6e 20 74 68 65 20 3c 62 3e 6d 65 61 73 75 72 65 n the <b>measure
4120: 20 75 6e 69 74 3c 2f 62 3e 20 64 65 66 69 6e 65 unit</b> define
4130: 64 20 62 79 20 74 68 65 20 52 65 66 65 72 65 6e d by the Referen
4140: 63 65 20 53 79 73 74 65 6d 20 28 65 2e 67 2e 20 ce System (e.g.
4150: 3c 62 3e 6d 65 74 65 72 73 3c 2f 62 3e 20 66 6f <b>meters</b> fo
4160: 72 20 3c 62 3e 55 54 4d 3c 2f 62 3e 20 70 72 6f r <b>UTM</b> pro
4170: 6a 65 63 74 69 6f 6e 73 20 61 6e 64 20 3c 62 3e jections and <b>
4180: 66 65 65 74 3c 2f 62 3e 20 66 6f 72 20 3c 62 3e feet</b> for <b>
4190: 4e 41 44 2d 66 74 3c 2f 62 3e 20 70 72 6f 6a 65 NAD-ft</b> proje
41a0: 63 74 69 6f 6e 73 29 2e 3c 62 72 3e 0d 0a 3c 75 ctions).<br>..<u
41b0: 3e 4e 6f 74 65 20 23 32 3c 2f 75 3e 3a 20 74 68 >Note #2</u>: th
41c0: 65 20 3c 62 3e 67 65 6f 6d 2d 63 6f 6c 75 6d 6e e <b>geom-column
41d0: 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 63 6f 73 74 </b> and <b>cost
41e0: 2d 63 6f 6c 75 6d 6e 3c 2f 62 3e 20 61 72 67 75 -column</b> argu
41f0: 6d 65 6e 74 73 20 61 72 65 20 6e 65 76 65 72 20 ments are never
4200: 61 6c 6c 6f 77 65 64 20 74 6f 20 62 65 20 3c 62 allowed to be <b
4210: 3e 4e 55 4c 4c 3c 2f 62 3e 20 61 74 20 74 68 65 >NULL</b> at the
4220: 20 73 61 6d 65 20 74 69 6d 65 2e 3c 2f 6c 69 3e same time.</li>
4230: 20 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c 74 61 62 6c 65 ..</ol>..<table
4240: 20 62 67 63 6f 6c 6f 72 3d 22 23 63 30 66 66 63 bgcolor="#c0ffc
4250: 30 22 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 0" cellspacing="
4260: 31 30 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 10" cellpadding=
4270: 22 36 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 "6"><tr><td>..<h
4280: 33 3e 54 65 63 68 6e 69 63 61 6c 20 6e 6f 74 65 3>Technical note
4290: 3c 2f 68 33 3e 0d 0a 54 68 65 20 69 6e 74 65 72 </h3>..The inter
42a0: 6e 61 6c 20 65 6e 63 6f 64 69 6e 67 20 61 64 6f nal encoding ado
42b0: 70 74 65 64 20 62 79 20 74 68 65 20 3c 62 3e 42 pted by the <b>B
42c0: 69 6e 61 72 79 20 44 61 74 61 20 54 61 62 6c 65 inary Data Table
42d0: 3c 2f 62 3e 20 69 73 20 75 6e 63 68 61 6e 67 65 </b> is unchange
42e0: 64 20 61 6e 64 20 69 73 20 74 68 65 20 73 61 6d d and is the sam
42f0: 65 20 66 6f 72 20 62 6f 74 68 20 3c 62 3e 56 69 e for both <b>Vi
4300: 72 74 75 61 6c 4e 65 74 77 6f 6b 3c 2f 62 3e 20 rtualNetwok</b>
4310: 61 6e 64 20 3c 62 3e 56 69 72 74 75 61 6c 52 6f and <b>VirtualRo
4320: 75 74 69 6e 67 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a uting</b>.<br>..
4330: 59 6f 75 20 63 61 6e 20 73 61 66 65 6c 79 20 62 You can safely b
4340: 61 73 65 20 61 20 3c 62 3e 56 69 72 74 75 61 6c ase a <b>Virtual
4350: 52 6f 75 74 69 6e 67 20 54 61 62 6c 65 3c 2f 62 Routing Table</b
4360: 3e 20 6f 6e 20 61 6e 79 20 65 78 69 73 74 69 6e > on any existin
4370: 67 20 42 69 6e 61 72 79 20 44 61 74 61 0d 0a 54 g Binary Data..T
4380: 61 62 6c 65 20 63 72 65 61 74 65 64 20 62 79 20 able created by
4390: 74 68 65 20 3c 62 3e 73 70 61 74 69 61 6c 69 74 the <b>spatialit
43a0: 65 2d 6e 65 74 77 6f 72 6b 3c 2f 62 3e 20 43 4c e-network</b> CL
43b0: 49 20 74 6f 6f 6c 2c 20 65 78 61 63 74 6c 79 20 I tool, exactly
43c0: 61 73 20 79 6f 75 20 63 61 6e 20 62 61 73 65 20 as you can base
43d0: 61 20 3c 62 3e 56 69 72 74 75 61 6c 4e 65 74 77 a <b>VirtualNetw
43e0: 6f 72 6b 20 54 61 62 6c 65 3c 2f 62 3e 20 6f 6e ork Table</b> on
43f0: 20 61 6e 79 20 42 69 6e 61 72 79 20 44 61 74 61 any Binary Data
4400: 20 54 61 62 6c 65 20 63 72 65 61 74 65 64 20 62 Table created b
4410: 79 20 74 68 65 20 3c 62 3e 43 72 65 61 74 65 52 y the <b>CreateR
4420: 6f 75 74 69 6e 67 28 29 3c 2f 62 3e 20 53 51 4c outing()</b> SQL
4430: 20 66 75 6e 63 74 69 6f 6e 2e 0d 0a 3c 76 65 72 function...<ver
4440: 62 61 74 69 6d 3e 0d 0a 43 52 45 41 54 45 20 56 batim>..CREATE V
4450: 49 52 54 55 41 4c 20 54 41 42 4c 45 20 74 65 73 IRTUAL TABLE tes
4460: 74 5f 6e 65 74 77 6f 72 6b 20 55 53 49 4e 47 20 t_network USING
4470: 56 69 72 74 75 61 6c 4e 65 74 77 6f 72 6b 28 27 VirtualNetwork('
4480: 73 6f 6d 65 5f 64 61 74 61 5f 74 61 62 6c 65 27 some_data_table'
4490: 29 3b 0d 0a 0d 0a 43 52 45 41 54 45 20 56 49 52 );....CREATE VIR
44a0: 54 55 41 4c 20 54 41 42 4c 45 20 74 65 73 74 5f TUAL TABLE test_
44b0: 72 6f 75 74 69 6e 67 20 55 53 49 4e 47 20 56 69 routing USING Vi
44c0: 72 74 75 61 6c 52 6f 75 74 69 6e 67 28 27 73 6f rtualRouting('so
44d0: 6d 65 5f 64 61 74 61 5f 74 61 62 6c 65 27 29 3b me_data_table');
44e0: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 49 ..</verbatim>..I
44f0: 6e 20 6f 72 64 65 72 20 74 6f 20 6d 61 6e 75 61 n order to manua
4500: 6c 6c 79 20 63 72 65 61 74 65 20 79 6f 75 72 20 lly create your
4510: 56 69 72 74 75 61 6c 20 54 61 62 6c 65 73 20 79 Virtual Tables y
4520: 6f 75 20 6a 75 73 74 20 68 61 76 65 20 74 6f 20 ou just have to
4530: 65 78 65 63 75 74 65 20 61 6e 20 61 70 70 72 6f execute an appro
4540: 70 72 69 61 74 65 20 3c 62 3e 43 52 45 41 54 45 priate <b>CREATE
4550: 20 56 49 52 54 55 41 4c 20 54 41 42 4c 45 20 2e VIRTUAL TABLE .
4560: 2e 2e 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c .. USING Virtual
4570: 2e 2e 2e 20 28 2e 2e 2e 29 3c 2f 62 3e 20 73 74 ... (...)</b> st
4580: 61 74 65 6d 65 6e 74 2e 0d 0a 3c 68 34 3e 57 61 atement...<h4>Wa
4590: 72 6e 69 6e 67 3c 2f 68 34 3e 0d 0a 49 6e 20 74 rning</h4>..In t
45a0: 68 65 20 63 61 73 65 20 6f 66 20 3c 62 3e 53 70 he case of <b>Sp
45b0: 61 74 69 61 6c 20 4e 65 74 77 6f 72 6b 73 3c 2f atial Networks</
45c0: 62 3e 20 62 61 73 65 64 20 6f 6e 20 61 6e 79 20 b> based on any
45d0: 3c 62 3e 67 65 6f 67 72 61 70 68 69 63 3c 2f 62 <b>geographic</b
45e0: 3e 20 52 65 66 65 72 65 6e 63 65 20 53 79 73 74 > Reference Syst
45f0: 65 6d 20 28 75 73 69 6e 67 20 3c 62 3e 6c 6f 6e em (using <b>lon
4600: 67 69 74 75 64 65 73 3c 2f 62 3e 20 61 6e 64 20 gitudes</b> and
4610: 3c 62 3e 6c 61 74 69 74 75 64 65 73 3c 2f 62 3e <b>latitudes</b>
4620: 29 20 74 68 65 72 65 20 69 73 20 61 6e 20 69 6d ) there is an im
4630: 70 6f 72 74 61 6e 74 20 64 69 66 66 65 72 65 6e portant differen
4640: 63 65 20 62 65 74 77 65 65 6e 20 42 69 6e 61 72 ce between Binar
4650: 79 20 44 61 74 61 20 54 61 62 6c 65 73 20 63 72 y Data Tables cr
4660: 65 61 74 65 64 20 62 79 20 74 68 65 20 3c 62 3e eated by the <b>
4670: 73 70 61 74 69 61 6c 69 74 65 5f 6e 65 74 77 6f spatialite_netwo
4680: 72 6b 3c 2f 62 3e 20 47 55 49 20 74 6f 6f 6c 20 rk</b> GUI tool
4690: 61 6e 64 20 20 42 69 6e 61 72 79 20 44 61 74 61 and Binary Data
46a0: 20 54 61 62 6c 65 73 20 63 72 65 61 74 65 64 20 Tables created
46b0: 62 79 20 74 68 65 20 3c 62 3e 43 72 65 61 74 65 by the <b>Create
46c0: 52 6f 75 74 69 6e 67 28 29 3c 2f 62 3e 20 53 51 Routing()</b> SQ
46d0: 4c 20 66 75 6e 63 74 69 6f 6e 20 77 68 65 6e 20 L function when
46e0: 3c 62 3e 63 6f 73 74 73 3c 2f 62 3e 20 61 72 65 <b>costs</b> are
46f0: 20 69 6d 70 6c 69 63 69 74 6c 79 20 62 61 73 65 implicitly base
4700: 64 20 6f 6e 20 74 68 65 20 67 65 6f 6d 65 74 72 d on the geometr
4710: 69 63 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 ic length of the
4720: 20 4c 69 6e 6b 27 73 20 4c 69 6e 65 73 74 72 69 Link's Linestri
4730: 6e 67 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 ng:..<ul>..<li>t
4740: 68 65 20 3c 62 3e 73 70 61 74 69 61 6c 69 74 65 he <b>spatialite
4750: 5f 6e 65 74 77 6f 72 6b 3c 2f 62 3e 20 43 4c 49 _network</b> CLI
4760: 20 74 6f 6f 6c 20 28 61 6e 64 20 74 68 65 20 3c tool (and the <
4770: 62 3e 47 55 49 20 77 69 7a 61 72 64 3c 2f 62 3e b>GUI wizard</b>
4780: 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 62 79 20 implemented by
4790: 70 72 65 76 69 6f 75 73 20 76 65 72 73 69 6f 6e previous version
47a0: 73 20 6f 66 20 3c 62 3e 73 70 61 74 69 61 6c 69 s of <b>spatiali
47b0: 74 65 5f 67 75 69 3c 2f 62 3e 29 20 63 6f 6d 70 te_gui</b>) comp
47c0: 75 74 65 20 74 68 65 20 4c 69 6e 65 73 74 72 69 ute the Linestri
47d0: 6e 67 27 73 20 6c 65 6e 67 74 68 20 61 73 20 61 ng's length as a
47e0: 6e 20 3c 62 3e 61 6e 67 75 6c 61 72 20 64 69 73 n <b>angular dis
47f0: 74 61 6e 63 65 3c 2f 62 3e 20 65 78 70 72 65 73 tance</b> expres
4800: 73 65 64 20 69 6e 20 3c 62 3e 64 65 67 72 65 65 sed in <b>degree
4810: 73 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 s</b>.</li>..<li
4820: 3e 74 68 65 20 3c 62 3e 43 72 65 61 74 65 52 6f >the <b>CreateRo
4830: 75 74 69 6e 67 28 29 3c 2f 62 3e 20 53 51 4c 20 uting()</b> SQL
4840: 66 75 6e 63 74 69 6f 6e 20 63 6f 6d 70 75 74 65 function compute
4850: 73 20 74 68 65 20 4c 69 6e 65 73 74 72 69 6e 67 s the Linestring
4860: 27 73 20 6c 65 6e 67 74 68 20 61 73 20 61 20 3c 's length as a <
4870: 62 3e 6c 69 6e 65 61 72 20 64 69 73 74 61 6e 63 b>linear distanc
4880: 65 3c 2f 62 3e 20 65 78 70 72 65 73 73 65 64 20 e</b> expressed
4890: 69 6e 20 3c 62 3e 6d 65 74 72 65 73 3c 2f 62 3e in <b>metres</b>
48a0: 20 62 79 20 61 70 70 6c 79 69 6e 67 20 74 68 65 by applying the
48b0: 20 6d 6f 73 74 20 61 63 63 75 72 61 74 65 20 3c most accurate <
48c0: 62 3e 67 65 6f 64 65 73 69 63 20 66 6f 72 6d 75 b>geodesic formu
48d0: 6c 61 65 3c 2f 62 3e 20 6f 6e 20 74 68 65 20 65 lae</b> on the e
48e0: 6c 6c 69 70 73 6f 69 64 2e 3c 2f 6c 69 3e 0d 0a llipsoid.</li>..
48f0: 3c 2f 75 6c 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 </ul>..</td></tr
4900: 3e 3c 2f 74 61 62 6c 65 3e 3c 62 72 3e 3c 62 72 ></table><br><br
4910: 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 >..<verbatim>..S
4920: 45 4c 45 43 54 20 43 72 65 61 74 65 52 6f 75 74 ELECT CreateRout
4930: 69 6e 67 28 27 62 79 63 61 72 5f 64 61 74 61 27 ing('bycar_data'
4940: 2c 20 27 62 79 63 61 72 27 2c 20 27 72 6f 61 64 , 'bycar', 'road
4950: 73 5f 76 77 27 2c 20 27 6e 6f 64 65 5f 66 72 6f s_vw', 'node_fro
4960: 6d 27 2c 20 27 6e 6f 64 65 5f 74 6f 27 2c 20 27 m', 'node_to', '
4970: 67 65 6f 6d 27 2c 20 27 63 6f 73 74 27 2c 20 27 geom', 'cost', '
4980: 74 6f 70 6f 6e 79 6d 27 2c 20 31 2c 20 31 2c 20 toponym', 1, 1,
4990: 27 6f 6e 65 77 61 79 5f 66 72 6f 6d 74 6f 27 2c 'oneway_fromto',
49a0: 20 27 6f 6e 65 77 61 79 5f 74 6f 66 72 6f 6d 27 'oneway_tofrom'
49b0: 2c 20 30 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d , 0);..---------
49c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 31 0d 0a -----------..1..
49d0: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 41 66 74 </verbatim>..Aft
49e0: 65 72 20 63 61 6c 6c 69 6e 67 20 79 65 74 20 61 er calling yet a
49f0: 6e 6f 74 68 65 72 20 74 69 6d 65 20 3c 62 3e 43 nother time <b>C
4a00: 72 65 61 74 65 52 6f 75 74 69 6e 67 28 29 3c 2f reateRouting()</
4a10: 62 3e 20 6e 6f 77 20 74 68 65 20 44 61 74 61 62 b> now the Datab
4a20: 61 73 65 20 63 6f 6e 74 61 69 6e 73 20 74 77 6f ase contains two
4a30: 20 66 75 72 74 68 65 72 20 54 61 62 6c 65 73 3a further Tables:
4a40: 20 3c 62 3e 62 79 63 61 72 3c 2f 62 3e 20 61 6e <b>bycar</b> an
4a50: 64 20 3c 62 3e 62 79 63 61 72 5f 64 61 74 61 3c d <b>bycar_data<
4a60: 2f 62 3e 2e 3c 62 72 3e 0d 0a 54 68 69 73 20 74 /b>.<br>..This t
4a70: 69 6d 65 20 79 6f 75 27 76 65 20 75 73 65 64 20 ime you've used
4a80: 74 68 65 20 3c 69 3e 63 6f 6d 70 6c 65 74 65 20 the <i>complete
4a90: 66 6f 72 6d 3c 2f 69 3e 20 6f 66 20 43 72 65 61 form</i> of Crea
4aa0: 74 65 52 6f 75 74 69 6e 67 28 29 3b 20 6c 65 74 teRouting(); let
4ab0: 27 73 20 73 65 65 20 69 6e 20 6d 6f 72 65 20 64 's see in more d
4ac0: 65 70 74 68 20 61 6c 6c 20 74 68 65 20 61 72 67 epth all the arg
4ad0: 75 6d 65 6e 74 73 20 61 6e 64 20 74 68 65 69 72 uments and their
4ae0: 20 6d 65 61 6e 69 6e 67 3a 0d 0a 3c 6f 6c 3e 0d meaning:..<ol>.
4af0: 0a 3c 6c 69 3e 3c 69 3e 62 79 63 61 72 5f 64 61 .<li><i>bycar_da
4b00: 74 61 3c 2f 69 3e 3a 20 73 61 6d 65 20 61 73 20 ta</i>: same as
4b10: 61 62 6f 76 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 above.</li>..<li
4b20: 3e 3c 69 3e 62 79 63 61 72 3c 2f 69 3e 3a 20 73 ><i>bycar</i>: s
4b30: 61 6d 65 20 61 73 20 61 62 6f 76 65 2e 3c 2f 6c ame as above.</l
4b40: 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e 72 6f 61 64 73 i>..<li><i>roads
4b50: 5f 76 77 3c 2f 69 3e 3a 20 73 61 6d 65 20 61 73 _vw</i>: same as
4b60: 20 61 62 6f 76 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c above.</li>..<l
4b70: 69 3e 3c 69 3e 6e 6f 64 65 5f 66 72 6f 6d 3c 2f i><i>node_from</
4b80: 69 3e 3a 20 73 61 6d 65 20 61 73 20 61 62 6f 76 i>: same as abov
4b90: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e e.</li>..<li><i>
4ba0: 6e 6f 64 65 5f 74 6f 3c 2f 69 3e 3a 20 73 61 6d node_to</i>: sam
4bb0: 65 20 61 73 20 61 62 6f 76 65 2e 3c 2f 6c 69 3e e as above.</li>
4bc0: 0d 0a 3c 6c 69 3e 3c 69 3e 67 65 6f 6d 3c 2f 69 ..<li><i>geom</i
4bd0: 3e 3a 20 73 61 6d 65 20 61 73 20 61 62 6f 76 65 >: same as above
4be0: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e 63 .</li>..<li><i>c
4bf0: 6f 73 74 3c 2f 69 3e 3a 20 73 61 6d 65 20 61 73 ost</i>: same as
4c00: 20 61 62 6f 76 65 2e 0d 0a 49 6e 20 74 68 69 73 above...In this
4c10: 20 63 61 73 65 20 77 65 20 68 61 76 65 20 72 65 case we have re
4c20: 66 65 72 65 6e 63 65 64 20 61 20 63 6f 6c 75 6d ferenced a colum
4c30: 6e 20 70 72 65 6c 6f 61 64 65 64 20 77 69 74 68 n preloaded with
4c40: 20 76 61 6c 75 65 73 20 63 6f 72 72 65 73 70 6f values correspo
4c50: 6e 64 69 6e 67 20 74 6f 20 74 68 65 20 3c 62 3e nding to the <b>
4c60: 74 69 6d 65 3c 2f 62 3e 20 6d 65 61 73 75 72 65 time</b> measure
4c70: 64 20 69 6e 20 3c 62 3e 73 65 63 6f 6e 64 73 3c d in <b>seconds<
4c80: 2f 62 3e 20 72 65 71 75 69 72 65 64 20 74 6f 20 /b> required to
4c90: 74 72 61 76 65 72 73 65 20 65 61 63 68 20 4c 69 traverse each Li
4ca0: 6e 6b 2e 3c 2f 6c 69 3e 20 0d 0a 3c 6c 69 3e 3c nk.</li> ..<li><
4cb0: 69 3e 74 6f 70 6f 6e 79 6d 3c 2f 69 3e 3a 20 6e i>toponym</i>: n
4cc0: 61 6d 65 20 6f 66 20 74 68 65 20 63 6f 6c 75 6d ame of the colum
4cd0: 6e 20 28 69 6e 20 74 68 65 20 61 62 6f 76 65 20 n (in the above
4ce0: 54 61 62 6c 65 20 6f 72 20 56 69 65 77 29 20 65 Table or View) e
4cf0: 78 70 65 63 74 65 64 20 74 6f 20 63 6f 6e 74 61 xpected to conta
4d00: 69 6e 20 3c 62 3e 72 6f 61 64 2d 6e 61 6d 65 3c in <b>road-name<
4d10: 2f 62 3e 20 76 61 6c 75 65 73 2e 3c 62 72 3e 0d /b> values.<br>.
4d20: 0a 49 74 20 63 6f 75 6c 64 20 62 65 20 6c 65 67 .It could be leg
4d30: 69 74 69 6d 61 74 65 6c 79 20 73 65 74 20 74 6f itimately set to
4d40: 20 3c 62 3e 4e 55 4c 4c 3c 2f 62 3e 20 69 66 20 <b>NULL</b> if
4d50: 61 6c 6c 20 4c 69 6e 6b 73 20 61 72 65 20 61 6e all Links are an
4d60: 6f 6e 79 6d 6f 75 73 2e 3c 2f 6c 69 3e 0d 0a 3c onymous.</li>..<
4d70: 6c 69 3e 3c 69 3e 31 3c 2f 69 3e 3a 20 61 20 62 li><i>1</i>: a b
4d80: 6f 6f 6c 65 61 6e 20 66 6c 61 67 20 69 6e 74 65 oolean flag inte
4d90: 6e 64 65 64 20 74 6f 20 73 70 65 63 69 66 79 20 nded to specify
4da0: 69 66 20 74 68 65 20 4e 65 74 77 6f 72 6b 20 6d if the Network m
4db0: 75 73 74 20 73 75 70 70 6f 72 74 20 74 68 65 20 ust support the
4dc0: 3c 62 3e 41 2a 20 61 6c 67 6f 72 69 74 68 6d 3c <b>A* algorithm<
4dd0: 2f 62 3e 20 6f 72 20 6e 6f 74 20 28 73 65 74 20 /b> or not (set
4de0: 74 6f 20 3c 62 3e 54 52 55 45 3c 2f 62 3e 20 62 to <b>TRUE</b> b
4df0: 79 20 64 65 66 61 75 6c 74 29 2e 3c 2f 6c 69 3e y default).</li>
4e00: 0d 0a 3c 6c 69 3e 3c 69 3e 31 3c 2f 69 3e 3a 20 ..<li><i>1</i>:
4e10: 61 20 62 6f 6f 6c 65 61 6e 20 66 6c 61 67 20 69 a boolean flag i
4e20: 6e 74 65 6e 64 65 64 20 74 6f 20 73 70 65 63 69 ntended to speci
4e30: 66 79 20 69 66 20 61 6c 6c 20 4e 65 74 77 6f 72 fy if all Networ
4e40: 6b 27 73 20 4c 69 6e 6b 73 20 61 72 65 20 61 73 k's Links are as
4e50: 73 75 6d 65 64 20 74 6f 20 62 65 20 3c 62 3e 62 sumed to be <b>b
4e60: 69 64 69 72 65 63 74 69 6f 6e 61 6c 3c 2f 62 3e idirectional</b>
4e70: 20 6f 72 20 6e 6f 74 20 28 61 73 73 75 6d 65 64 or not (assumed
4e80: 20 74 6f 20 62 65 20 3c 62 3e 54 52 55 45 3c 2f to be <b>TRUE</
4e90: 62 3e 20 62 79 20 64 65 66 61 75 6c 74 29 2e 3c b> by default).<
4ea0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e 6f 6e 65 /li>..<li><i>one
4eb0: 77 61 79 5f 66 72 6f 6d 74 6f 3c 2f 69 3e 3a 20 way_fromto</i>:
4ec0: 6e 61 6d 65 20 6f 66 20 74 68 65 20 63 6f 6c 75 name of the colu
4ed0: 6d 6e 20 28 69 6e 20 74 68 65 20 61 62 6f 76 65 mn (in the above
4ee0: 20 54 61 62 6c 65 20 6f 72 20 56 69 65 77 29 20 Table or View)
4ef0: 65 78 70 65 63 74 65 64 20 74 6f 20 63 6f 6e 74 expected to cont
4f00: 61 69 6e 20 62 6f 6f 6c 65 61 6e 20 66 6c 61 67 ain boolean flag
4f10: 73 20 73 70 65 63 69 66 79 69 6e 67 20 69 66 20 s specifying if
4f20: 65 61 63 68 20 4c 69 6e 6b 20 63 61 6e 20 62 65 each Link can be
4f30: 20 74 72 61 76 65 72 73 65 64 20 69 6e 20 74 68 traversed in th
4f40: 65 20 3c 62 3e 66 72 6f 6d 2d 74 6f 3c 2f 62 3e e <b>from-to</b>
4f50: 20 64 69 72 65 63 74 69 6f 6e 20 6f 72 20 6e 6f direction or no
4f60: 74 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e t.</li>..<li><i>
4f70: 6f 6e 65 77 61 79 5f 74 6f 66 72 6f 6d 3c 2f 69 oneway_tofrom</i
4f80: 3e 3a 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63 >: name of the c
4f90: 6f 6c 75 6d 6e 20 28 69 6e 20 74 68 65 20 61 62 olumn (in the ab
4fa0: 6f 76 65 20 54 61 62 6c 65 20 6f 72 20 56 69 65 ove Table or Vie
4fb0: 77 29 20 65 78 70 65 63 74 65 64 20 74 6f 20 63 w) expected to c
4fc0: 6f 6e 74 61 69 6e 20 62 6f 6f 6c 65 61 6e 20 66 ontain boolean f
4fd0: 6c 61 67 73 20 73 70 65 63 69 66 79 69 6e 67 20 lags specifying
4fe0: 69 66 20 65 61 63 68 20 4c 69 6e 6b 20 63 61 6e if each Link can
4ff0: 20 62 65 20 74 72 61 76 65 72 73 65 64 20 69 6e be traversed in
5000: 20 74 68 65 20 3c 62 3e 74 6f 2d 66 72 6f 6d 3c the <b>to-from<
5010: 2f 62 3e 20 64 69 72 65 63 74 69 6f 6e 20 6f 72 /b> direction or
5020: 20 6e 6f 74 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f not.<br>..<u>No
5030: 74 65 20 23 31 3c 2f 75 3e 3a 20 62 6f 74 68 20 te #1</u>: both
5040: 3c 62 3e 66 72 6f 6d 2d 74 6f 3c 2f 62 3e 20 61 <b>from-to</b> a
5050: 6e 64 20 3c 62 3e 74 6f 2d 66 72 6f 6d 3c 2f 62 nd <b>to-from</b
5060: 3e 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 63 > column names c
5070: 61 6e 20 62 65 20 6c 65 67 69 74 69 6d 61 74 65 an be legitimate
5080: 6c 79 20 73 65 74 20 61 73 20 3c 62 3e 4e 55 4c ly set as <b>NUL
5090: 4c 3c 2f 62 3e 20 69 66 20 6e 6f 20 3c 62 3e 6f L</b> if no <b>o
50a0: 6e 65 2d 77 61 79 3c 2f 62 3e 20 72 65 73 74 72 ne-way</b> restr
50b0: 69 63 74 69 6f 6e 73 20 61 70 70 6c 79 20 74 6f ictions apply to
50c0: 20 74 68 65 20 63 75 72 72 65 6e 74 20 4e 65 74 the current Net
50d0: 77 6f 72 6b 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f work.<br>..<u>No
50e0: 74 65 20 23 32 3c 2f 75 3e 3a 20 4e 65 74 77 6f te #2</u>: Netwo
50f0: 72 6b 73 20 6f 66 20 74 68 65 20 3c 62 3e 75 6e rks of the <b>un
5100: 69 64 69 72 65 63 74 69 6f 6e 61 6c 3c 2f 62 3e idirectional</b>
5110: 20 74 79 70 65 20 61 72 65 20 6e 65 76 65 72 20 type are never
5120: 65 6e 61 62 6c 65 64 20 74 6f 20 72 65 66 65 72 enabled to refer
5130: 65 6e 63 65 20 3c 62 3e 6f 6e 65 2d 77 61 79 3c ence <b>one-way<
5140: 2f 62 3e 20 63 6f 6c 75 6d 6e 73 20 28 74 68 65 /b> columns (the
5150: 79 20 73 68 6f 75 6c 64 20 61 6c 77 61 79 73 20 y should always
5160: 62 65 20 73 65 74 20 74 6f 20 3c 62 3e 4e 55 4c be set to <b>NUL
5170: 4c 3c 2f 62 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c L</b>).</li>..<l
5180: 69 3e 3c 69 3e 30 3c 2f 69 3e 3a 20 61 20 62 6f i><i>0</i>: a bo
5190: 6f 6c 65 61 6e 20 66 6c 61 67 20 69 6e 74 65 6e olean flag inten
51a0: 64 69 6e 67 20 61 6e 20 3c 62 3e 6f 76 65 72 77 ding an <b>overw
51b0: 72 69 74 65 20 61 75 74 68 6f 72 69 7a 61 74 69 rite authorizati
51c0: 6f 6e 3c 2f 62 3e 2e 0d 0a 3c 75 6c 3e 0d 0a 3c on</b>...<ul>..<
51d0: 6c 69 3e 49 66 20 73 65 74 20 74 6f 20 3c 62 3e li>If set to <b>
51e0: 46 41 4c 53 45 3c 2f 62 3e 20 61 6e 20 65 78 63 FALSE</b> an exc
51f0: 65 70 74 69 6f 6e 20 77 69 6c 6c 20 62 65 20 72 eption will be r
5200: 61 69 73 65 64 20 69 66 20 74 68 65 20 3c 62 3e aised if the <b>
5210: 42 69 6e 61 72 79 20 44 61 74 61 20 54 61 62 6c Binary Data Tabl
5220: 65 3c 2f 62 3e 20 61 6e 64 2f 6f 72 20 74 68 65 e</b> and/or the
5230: 20 3c 62 3e 56 69 72 74 75 61 6c 52 6f 75 74 69 <b>VirtualRouti
5240: 6e 67 20 54 61 62 6c 65 3c 2f 62 3e 20 64 6f 20 ng Table</b> do
5250: 61 6c 72 65 61 64 79 20 65 78 69 73 74 2e 3c 2f already exist.</
5260: 6c 69 3e 0d 0a 3c 6c 69 3e 49 66 20 73 65 74 20 li>..<li>If set
5270: 74 6f 20 3c 62 3e 54 52 55 45 3c 2f 62 3e 20 65 to <b>TRUE</b> e
5280: 76 65 6e 74 75 61 6c 6c 79 20 65 78 69 73 74 69 ventually existi
5290: 6e 67 20 54 61 62 6c 65 73 20 77 69 6c 6c 20 62 ng Tables will b
52a0: 65 20 70 72 65 76 65 6e 74 69 76 65 6c 79 20 64 e preventively d
52b0: 72 6f 70 70 65 64 20 69 6d 6d 65 64 69 61 74 65 ropped immediate
52c0: 6c 79 20 62 65 66 6f 72 65 20 73 74 61 72 74 69 ly before starti
52d0: 6e 67 20 74 68 65 20 65 78 65 63 75 74 69 6f 6e ng the execution
52e0: 20 6f 66 20 3c 62 3e 43 72 65 61 74 65 52 6f 75 of <b>CreateRou
52f0: 74 69 6e 67 28 29 3c 2f 62 3e 2e 3c 2f 6c 69 3e ting()</b>.</li>
5300: 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f ..</ul></li>..</
5310: 6f 6c 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c ol>..<br>..<tabl
5320: 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 66 66 66 e bgcolor="#ffff
5330: 63 30 22 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d c0" cellspacing=
5340: 22 31 30 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 "10" cellpadding
5350: 3d 22 36 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c ="6"><tr><td>..<
5360: 68 33 3e 48 69 67 68 6c 69 67 68 74 3a 20 77 68 h3>Highlight: wh
5370: 65 72 65 20 79 6f 75 20 61 72 65 3c 2f 68 33 3e ere you are</h3>
5380: 0d 0a 59 6f 75 27 76 65 20 6a 75 73 74 20 63 72 ..You've just cr
5390: 65 61 74 65 64 20 74 77 6f 20 56 69 72 74 75 61 eated two Virtua
53a0: 6c 52 6f 75 74 69 6e 67 20 54 61 62 6c 65 73 20 lRouting Tables
53b0: 62 61 73 65 64 20 6f 6e 20 64 69 66 66 65 72 65 based on differe
53c0: 6e 74 20 73 65 74 74 69 6e 67 73 3b 20 62 6f 74 nt settings; bot
53d0: 68 20 74 68 65 6d 20 61 72 65 20 70 65 72 66 65 h them are perfe
53e0: 63 74 6c 79 20 76 61 6c 69 64 20 61 6e 64 20 72 ctly valid and r
53f0: 65 61 73 6f 6e 61 62 6c 65 2c 20 62 75 74 20 74 easonable, but t
5400: 68 65 79 20 61 72 65 20 69 6e 74 65 6e 64 65 64 hey are intended
5410: 20 66 6f 72 20 64 69 66 66 65 72 65 6e 74 20 70 for different p
5420: 75 72 70 6f 73 65 73 3a 0d 0a 3c 75 6c 3e 0d 0a urposes:..<ul>..
5430: 3c 6c 69 3e 3c 62 3e 62 79 66 6f 6f 74 3c 2f 62 <li><b>byfoot</b
5440: 3e 20 69 73 20 73 70 65 63 69 66 69 63 61 6c 6c > is specificall
5450: 79 20 69 6e 74 65 6e 64 65 64 20 66 6f 72 20 3c y intended for <
5460: 62 3e 70 65 64 65 73 74 72 69 61 6e 73 3c 2f 62 b>pedestrians</b
5470: 3e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61 6c >:..<ul>..<li>al
5480: 6c 20 4c 69 6e 6b 73 20 61 72 65 20 61 6c 77 61 l Links are alwa
5490: 79 73 20 61 73 73 75 6d 65 64 20 74 6f 20 62 65 ys assumed to be
54a0: 20 61 63 63 65 73 69 62 6c 65 20 69 6e 20 3c 62 accesible in <b
54b0: 3e 62 6f 74 68 20 64 69 72 65 63 74 69 6f 6e 73 >both directions
54c0: 3c 2f 62 3e 3b 20 74 68 65 72 65 20 61 72 65 20 </b>; there are
54d0: 6e 6f 20 3c 62 3e 6f 6e 65 2d 77 61 79 73 3c 2f no <b>one-ways</
54e0: 62 3e 20 61 6e 64 20 6e 6f 20 3c 62 3e 66 6f 72 b> and no <b>for
54f0: 62 69 64 64 65 6e 3c 2f 62 3e 20 4c 69 6e 6b 73 bidden</b> Links
5500: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 .</li>..<li>the
5510: 3c 62 3e 63 6f 73 74 3c 2f 62 3e 20 6f 66 20 65 <b>cost</b> of e
5520: 61 63 68 20 4c 69 6e 6b 20 69 73 20 64 69 72 65 ach Link is dire
5530: 63 74 6c 79 20 72 65 70 72 65 73 65 6e 74 65 64 ctly represented
5540: 20 62 79 20 69 74 73 20 67 65 6f 6d 65 74 72 69 by its geometri
5550: 63 20 3c 62 3e 6c 65 6e 67 74 68 3c 2f 62 3e 2c c <b>length</b>,
5560: 20 74 68 61 74 20 69 73 20 63 6f 6e 73 69 73 74 that is consist
5570: 65 6e 74 20 77 69 74 68 20 74 68 65 20 61 73 73 ent with the ass
5580: 6f 70 6d 74 69 6f 6e 20 6f 66 20 61 6e 20 61 6c opmtion of an al
5590: 6d 6f 73 74 20 63 6f 6e 73 74 61 6e 74 20 73 70 most constant sp
55a0: 65 65 64 20 72 61 74 68 65 72 20 69 6d 6d 75 6e eed rather immun
55b0: 65 20 66 72 6f 6d 20 61 64 76 65 72 73 65 20 72 e from adverse r
55c0: 6f 61 64 20 63 6f 6e 64 69 74 69 6f 6e 73 20 61 oad conditions a
55d0: 6e 64 20 74 72 61 66 66 69 63 20 63 6f 6e 67 65 nd traffic conge
55e0: 73 74 69 6f 6e 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 stion.</li>..</u
55f0: 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e l></li>..<li><b>
5600: 62 79 63 61 72 3c 2f 62 3e 20 69 73 20 73 70 65 bycar</b> is spe
5610: 63 69 66 69 63 61 6c 6c 79 20 69 6e 74 65 6e 64 cifically intend
5620: 65 64 20 66 6f 72 20 3c 62 3e 6d 6f 74 6f 72 20 ed for <b>motor
5630: 76 65 68 69 63 6c 65 73 3c 2f 62 3e 3a 0d 0a 3c vehicles</b>:..<
5640: 75 6c 3e 0d 0a 3c 6c 69 3e 6d 61 6e 79 20 4c 69 ul>..<li>many Li
5650: 6e 6b 73 20 61 72 65 20 65 78 70 65 63 74 65 64 nks are expected
5660: 20 74 6f 20 62 65 20 61 63 63 65 73 73 69 62 6c to be accessibl
5670: 65 20 69 6e 20 3c 62 3e 62 6f 74 68 20 64 69 72 e in <b>both dir
5680: 65 63 74 69 6f 6e 73 3c 2f 62 3e 20 62 75 74 20 ections</b> but
5690: 6f 74 68 65 72 73 20 63 6f 75 6c 64 20 65 61 73 others could eas
56a0: 69 6c 79 20 62 65 20 73 75 62 6a 65 63 74 20 74 ily be subject t
56b0: 6f 20 3c 62 3e 6f 6e 65 2d 77 61 79 3c 2f 62 3e o <b>one-way</b>
56c0: 20 72 65 73 74 72 69 63 74 69 6f 6e 73 20 6f 72 restrictions or
56d0: 20 65 76 65 6e 20 62 65 20 63 6f 6d 70 6c 65 74 even be complet
56e0: 65 6c 79 20 3c 62 3e 66 6f 72 62 69 64 64 65 6e ely <b>forbidden
56f0: 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e </b>.</li>..<li>
5700: 74 68 65 20 63 6f 73 74 20 6f 66 20 65 61 63 68 the cost of each
5710: 20 4c 69 6e 6b 20 69 73 20 65 78 70 72 65 73 73 Link is express
5720: 65 64 20 61 73 20 61 6e 20 65 73 74 69 6d 61 74 ed as an estimat
5730: 65 64 20 3c 62 3e 74 72 61 76 65 6c 20 74 69 6d ed <b>travel tim
5740: 65 3c 2f 62 3e 2c 20 62 65 63 61 75 73 65 20 74 e</b>, because t
5750: 68 65 20 65 78 70 65 63 74 65 64 20 73 70 65 65 he expected spee
5760: 64 73 20 63 61 6e 20 67 72 65 61 74 6c 79 20 76 ds can greatly v
5770: 61 72 79 20 61 63 63 6f 72 64 69 6e 67 6c 79 20 ary accordingly
5780: 74 6f 20 73 70 65 63 69 66 69 63 20 72 6f 61 64 to specific road
5790: 20 63 6f 6e 64 69 74 69 6f 6e 73 2c 20 74 72 61 conditions, tra
57a0: 66 66 69 63 20 63 6f 6e 67 65 73 74 69 6f 6e 20 ffic congestion
57b0: 61 6e 64 20 6c 65 67 61 6c 20 72 65 67 75 6c 61 and legal regula
57c0: 74 69 6f 6e 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 tions.</li>..</u
57d0: 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a l></li>..</ul>..
57e0: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 </td></tr>..</ta
57f0: 62 6c 65 3e 0d 0a 0d 0a 3c 68 33 3e 55 74 69 6c ble>....<h3>Util
5800: 69 74 79 20 66 75 6e 63 74 69 6f 6e 20 66 6f 72 ity function for
5810: 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 73 automatically s
5820: 65 74 74 69 6e 67 20 4e 6f 64 65 46 72 6f 6d 20 etting NodeFrom
5830: 61 6e 64 20 4e 6f 64 65 54 6f 20 49 44 73 3c 2f and NodeTo IDs</
5840: 68 33 3e 0d 0a 53 6f 6d 65 74 69 6d 65 73 20 69 h3>..Sometimes i
5850: 74 20 63 6f 75 6c 64 20 65 76 65 6e 74 75 61 6c t could eventual
5860: 6c 79 20 68 61 70 70 65 6e 20 74 6f 20 65 6e 63 ly happen to enc
5870: 6f 75 6e 74 65 72 20 73 6f 6d 65 20 3c 62 3e 53 ounter some <b>S
5880: 70 61 74 69 61 6c 20 4e 65 74 77 6f 72 6b 3c 2f patial Network</
5890: 62 3e 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f b> representatio
58a0: 6e 20 62 65 69 6e 67 20 66 75 6c 6c 79 20 74 6f n being fully to
58b0: 70 6f 6c 6f 67 69 63 61 6c 6c 79 20 63 6f 6e 73 pologically cons
58c0: 69 73 74 65 6e 74 20 62 75 74 20 63 6f 6d 70 6c istent but compl
58d0: 65 74 65 6c 79 20 6c 61 63 6b 69 6e 67 20 61 6e etely lacking an
58e0: 79 20 64 65 66 69 6e 69 74 69 6f 6e 20 61 62 6f y definition abo
58f0: 75 74 20 3c 62 3e 4e 6f 64 65 46 72 6f 6d 3c 2f ut <b>NodeFrom</
5900: 62 3e 20 61 6e 64 20 3c 62 3e 4e 6f 64 65 54 6f b> and <b>NodeTo
5910: 3c 2f 62 3e 20 69 64 65 6e 74 69 66 69 65 72 73 </b> identifiers
5920: 2e 3c 62 72 3e 0d 0a 49 6e 20 74 68 69 73 20 73 .<br>..In this s
5930: 70 65 63 69 66 69 63 20 63 61 73 65 20 79 6f 75 pecific case you
5940: 20 63 61 6e 20 73 75 63 63 65 73 73 66 75 6c 6c can successfull
5950: 79 20 72 65 63 6f 76 65 72 20 61 20 70 65 72 66 y recover a perf
5960: 65 63 74 6c 79 20 76 61 6c 69 64 20 4e 65 74 77 ectly valid Netw
5970: 6f 72 6b 20 62 79 20 63 61 6c 6c 69 6e 67 20 74 ork by calling t
5980: 68 65 20 3c 62 3e 43 72 65 61 74 65 52 6f 75 74 he <b>CreateRout
5990: 69 6e 67 4e 6f 64 65 73 28 29 3c 2f 62 3e 20 53 ingNodes()</b> S
59a0: 51 4c 20 66 75 6e 63 74 69 6f 6e 2e 0d 0a 3c 76 QL function...<v
59b0: 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 erbatim>..SELECT
59c0: 20 43 72 65 61 74 65 52 6f 75 74 69 6e 67 4e 6f CreateRoutingNo
59d0: 64 65 73 28 4e 55 4c 4c 2c 20 27 74 61 62 6c 65 des(NULL, 'table
59e0: 5f 6e 61 6d 65 27 2c 20 27 67 65 6f 6d 27 2c 20 _name', 'geom',
59f0: 27 6e 6f 64 65 5f 66 72 6f 6d 27 2c 20 27 6e 6f 'node_from', 'no
5a00: 64 65 5f 74 6f 27 29 3b 0d 0a 5f 5f 5f 5f 5f 5f de_to');..______
5a10: 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f 5f ________________
5a20: 5f 5f 5f 0d 0a 31 0d 0a 3c 2f 76 65 72 62 61 74 ___..1..</verbat
5a30: 69 6d 3e 0d 0a 4c 65 74 27 73 20 65 78 61 6d 69 im>..Let's exami
5a40: 6e 65 20 61 6c 6c 20 61 72 67 75 6d 65 6e 74 73 ne all arguments
5a50: 20 61 6e 64 20 74 68 65 69 72 20 6d 65 61 6e 69 and their meani
5a60: 6e 67 3a 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e 3c ng:..<ol>..<li><
5a70: 69 3e 4e 55 4c 4c 3c 2f 69 3e 3a 20 6e 61 6d 65 i>NULL</i>: name
5a80: 20 6f 66 20 74 68 65 20 3c 62 3e 41 74 74 61 63 of the <b>Attac
5a90: 68 65 64 2d 44 42 3c 2f 62 3e 20 63 6f 6e 74 61 hed-DB</b> conta
5aa0: 69 6e 69 6e 67 20 74 68 65 20 53 70 61 74 69 61 ining the Spatia
5ab0: 6c 20 54 61 62 6c 65 2e 3c 62 72 3e 0d 0a 49 74 l Table.<br>..It
5ac0: 20 63 61 6e 20 62 65 20 6c 65 67 69 74 69 6d 61 can be legitima
5ad0: 74 65 6c 79 20 73 65 74 20 74 6f 20 3c 62 3e 4e tely set to <b>N
5ae0: 55 4c 4c 3c 2f 62 3e 2c 20 61 6e 64 20 69 6e 20 ULL</b>, and in
5af0: 74 68 69 73 20 63 61 73 65 20 74 68 65 20 3c 62 this case the <b
5b00: 3e 4d 41 49 4e 3c 2f 62 3e 20 44 42 20 69 73 20 >MAIN</b> DB is
5b10: 61 73 73 75 6d 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c assumed.</li>..<
5b20: 6c 69 3e 3c 69 3e 74 61 62 6c 65 5f 6e 61 6d 65 li><i>table_name
5b30: 3c 2f 69 3e 3a 20 6e 61 6d 65 20 6f 66 20 74 68 </i>: name of th
5b40: 65 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65 2e e Spatial Table.
5b50: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e 67 65 </li>..<li><i>ge
5b60: 6f 6d 3c 2f 6c 69 3e 3a 20 6e 61 6d 65 20 6f 66 om</li>: name of
5b70: 20 74 68 65 20 63 6f 6c 75 6d 6e 20 28 28 69 6e the column ((in
5b80: 20 74 68 65 20 61 62 6f 76 65 20 54 61 62 6c 65 the above Table
5b90: 29 20 63 6f 6e 74 61 69 6e 69 6e 67 20 3c 62 3e ) containing <b>
5ba0: 4c 69 6e 65 73 74 72 69 6e 67 73 3c 2f 62 3e 2e Linestrings</b>.
5bb0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e 6e 6f </li>..<li><i>no
5bc0: 64 65 5f 66 72 6f 6d 3c 2f 69 3e 3a 20 6e 61 6d de_from</i>: nam
5bd0: 65 20 6f 66 20 74 68 65 20 63 6f 6c 75 6d 6e 20 e of the column
5be0: 74 6f 20 62 65 20 61 64 64 65 64 20 74 6f 20 74 to be added to t
5bf0: 68 65 20 61 62 6f 76 65 20 54 61 62 6c 65 20 61 he above Table a
5c00: 6e 64 20 70 6f 70 75 6c 61 74 65 64 20 77 69 74 nd populated wit
5c10: 68 20 61 70 70 72 6f 70 72 69 61 74 65 20 3c 62 h appropriate <b
5c20: 3e 4e 6f 64 65 46 72 6f 6d 3c 2f 62 3e 20 49 44 >NodeFrom</b> ID
5c30: 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 69 3e s.</li>..<li><i>
5c40: 6e 6f 64 65 5f 74 6f 3c 2f 69 3e 3a 20 6e 61 6d node_to</i>: nam
5c50: 65 20 6f 66 20 74 68 65 20 63 6f 6c 75 6d 6e 20 e of the column
5c60: 74 6f 20 62 65 20 61 64 64 65 64 20 74 6f 20 74 to be added to t
5c70: 68 65 20 61 62 6f 76 65 20 54 61 62 6c 65 20 61 he above Table a
5c80: 6e 64 20 70 6f 70 75 6c 61 74 65 64 20 77 69 74 nd populated wit
5c90: 68 20 61 70 70 72 6f 70 72 69 61 74 65 20 3c 62 h appropriate <b
5ca0: 3e 4e 6f 64 65 54 6f 3c 2f 62 3e 20 49 44 73 2e >NodeTo</b> IDs.
5cb0: 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 <br>..<u>Note</u
5cc0: 3e 3a 20 62 6f 74 68 20 3c 62 3e 4e 6f 64 65 46 >: both <b>NodeF
5cd0: 72 6f 6d 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 4e rom</b> and <b>N
5ce0: 6f 64 65 54 6f 3c 2f 62 3e 20 63 6f 6c 75 6d 6e odeTo</b> column
5cf0: 73 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 s should not be
5d00: 61 6c 72 65 61 64 79 20 64 65 66 69 6e 65 64 20 already defined
5d10: 69 6e 20 74 68 65 20 61 62 6f 76 65 20 54 61 62 in the above Tab
5d20: 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 6f 6c 3e 0d le.</li>..</ol>.
5d30: 0a 3c 62 3e 43 72 65 61 74 65 52 6f 75 74 69 6e .<b>CreateRoutin
5d40: 67 4e 6f 64 65 73 28 29 3c 2f 62 3e 20 77 69 6c gNodes()</b> wil
5d50: 6c 20 72 65 74 75 72 6e 20 3c 62 3e 31 3c 2f 62 l return <b>1</b
5d60: 3e 20 28 3c 69 3e 61 6b 61 3c 2f 69 3e 20 3c 62 > (<i>aka</i> <b
5d70: 3e 54 52 55 45 3c 2f 62 3e 29 20 6f 6e 20 73 75 >TRUE</b>) on su
5d80: 63 63 65 73 73 3b 20 61 6e 20 65 78 63 65 70 74 ccess; an except
5d90: 69 6f 6e 20 77 69 6c 6c 20 62 65 20 72 61 69 73 ion will be rais
5da0: 65 64 20 6f 6e 20 66 61 69 6c 75 72 65 2e 3c 62 ed on failure.<b
5db0: 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 3e 3a r>..<u>Note</u>:
5dc0: 20 79 6f 75 20 63 61 6e 20 63 61 6c 6c 20 3c 62 you can call <b
5dd0: 3e 43 72 65 61 74 65 52 6f 75 74 69 6e 67 5f 47 >CreateRouting_G
5de0: 65 74 4c 61 73 74 45 72 72 6f 72 28 29 3c 2f 62 etLastError()</b
5df0: 3e 20 73 6f 20 74 6f 20 70 72 65 63 69 73 65 6c > so to precisel
5e00: 79 20 69 64 65 6e 74 69 66 79 20 74 68 65 20 63 y identify the c
5e10: 61 75 73 65 20 61 63 63 6f 75 6e 74 69 6e 67 20 ause accounting
5e20: 66 6f 72 20 66 61 69 6c 75 72 65 2e 3c 62 72 3e for failure.<br>
5e30: 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 <br><br>..<table
5e40: 20 62 67 63 6f 6c 6f 72 3d 22 23 63 30 66 66 63 bgcolor="#c0ffc
5e50: 30 22 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 0" cellspacing="
5e60: 31 30 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 10" cellpadding=
5e70: 22 36 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 "6"><tr><td>..<h
5e80: 33 3e 48 61 6e 64 6c 69 6e 67 20 64 79 6e 61 6d 3>Handling dynam
5e90: 69 63 20 4e 65 74 77 6f 72 6b 73 3c 2f 68 33 3e ic Networks</h3>
5ea0: 0d 0a 53 6f 6d 65 74 69 6d 65 73 20 69 74 20 68 ..Sometimes it h
5eb0: 61 70 70 65 6e 73 20 74 68 61 74 20 61 20 4e 65 appens that a Ne
5ec0: 74 77 6f 72 6b 20 63 6f 75 6c 64 20 62 65 20 73 twork could be s
5ed0: 75 62 6a 65 63 74 20 74 6f 20 72 61 74 68 65 72 ubject to rather
5ee0: 20 66 72 65 71 75 65 6e 74 20 63 68 61 6e 67 65 frequent change
5ef0: 73 3a 20 73 6f 6d 65 20 6e 65 77 20 4c 69 6e 6b s: some new Link
5f00: 73 20 72 65 71 75 69 72 65 20 74 6f 20 62 65 20 s require to be
5f10: 61 64 64 65 64 2c 20 6f 62 73 6f 6c 65 74 65 20 added, obsolete
5f20: 4c 69 6e 6b 73 20 72 65 71 75 69 72 65 20 74 6f Links require to
5f30: 20 62 65 20 72 65 6d 6f 76 65 64 2c 20 6f 74 68 be removed, oth
5f40: 65 72 20 4c 69 6e 6b 73 20 6d 61 79 20 61 73 73 er Links may ass
5f50: 75 6d 65 20 61 20 64 69 66 66 65 72 65 6e 74 20 ume a different
5f60: 43 6f 73 74 2c 20 6f 6e 65 2d 77 61 79 73 20 63 Cost, one-ways c
5f70: 6f 75 6c 64 20 62 65 20 72 65 76 65 72 73 65 64 ould be reversed
5f80: 2c 20 74 68 65 20 64 69 73 63 69 70 6c 69 6e 65 , the discipline
5f90: 20 6f 66 20 70 65 64 65 73 74 72 69 61 6e 20 61 of pedestrian a
5fa0: 72 65 61 73 20 63 6f 75 6c 64 20 62 65 20 6d 6f reas could be mo
5fb0: 64 69 66 69 65 64 20 61 6e 64 20 73 6f 20 6f 6e dified and so on
5fc0: 2e 3c 62 72 3e 0d 0a 41 20 56 69 72 74 75 61 6c .<br>..A Virtual
5fd0: 52 6f 75 74 69 6e 67 20 54 61 62 6c 65 20 69 73 Routing Table is
5fe0: 20 61 6c 77 61 79 73 20 62 61 73 65 64 20 6f 6e always based on
5ff0: 20 61 20 63 6f 6d 70 61 6e 69 6f 6e 20 42 69 6e a companion Bin
6000: 61 72 79 20 44 61 74 61 20 54 61 62 6c 65 2c 20 ary Data Table,
6010: 74 68 61 74 20 69 73 20 69 6e 74 72 69 6e 73 69 that is intrinsi
6020: 63 61 6c 6c 79 20 3c 62 3e 73 74 61 74 69 63 3c cally <b>static<
6030: 2f 62 3e 2c 20 61 6e 64 20 63 6f 6e 73 65 71 75 /b>, and consequ
6040: 65 6e 74 6c 79 20 79 6f 75 20 61 72 65 20 72 65 ently you are re
6050: 71 75 69 72 65 64 20 74 6f 20 72 65 2d 63 72 65 quired to re-cre
6060: 61 74 65 20 62 6f 74 68 20 74 68 65 6d 20 66 72 ate both them fr
6070: 6f 6d 20 74 69 6d 65 20 74 6f 20 74 69 6d 65 20 om time to time
6080: 69 6e 20 6f 72 64 65 72 20 74 6f 20 73 75 70 70 in order to supp
6090: 6f 72 74 20 61 6c 6c 20 72 65 63 65 6e 74 20 63 ort all recent c
60a0: 68 61 6e 67 65 73 20 61 66 66 65 63 74 69 6e 67 hanges affecting
60b0: 20 74 68 65 20 75 6e 64 65 72 6c 61 79 69 6e 67 the underlaying
60c0: 20 4e 65 74 77 6f 72 6b 2e 3c 62 72 3e 0d 0a 54 Network.<br>..T
60d0: 68 65 20 6f 70 74 69 6d 61 6c 20 66 72 65 71 75 he optimal frequ
60e0: 65 6e 63 79 20 66 6f 72 20 63 79 63 6c 69 63 61 ency for cyclica
60f0: 6c 6c 79 20 72 65 66 72 65 73 68 69 6e 67 20 74 lly refreshing t
6100: 68 65 20 52 6f 75 74 69 6e 67 20 54 61 62 6c 65 he Routing Table
6110: 73 20 73 74 72 69 63 74 6c 79 20 64 65 70 65 6e s strictly depen
6120: 64 73 20 6f 6e 20 73 70 65 63 69 66 69 63 20 72 ds on specific r
6130: 65 71 75 69 72 65 6d 65 6e 74 73 2c 20 62 75 74 equirements, but
6140: 20 74 68 65 20 74 77 6f 20 6f 76 65 72 61 6c 6c the two overall
6150: 20 61 70 70 72 6f 61 63 68 65 73 20 61 72 65 20 approaches are
6160: 63 6f 6d 6d 6f 6e 6c 79 20 61 64 6f 70 74 65 64 commonly adopted
6170: 3a 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e :..<ol>..<li><b>
6180: 6c 6f 77 20 66 72 65 71 75 65 6e 63 79 20 72 65 low frequency re
6190: 66 72 65 73 68 3c 2f 62 3e 3a 20 62 65 73 74 20 fresh</b>: best
61a0: 66 69 74 20 66 6f 72 20 73 6c 6f 77 6c 79 20 65 fit for slowly e
61b0: 76 6f 6c 76 69 6e 67 20 4e 65 74 77 6f 72 6b 73 volving Networks
61c0: 2e 3c 62 72 3e 0d 0a 49 6e 20 74 68 69 73 20 63 .<br>..In this c
61d0: 61 73 65 20 72 65 2d 63 72 65 61 74 69 6e 67 20 ase re-creating
61e0: 74 68 65 20 4e 65 74 77 6f 72 6b 20 54 61 62 6c the Network Tabl
61f0: 65 73 20 6f 6e 63 65 20 61 20 6d 6f 6e 74 68 20 es once a month
6200: 2f 20 77 65 65 6b 20 2f 20 64 61 79 20 63 6f 75 / week / day cou
6210: 6c 64 20 62 65 20 72 65 61 73 6f 6e 61 62 6c 79 ld be reasonably
6220: 20 65 6e 6f 75 67 68 2e 0d 0a 52 65 63 72 65 61 enough...Recrea
6230: 74 69 6e 67 20 74 68 65 20 54 61 62 6c 65 73 20 ting the Tables
6240: 66 72 6f 6d 20 73 63 72 61 74 63 68 20 75 73 75 from scratch usu
6250: 61 6c 6c 79 20 72 65 71 75 69 72 65 73 20 66 65 ally requires fe
6260: 77 20 6d 69 6e 75 74 65 73 20 28 6f 72 20 65 76 w minutes (or ev
6270: 65 6e 20 6c 65 73 73 2c 20 64 65 70 65 6e 64 69 en less, dependi
6280: 6e 67 20 6f 6e 20 74 68 65 20 6e 75 6d 62 65 72 ng on the number
6290: 20 6f 66 20 4c 69 6e 6b 73 29 2e 3c 62 72 3e 0d of Links).<br>.
62a0: 0a 54 68 65 20 72 65 66 72 65 73 68 20 61 63 74 .The refresh act
62b0: 69 76 69 74 69 65 73 20 63 6f 75 6c 64 20 62 65 ivities could be
62c0: 20 6f 70 70 6f 72 74 75 6e 65 6c 79 20 70 6c 61 opportunely pla
62d0: 6e 6e 65 64 20 61 74 20 6c 6f 77 20 74 72 61 66 nned at low traf
62e0: 66 69 63 20 68 6f 75 72 73 20 28 65 2e 67 2e 20 fic hours (e.g.
62f0: 64 75 72 69 6e 67 20 74 68 65 20 6e 69 67 68 74 during the night
6300: 29 2c 20 61 6e 64 20 3c 62 3e 43 72 65 61 74 65 ), and <b>Create
6310: 52 6f 75 74 69 6e 67 28 29 3c 2f 62 3e 20 63 6f Routing()</b> co
6320: 75 6c 64 20 62 65 20 75 73 65 66 75 6c 6c 79 20 uld be usefully
6330: 63 61 6c 6c 65 64 20 62 79 20 65 6e 61 62 6c 69 called by enabli
6340: 6e 67 20 74 68 65 20 3c 62 3e 6f 76 65 72 77 72 ng the <b>overwr
6350: 69 74 65 3c 2f 62 3e 20 6f 70 74 69 6f 6e 2e 3c ite</b> option.<
6360: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 6d 65 64 /li>..<li><b>med
6370: 69 75 6d 2d 68 69 67 68 20 66 72 65 71 75 65 6e ium-high frequen
6380: 63 79 20 72 65 66 72 65 73 68 3c 2f 62 3e 3a 20 cy refresh</b>:
6390: 62 65 73 74 20 66 69 74 20 66 6f 72 20 71 75 69 best fit for qui
63a0: 63 6b 6c 79 20 65 76 6f 6c 76 69 6e 67 20 4e 65 ckly evolving Ne
63b0: 74 77 6f 72 6b 73 2e 3c 62 72 3e 0d 0a 52 65 2d tworks.<br>..Re-
63c0: 63 72 65 61 74 69 6e 67 20 74 68 65 20 4e 65 74 creating the Net
63d0: 77 6f 72 6b 20 54 61 62 6c 65 73 20 6f 6e 63 65 work Tables once
63e0: 20 70 65 72 20 68 6f 75 72 20 28 6f 72 20 65 76 per hour (or ev
63f0: 65 6e 20 6d 6f 72 65 20 66 72 65 71 75 65 6e 74 en more frequent
6400: 6c 79 29 20 63 6f 75 6c 64 20 62 65 20 73 74 72 ly) could be str
6410: 69 63 74 6c 79 20 72 65 71 75 69 72 65 64 2c 20 ictly required,
6420: 61 6e 64 20 66 72 65 71 75 65 6e 74 20 3c 62 3e and frequent <b>
6430: 6f 75 74 20 6f 66 20 73 65 72 76 69 63 65 3c 2f out of service</
6440: 62 3e 20 70 65 72 69 6f 64 73 20 77 68 69 6c 65 b> periods while
6450: 20 77 61 69 74 69 6e 67 20 66 6f 72 20 74 68 65 waiting for the
6460: 20 72 65 66 72 65 73 68 20 70 72 6f 63 65 73 73 refresh process
6470: 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 63 6f 75 to complete cou
6480: 6c 64 20 65 61 73 69 6c 79 20 62 65 20 75 6e 61 ld easily be una
6490: 63 63 65 70 74 61 62 6c 65 2e 3c 62 72 3e 0d 0a cceptable.<br>..
64a0: 49 6e 20 74 68 69 73 20 63 61 73 65 20 79 6f 75 In this case you
64b0: 20 63 6f 75 6c 64 20 75 73 65 66 75 6c 6c 79 20 could usefully
64c0: 61 64 6f 70 74 20 61 20 3c 62 3e 6d 75 6c 74 69 adopt a <b>multi
64d0: 2d 74 68 72 65 61 64 65 64 20 73 74 72 61 74 65 -threaded strate
64e0: 67 79 3c 2f 62 3e 3a 0d 0a 3c 75 6c 3e 0d 0a 3c gy</b>:..<ul>..<
64f0: 6c 69 3e 3c 62 3e 74 68 72 65 61 64 20 23 31 3c li><b>thread #1<
6500: 2f 62 3e 20 28 3c 69 3e 74 68 65 20 72 65 61 64 /b> (<i>the read
6510: 65 72 3c 2f 69 3e 29 3a 20 74 68 69 73 20 66 69 er</i>): this fi
6520: 72 73 74 20 74 68 72 65 61 64 20 69 73 20 69 6e rst thread is in
6530: 74 65 6e 64 65 64 20 74 6f 20 73 65 72 76 69 63 tended to servic
6540: 65 20 61 6e 79 20 69 6e 63 6f 6d 69 6e 67 20 52 e any incoming R
6550: 6f 75 74 69 6e 67 20 72 65 71 75 65 73 74 2e 20 outing request.
6560: 49 74 20 77 69 6c 6c 20 62 65 20 61 6c 77 61 79 It will be alway
6570: 73 20 61 63 74 69 76 65 2c 20 61 6e 64 20 77 69 s active, and wi
6580: 6c 6c 20 74 61 72 67 65 74 20 61 20 77 65 6c 6c ll target a well
6590: 20 6b 6e 6f 77 6e 20 56 69 72 74 75 61 6c 52 6f known VirtualRo
65a0: 75 74 69 6e 67 20 54 61 62 6c 65 20 28 65 2e 67 uting Table (e.g
65b0: 2e 20 3c 62 3e 6d 79 5f 72 6f 75 74 69 6e 67 3c . <b>my_routing<
65c0: 2f 62 3e 20 62 61 73 65 64 20 6f 6e 20 3c 62 3e /b> based on <b>
65d0: 6d 79 5f 72 6f 75 74 69 6e 67 5f 64 61 74 61 3c my_routing_data<
65e0: 2f 62 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e /b>).</li>..<li>
65f0: 3c 62 3e 74 68 72 65 61 64 20 23 32 3c 2f 62 3e <b>thread #2</b>
6600: 20 28 3c 69 3e 74 68 65 20 77 72 69 74 65 72 3c (<i>the writer<
6610: 2f 69 3e 29 3a 20 74 68 69 73 20 73 65 63 6f 6e /i>): this secon
6620: 64 20 74 68 72 65 61 64 20 69 73 20 6a 75 73 74 d thread is just
6630: 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 72 65 2d intended to re-
6640: 63 72 65 61 74 65 20 62 6f 74 68 20 4e 65 74 77 create both Netw
6650: 6f 72 6b 20 54 61 62 6c 65 73 20 61 74 20 70 72 ork Tables at pr
6660: 65 64 65 66 69 6e 65 64 20 69 6e 74 65 72 76 61 edefined interva
6670: 6c 73 2c 20 61 6e 64 20 69 74 20 77 69 6c 6c 20 ls, and it will
6680: 73 6c 65 65 70 20 62 65 74 77 65 65 6e 20 61 6e sleep between an
6690: 20 69 6e 74 65 72 76 61 6c 20 61 6e 64 20 74 68 interval and th
66a0: 65 20 6f 74 68 65 72 2e 3c 62 72 3e 0d 0a 57 68 e other.<br>..Wh
66b0: 65 6e 20 74 68 69 73 20 74 68 72 65 61 64 20 61 en this thread a
66c0: 77 61 6b 65 6e 73 20 77 69 6c 6c 20 72 65 2d 63 wakens will re-c
66d0: 72 65 61 74 65 20 62 6f 74 68 20 4e 65 74 77 6f reate both Netwo
66e0: 72 6b 20 54 61 62 6c 65 73 20 62 79 20 75 73 69 rk Tables by usi
66f0: 6e 67 20 64 69 66 66 65 72 65 6e 74 20 6e 61 6d ng different nam
6700: 65 73 2c 20 61 6e 64 20 77 69 6c 6c 20 6f 76 65 es, and will ove
6710: 72 77 72 69 74 65 20 74 68 65 20 73 74 61 6e 64 rwrite the stand
6720: 61 72 64 20 6f 6e 65 73 20 6a 75 73 74 20 61 74 ard ones just at
6730: 20 74 68 65 20 76 65 72 79 20 65 6e 64 20 6f 66 the very end of
6740: 20 74 68 65 20 70 72 6f 63 65 73 73 20 28 61 63 the process (ac
6750: 74 69 76 61 74 69 6e 67 20 61 20 73 65 6d 61 70 tivating a semap
6760: 68 6f 72 65 20 64 75 72 69 6e 67 20 74 68 69 73 hore during this
6770: 20 73 68 6f 72 74 2d 74 69 6d 65 64 20 6c 61 73 short-timed las
6780: 74 20 73 74 65 70 20 69 73 20 68 69 67 68 6c 79 t step is highly
6790: 20 72 65 63 6f 6d 6d 65 6e 64 65 64 29 2e 3c 62 recommended).<b
67a0: 72 3e 0d 0a 53 6f 6d 65 74 68 69 6e 67 20 6c 69 r>..Something li
67b0: 6b 65 20 74 68 69 73 20 70 73 65 75 64 6f 2d 63 ke this pseudo-c
67c0: 6f 64 65 20 65 78 65 6d 70 6c 69 66 69 65 73 3a ode exemplifies:
67d0: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 ..<verbatim>..SE
67e0: 4c 45 43 54 20 43 72 65 61 74 65 52 6f 75 74 69 LECT CreateRouti
67f0: 6e 67 28 27 6e 65 77 5f 6d 79 5f 72 6f 75 74 69 ng('new_my_routi
6800: 6e 67 5f 64 61 74 61 27 2c 20 27 6e 65 77 5f 6d ng_data', 'new_m
6810: 79 5f 72 6f 75 74 69 6e 67 27 2c 20 2e 2e 2e 29 y_routing', ...)
6820: 3b 0d 0a 0d 0a 2d 2d 3e 20 73 74 61 72 74 20 74 ;....--> start t
6830: 68 65 20 73 65 6d 61 70 68 6f 72 65 20 73 6f 20 he semaphore so
6840: 74 6f 20 6c 6f 63 6b 20 74 68 65 20 6f 74 68 65 to lock the othe
6850: 72 20 74 68 72 65 61 64 0d 0a 0d 0a 42 45 47 49 r thread....BEGI
6860: 4e 3b 0d 0a 44 52 4f 50 20 54 41 42 4c 45 20 6d N;..DROP TABLE m
6870: 79 5f 72 6f 75 74 69 6e 67 3b 0d 0a 44 52 4f 50 y_routing;..DROP
6880: 20 54 41 42 4c 45 20 6d 79 5f 72 6f 75 74 69 6e TABLE my_routin
6890: 67 5f 64 61 74 61 3b 0d 0a 53 45 4c 45 43 54 20 g_data;..SELECT
68a0: 43 6c 6f 6e 65 54 61 62 6c 65 28 27 4d 41 49 4e CloneTable('MAIN
68b0: 27 2c 20 27 6e 65 77 5f 6d 79 5f 72 6f 75 74 69 ', 'new_my_routi
68c0: 6e 67 5f 64 61 74 61 27 2c 20 27 6d 79 5f 72 6f ng_data', 'my_ro
68d0: 75 74 69 6e 67 5f 64 61 74 61 27 2c 20 30 29 3b uting_data', 0);
68e0: 0d 0a 43 52 45 41 54 45 20 56 49 52 54 55 41 4c ..CREATE VIRTUAL
68f0: 20 54 41 42 4c 45 20 6d 79 5f 72 6f 75 74 69 6e TABLE my_routin
6900: 67 20 55 53 49 4e 47 20 56 69 72 74 75 61 6c 52 g USING VirtualR
6910: 6f 75 74 69 6e 67 28 27 6d 79 5f 72 6f 75 74 69 outing('my_routi
6920: 6e 67 5f 64 61 74 61 27 29 3b 0d 0a 44 52 4f 50 ng_data');..DROP
6930: 20 54 41 42 4c 45 20 6e 65 77 5f 6d 79 5f 72 6f TABLE new_my_ro
6940: 75 74 69 6e 67 3b 0d 0a 44 52 4f 50 20 54 41 42 uting;..DROP TAB
6950: 4c 45 20 6e 65 77 5f 6d 79 5f 72 6f 75 74 69 6e LE new_my_routin
6960: 67 5f 64 61 74 61 3b 0d 0a 43 4f 4d 4d 49 54 3b g_data;..COMMIT;
6970: 0d 0a 0d 0a 2d 2d 3e 20 72 65 6d 6f 76 65 20 74 ....--> remove t
6980: 68 65 20 73 65 6d 61 70 68 6f 72 65 0d 0a 3c 2f he semaphore..</
6990: 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 3e 4e 6f verbatim>..<u>No
69a0: 74 65 3c 2f 75 3e 3a 20 73 74 72 69 63 74 6c 79 te</u>: strictly
69b0: 20 72 65 73 70 65 63 74 69 6e 67 20 74 68 65 20 respecting the
69c0: 61 62 6f 76 65 20 73 65 71 75 65 6e 63 65 20 6f above sequence o
69d0: 66 20 53 51 4c 20 6f 70 65 72 61 74 69 6f 6e 73 f SQL operations
69e0: 20 69 73 20 61 62 73 6f 6c 75 74 65 6c 79 20 72 is absolutely r
69f0: 65 71 75 69 72 65 64 2e 3c 2f 6c 69 3e 20 0d 0a equired.</li> ..
6a00: 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 6f 6c </ul></li>..</ol
6a10: 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c >..</td></tr>..<
6a20: 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 3c /table>..<br>..<
6a30: 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 table bgcolor="#
6a40: 66 66 62 30 36 30 22 20 63 65 6c 6c 73 70 61 63 ffb060" cellspac
6a50: 69 6e 67 3d 22 31 30 22 20 63 65 6c 6c 70 61 64 ing="10" cellpad
6a60: 64 69 6e 67 3d 22 36 22 3e 3c 74 72 3e 3c 74 64 ding="6"><tr><td
6a70: 3e 0d 0a 3c 68 33 3e 57 61 72 6e 69 6e 67 3a 20 >..<h3>Warning:
6a80: 68 6f 77 20 74 6f 20 63 6f 72 72 65 63 74 6c 79 how to correctly
6a90: 20 64 72 6f 70 20 4e 65 74 77 6f 72 6b 20 54 61 drop Network Ta
6aa0: 62 6c 65 73 3c 2f 68 33 3e 0d 0a 57 68 65 6e 20 bles</h3>..When
6ab0: 64 72 6f 70 70 69 6e 67 20 61 20 56 69 72 74 75 dropping a Virtu
6ac0: 61 6c 52 6f 75 74 69 6e 67 20 54 61 62 6c 65 20 alRouting Table
6ad0: 61 6e 64 20 69 74 73 20 63 6f 6d 70 61 6e 69 6f and its companio
6ae0: 6e 20 42 69 6e 61 72 79 20 44 61 74 61 20 54 61 n Binary Data Ta
6af0: 62 6c 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 ble following th
6b00: 65 20 63 6f 72 72 65 63 74 20 73 65 71 75 65 6e e correct sequen
6b10: 63 65 20 6f 66 20 53 51 4c 20 63 6f 6d 6d 61 6e ce of SQL comman
6b20: 64 73 20 69 73 20 70 61 72 61 6d 6f 75 6e 74 2e ds is paramount.
6b30: 3c 62 72 3e 0d 0a 46 61 69 6c 69 6e 67 20 74 6f <br>..Failing to
6b40: 20 73 74 72 69 63 74 6c 79 20 72 65 73 70 65 63 strictly respec
6b50: 74 20 74 68 65 20 65 78 70 65 63 74 65 64 20 73 t the expected s
6b60: 65 71 75 65 6e 63 65 20 77 69 6c 6c 20 73 75 72 equence will sur
6b70: 65 6c 79 20 63 61 75 73 65 20 79 6f 75 20 73 65 ely cause you se
6b80: 76 65 72 61 6c 20 74 72 6f 75 62 6c 65 73 20 61 veral troubles a
6b90: 6e 64 20 73 65 76 65 72 65 20 68 65 61 64 61 63 nd severe headac
6ba0: 68 65 73 2c 20 61 6e 64 20 77 69 6c 6c 20 70 6f hes, and will po
6bb0: 73 73 69 62 6c 79 20 6c 65 61 64 20 74 6f 20 61 ssibly lead to a
6bc0: 6e 20 69 72 72 65 6d 65 64 69 61 62 6c 79 20 63 n irremediably c
6bd0: 6f 72 72 75 70 74 65 64 20 64 61 74 61 62 61 73 orrupted databas
6be0: 65 2e 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e 79 6f e...<ol>..<li>yo
6bf0: 75 20 61 72 65 20 61 6c 77 61 79 73 20 65 78 70 u are always exp
6c00: 65 63 74 65 64 20 74 6f 20 44 52 4f 50 20 66 69 ected to DROP fi
6c10: 72 73 74 20 74 68 65 20 56 69 72 74 75 61 6c 52 rst the VirtualR
6c20: 6f 75 74 69 6e 67 20 54 61 62 6c 65 2e 3c 2f 6c outing Table.</l
6c30: 69 3e 0d 0a 3c 6c 69 3e 79 6f 75 20 63 61 6e 20 i>..<li>you can
6c40: 73 61 66 65 6c 79 20 44 52 4f 50 20 74 68 65 20 safely DROP the
6c50: 63 6f 6d 70 61 6e 69 6f 6e 20 42 69 6e 61 72 79 companion Binary
6c60: 20 44 61 74 61 20 54 61 62 6c 65 20 6f 6e 6c 79 Data Table only
6c70: 20 6f 6e 63 65 20 69 74 27 73 20 6e 6f 20 6c 6f once it's no lo
6c80: 6e 67 65 72 20 72 65 66 65 72 65 6e 63 65 64 20 nger referenced
6c90: 62 79 20 74 68 65 20 56 69 72 74 75 61 6c 52 6f by the VirtualRo
6ca0: 75 74 69 6e 67 20 54 61 62 6c 65 2e 3c 2f 6c 69 uting Table.</li
6cb0: 3e 0d 0a 3c 6c 69 3e 62 79 20 66 6f 6c 6c 6f 77 >..<li>by follow
6cc0: 69 6e 67 20 74 68 65 20 72 65 76 65 72 73 65 20 ing the reverse
6cd0: 73 65 71 75 65 6e 63 65 20 79 6f 75 27 6c 6c 20 sequence you'll
6ce0: 64 69 72 65 63 74 6c 79 20 63 72 65 61 74 65 20 directly create
6cf0: 61 6e 20 3c 62 3e 6f 72 70 68 61 6e 3c 2f 62 3e an <b>orphan</b>
6d00: 20 56 69 72 74 75 61 6c 52 6f 75 74 69 6e 67 20 VirtualRouting
6d10: 54 61 62 6c 65 20 74 68 61 74 20 63 61 6e 6e 6f Table that canno
6d20: 74 20 62 65 20 61 63 63 65 73 73 65 64 20 61 6e t be accessed an
6d30: 79 20 6c 6f 6e 67 65 72 2c 20 61 6e 64 20 74 68 y longer, and th
6d40: 61 74 20 77 69 6c 6c 20 63 6f 6e 73 65 71 75 65 at will conseque
6d50: 6e 74 6c 79 20 72 65 66 75 73 65 20 74 6f 20 62 ntly refuse to b
6d60: 65 20 64 72 6f 70 70 65 64 2e 3c 62 72 3e 0d 0a e dropped.<br>..
6d70: 42 65 20 77 61 72 6e 65 64 20 21 21 3c 2f 6c 69 Be warned !!</li
6d80: 3e 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c 2f 74 64 3e 3c >..</ol>..</td><
6d90: 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a /tr>..</table>..
6da0: 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 3c 62 <br><br>..<hr><b
6db0: 72 3e 0d 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 r>..<a href="htt
6dc0: 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 ps://www.gaia-gi
6dd0: 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 s.it/fossil/libs
6de0: 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e patialite/wiki?n
6df0: 61 6d 65 3d 34 2e 33 2e 30 2d 64 6f 63 22 3e 62 ame=4.3.0-doc">b
6e00: 61 63 6b 3c 2f 61 3e 0a 5a 20 62 37 31 65 34 62 ack</a>.Z b71e4b
6e10: 61 34 39 62 38 32 37 34 34 30 66 61 32 65 35 34 a49b827440fa2e54
6e20: 62 66 65 66 65 66 35 35 66 38 0a bfefef55f8.