Hex Artifact Content
Not logged in

Artifact dda35238e827eed0b056dc4e179a862b6c01d527:

Wiki page [benchmark-4.0] by sandro 2012-11-10 12:59:07.
0000: 44 20 32 30 31 32 2d 31 31 2d 31 30 54 31 32 3a  D 2012-11-10T12:
0010: 35 39 3a 30 37 2e 35 35 32 0a 4c 20 62 65 6e 63  59:07.552.L benc
0020: 68 6d 61 72 6b 2d 34 2e 30 0a 50 20 32 32 31 39  hmark-4.0.P 2219
0030: 66 36 36 36 36 30 64 38 34 35 33 36 61 64 31 64  f66660d84536ad1d
0040: 35 63 30 66 65 62 63 38 36 66 66 32 31 36 33 37  5c0febc86ff21637
0050: 65 66 64 62 0a 55 20 73 61 6e 64 72 6f 0a 57 20  efdb.U sandro.W 
0060: 31 33 33 32 38 0a 3c 68 32 3e 42 65 6e 63 68 6d  13328.<h2>Benchm
0070: 61 72 63 6b 20 28 61 6b 61 20 22 63 6f 6d 70 61  arck (aka "compa
0080: 72 69 6e 67 20 61 70 70 6c 65 73 20 61 6e 64 20  ring apples and 
0090: 6f 72 61 6e 67 65 73 22 29 3c 2f 68 32 3e 0d 0a  oranges")</h2>..
00a0: 42 61 63 6b 20 74 6f 20 3c 61 20 68 72 65 66 3d  Back to <a href=
00b0: 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69  "https://www.gai
00c0: 61 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f  a-gis.it/fossil/
00d0: 6c 69 62 73 70 61 74 69 61 6c 69 74 65 2f 77 69  libspatialite/wi
00e0: 6b 69 3f 6e 61 6d 65 3d 73 77 69 74 63 68 69 6e  ki?name=switchin
00f0: 67 2d 74 6f 2d 34 2e 30 23 76 69 72 74 75 61 6c  g-to-4.0#virtual
0100: 6f 67 72 22 3e 6d 61 69 6e 20 70 61 67 65 3c 2f  ogr">main page</
0110: 61 3e 0d 0a 3c 68 32 3e 49 6e 74 72 6f 64 75 63  a>..<h2>Introduc
0120: 74 69 6f 6e 3c 2f 68 32 3e 0d 0a 54 6f 64 61 79  tion</h2>..Today
0130: 20 49 27 76 65 20 63 61 73 75 61 6c 6c 79 20 72   I've casually r
0140: 65 61 64 20 74 68 69 73 20 3c 61 20 68 72 65 66  ead this <a href
0150: 3d 22 68 74 74 70 3a 2f 2f 67 66 6f 73 73 2e 62  ="http://gfoss.b
0160: 6c 6f 67 73 70 6f 74 2e 69 74 2f 32 30 31 32 2f  logspot.it/2012/
0170: 31 31 2f 61 72 63 67 69 73 2d 76 73 2d 71 67 69  11/arcgis-vs-qgi
0180: 73 2d 65 74 63 2d 63 6c 69 70 70 69 6e 67 2d 63  s-etc-clipping-c
0190: 6f 6e 74 65 73 74 2e 68 74 6d 6c 22 3e 62 6c 6f  ontest.html">blo
01a0: 67 20 70 61 67 65 3c 2f 61 3e 3b 20 6d 61 6e 79  g page</a>; many
01b0: 20 74 68 61 6e 6b 73 20 74 6f 20 6d 79 20 64 65   thanks to my de
01c0: 61 72 20 66 72 69 65 6e 64 20 4d 61 72 6b 75 73  ar friend Markus
01d0: 20 4e 65 74 65 6c 65 72 20 28 74 68 65 20 6d 61   Neteler (the ma
01e0: 69 6e 74 61 69 6e 65 72 20 6f 66 20 47 52 41 53  intainer of GRAS
01f0: 53 20 47 49 53 29 20 66 6f 72 20 70 6f 69 6e 74  S GIS) for point
0200: 69 6e 67 20 6d 79 20 61 74 74 65 6e 74 69 6f 6e  ing my attention
0210: 20 6f 6e 20 74 68 69 73 20 74 6f 70 69 63 2e 3c   on this topic.<
0220: 62 72 3e 0d 0a 54 68 65 20 6f 72 69 67 69 6e 61  br>..The origina
0230: 6c 20 3c 62 3e 43 6c 69 70 70 69 6e 67 20 43 6f  l <b>Clipping Co
0240: 6e 74 65 73 74 3c 2f 62 3e 20 73 69 6d 70 6c 79  ntest</b> simply
0250: 20 63 6f 6d 70 61 72 65 64 20 73 65 76 65 72 61   compared severa
0260: 6c 20 70 6f 70 75 6c 61 72 20 44 65 73 6b 79 6f  l popular Deskyo
0270: 70 20 47 49 53 20 28 41 72 63 47 69 73 2c 20 51  p GIS (ArcGis, Q
0280: 47 49 53 2c 20 67 76 53 49 47 2c 20 47 52 41 53  GIS, gvSIG, GRAS
0290: 53 20 61 6e 64 20 6f 74 68 65 72 73 29 2c 20 62  S and others), b
02a0: 75 74 20 74 68 65 72 65 20 77 61 73 20 61 6e 20  ut there was an 
02b0: 6f 62 76 69 6f 75 73 20 6f 6d 69 73 73 69 6f 6e  obvious omission
02c0: 2e 3c 62 72 3e 0d 0a 4e 6f 20 53 70 61 74 69 61  .<br>..No Spatia
02d0: 6c 20 44 42 4d 53 20 77 61 73 20 63 6f 6e 73 69  l DBMS was consi
02e0: 64 65 72 65 64 20 61 74 20 61 6c 6c 2e 20 28 3c  dered at all. (<
02f0: 69 3e 74 6f 6f 20 62 61 64 3b 20 61 20 72 65 61  i>too bad; a rea
0300: 6c 6c 79 20 65 6d 62 61 72 72 61 73 73 69 6e 67  lly embarrassing
0310: 20 6f 6d 69 73 73 69 6f 6e 3c 2f 69 3e 29 3c 62   omission</i>)<b
0320: 72 3e 3c 62 72 3e 0d 0a 41 66 74 65 72 20 61 6c  r><br>..After al
0330: 6c 20 61 20 3c 62 3e 43 6c 69 70 70 69 6e 67 20  l a <b>Clipping 
0340: 43 6f 6e 74 65 73 74 3c 2f 62 3e 20 73 6f 75 6e  Contest</b> soun
0350: 64 73 20 6d 6f 72 65 20 6c 69 6b 65 20 61 20 70  ds more like a p
0360: 75 72 65 20 64 61 74 61 2d 70 72 6f 63 65 73 73  ure data-process
0370: 69 6e 67 20 70 72 6f 62 6c 65 6d 20 74 68 61 6e  ing problem than
0380: 20 6c 69 6b 65 20 61 20 74 79 70 69 63 61 6c 20   like a typical 
0390: 47 49 53 2f 47 55 49 20 70 72 6f 62 6c 65 6d 2c  GIS/GUI problem,
03a0: 20 73 6f 20 69 74 27 73 20 70 72 6f 62 61 62 6c   so it's probabl
03b0: 79 20 75 73 65 66 75 6c 20 69 6e 74 72 6f 64 75  y useful introdu
03c0: 63 69 6e 67 20 73 6f 6d 65 20 53 70 61 74 69 61  cing some Spatia
03d0: 6c 20 44 42 4d 53 20 69 6e 74 6f 20 74 68 69 73  l DBMS into this
03e0: 20 43 6f 6e 74 65 73 74 2e 0d 0a 54 68 69 73 20   Contest...This 
03f0: 77 61 73 20 6d 79 20 66 69 72 73 74 20 74 68 6f  was my first tho
0400: 75 67 68 74 20 77 68 69 6c 65 20 72 65 61 64 69  ught while readi
0410: 6e 67 20 74 68 65 20 62 65 6e 63 68 6d 61 72 6b  ng the benchmark
0420: 20 72 65 70 6f 72 74 2c 20 73 6f 20 49 20 64 75   report, so I du
0430: 6c 79 20 73 74 61 72 74 65 64 20 70 72 65 70 61  ly started prepa
0440: 72 69 6e 67 20 6d 79 20 6f 77 6e 20 74 65 73 74  ring my own test
0450: 62 65 64 20 62 61 73 65 64 20 6f 6e 20 53 70 61  bed based on Spa
0460: 74 69 61 4c 69 74 65 20 28 3c 69 3e 42 54 57 20  tiaLite (<i>BTW 
0470: 49 27 6d 20 67 6f 69 6e 67 20 74 6f 20 72 65 6c  I'm going to rel
0480: 65 61 73 65 20 74 68 65 20 6e 65 77 20 76 65 72  ease the new ver
0490: 73 69 6f 6e 20 34 2e 30 2e 30 20 69 6e 20 74 68  sion 4.0.0 in th
04a0: 65 20 76 65 72 79 20 6e 65 78 74 20 64 61 79 73  e very next days
04b0: 2c 20 73 6f 20 61 66 74 65 72 20 61 6c 6c 20 70  , so after all p
04c0: 65 72 66 6f 72 6d 69 6e 67 20 73 6f 6d 65 20 66  erforming some f
04d0: 75 72 74 68 65 72 20 74 65 73 74 20 69 73 20 73  urther test is s
04e0: 75 72 65 6c 79 20 77 65 6c 63 6f 6d 65 3c 2f 69  urely welcome</i
04f0: 3e 29 2e 0d 0a 3c 68 32 3e 54 65 73 74 20 63 6f  >)...<h2>Test co
0500: 6e 66 69 67 75 72 61 74 69 6f 6e 3c 2f 68 32 3e  nfiguration</h2>
0510: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 49 6e 74 65  ..<ul>..<li>Inte
0520: 6c 20 43 6f 72 65 20 69 35 20 33 2e 34 36 20 47  l Core i5 3.46 G
0530: 48 7a 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 34 20 47  Hz</li>..<li>4 G
0540: 42 20 52 41 4d 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  B RAM</li>..<li>
0550: 57 69 6e 64 6f 77 73 20 37 20 36 34 20 62 69 74  Windows 7 64 bit
0560: 20 28 70 68 79 73 69 63 61 6c 29 3c 2f 6c 69 3e   (physical)</li>
0570: 0d 0a 3c 6c 69 3e 44 65 62 69 61 6e 20 53 71 75  ..<li>Debian Squ
0580: 65 65 7a 65 20 33 32 20 62 69 74 20 28 76 69 72  eeze 32 bit (vir
0590: 74 75 61 6c 20 6d 61 63 68 69 6e 65 29 3c 2f 6c  tual machine)</l
05a0: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 49  i>..</ul><br>..I
05b0: 20 74 65 73 74 65 64 20 62 6f 74 68 20 57 69 6e   tested both Win
05c0: 64 6f 77 73 20 61 6e 64 20 44 65 62 69 61 6e 20  dows and Debian 
05d0: 6f 6e 20 74 68 65 20 73 61 6d 65 20 68 61 72 64  on the same hard
05e0: 77 61 72 65 2e 0d 0a 54 68 65 20 6d 65 61 73 75  ware...The measu
05f0: 72 65 64 20 74 69 6d 69 6e 67 73 20 61 72 65 20  red timings are 
0600: 72 61 74 68 65 72 20 73 69 6d 69 6c 61 72 3b 20  rather similar; 
0610: 61 6e 79 77 61 79 20 4c 69 6e 75 78 20 70 65 72  anyway Linux per
0620: 66 6f 72 6d 65 64 20 73 6c 69 67 68 74 6c 79 20  formed slightly 
0630: 62 65 74 74 65 72 20 74 68 61 6e 20 74 68 65 20  better than the 
0640: 6e 61 74 69 76 65 20 57 69 6e 64 6f 77 73 20 73  native Windows s
0650: 79 73 74 65 6d 20 28 6d 6f 72 65 20 6f 72 20 6c  ystem (more or l
0660: 65 73 73 2c 20 62 79 20 61 20 31 30 25 20 2d 20  ess, by a 10% - 
0670: 32 30 25 20 66 61 63 74 6f 72 29 2e 0d 0a 54 68  20% factor)...Th
0680: 69 73 20 69 73 20 6e 6f 74 20 61 74 20 61 6c 6c  is is not at all
0690: 20 73 75 72 70 72 69 73 69 6e 67 20 66 6f 72 20   surprising for 
06a0: 6d 65 2c 20 62 65 63 61 75 73 65 20 74 68 69 73  me, because this
06b0: 20 74 72 65 6e 64 20 73 65 65 6d 73 20 74 6f 20   trend seems to 
06c0: 62 65 20 63 6f 6e 73 74 61 6e 74 6c 79 20 76 65  be constantly ve
06d0: 72 69 66 69 65 64 20 65 61 63 68 20 74 69 6d 65  rified each time
06e0: 20 49 20 6d 61 6e 61 67 65 20 73 6f 6d 65 20 63   I manage some c
06f0: 6f 6d 70 61 72 61 74 69 76 65 20 62 65 6e 63 68  omparative bench
0700: 6d 61 72 6b 2e 0d 0a 56 65 72 79 20 6f 66 74 65  mark...Very ofte
0710: 6e 20 4c 69 6e 75 78 20 69 73 20 61 20 62 65 73  n Linux is a bes
0720: 74 20 70 65 72 66 6f 72 6d 65 72 20 74 68 61 6e  t performer than
0730: 20 57 69 6e 64 6f 77 73 2c 20 65 76 65 6e 20 77   Windows, even w
0740: 68 65 6e 20 72 75 6e 6e 69 6e 67 20 61 73 20 61  hen running as a
0750: 20 56 69 72 74 75 61 6c 20 4d 61 63 68 69 6e 65   Virtual Machine
0760: 20 6f 6e 20 74 68 65 20 74 6f 70 20 6f 66 20 61   on the top of a
0770: 20 70 68 79 73 69 63 61 6c 20 57 69 6e 64 6f 77   physical Window
0780: 73 20 73 79 73 74 65 6d 2e 0d 0a 51 75 69 74 65  s system...Quite
0790: 20 70 61 72 61 64 6f 78 69 63 61 6c 2c 20 62 75   paradoxical, bu
07a0: 74 20 69 6e 64 69 73 70 75 74 61 62 6c 79 20 74  t indisputably t
07b0: 72 75 65 20 61 6e 64 20 6f 62 6a 65 63 74 69 76  rue and objectiv
07c0: 65 6c 79 20 76 65 72 69 66 69 65 64 20 6d 61 6e  ely verified man
07d0: 79 20 74 69 6d 65 73 2e 0d 0a 3c 68 32 3e 54 68  y times...<h2>Th
07e0: 65 20 73 61 6d 70 6c 65 20 64 61 74 61 73 65 74  e sample dataset
07f0: 3c 2f 68 32 3e 0d 0a 49 27 76 65 20 73 69 6d 70  </h2>..I've simp
0800: 6c 79 20 64 6f 77 6e 6c 6f 61 64 65 64 20 74 68  ly downloaded th
0810: 65 20 73 61 6d 65 20 69 64 65 6e 74 69 63 61 6c  e same identical
0820: 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f   <a href="http:/
0830: 2f 77 77 77 2e 64 6f 6e 6d 65 6c 74 7a 2e 63 6f  /www.donmeltz.co
0840: 6d 2f 5f 66 69 6c 65 73 2f 43 6f 6e 74 6f 75 72  m/_files/Contour
0850: 43 6c 69 70 54 65 73 74 2e 7a 69 70 22 3e 73 61  ClipTest.zip">sa
0860: 6d 70 6c 65 20 64 61 74 61 73 65 74 3c 2f 61 3e  mple dataset</a>
0870: 20 61 6c 72 65 61 64 79 20 75 73 65 64 20 66 6f   already used fo
0880: 72 20 61 6c 6c 20 6f 74 68 65 72 20 74 65 73 74  r all other test
0890: 73 20 72 65 70 6f 72 74 65 64 20 69 6e 20 74 68  s reported in th
08a0: 65 20 43 6c 69 70 70 69 6e 67 20 43 6f 6e 74 65  e Clipping Conte
08b0: 73 74 2e 3c 62 72 3e 0d 0a 56 65 72 79 20 73 68  st.<br>..Very sh
08c0: 6f 72 74 6c 79 20 73 61 69 64 3a 20 69 74 27 73  ortly said: it's
08d0: 20 61 20 72 65 61 6c 6c 79 20 68 75 67 65 20 73   a really huge s
08e0: 65 74 20 6f 66 20 3c 62 3e 43 6f 6e 74 6f 75 72  et of <b>Contour
08f0: 20 4c 69 6e 65 73 3c 2f 62 3e 20 28 74 68 65 20   Lines</b> (the 
0900: 75 6e 63 6f 6d 70 72 65 73 73 65 64 20 53 68 61  uncompressed Sha
0910: 70 65 66 69 6c 65 20 69 73 20 61 62 6f 75 74 20  pefile is about 
0920: 3c 62 3e 31 2c 33 20 47 42 3c 2f 62 3e 29 3c 62  <b>1,3 GB</b>)<b
0930: 72 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 63  r><br>..<table c
0940: 65 6c 6c 73 70 61 63 69 6e 67 3d 22 36 22 20 63  ellspacing="6" c
0950: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 36 22 3e 0d  ellpadding="6">.
0960: 0a 3c 74 72 3e 3c 74 64 3e 3c 68 33 3e 46 69 67  .<tr><td><h3>Fig
0970: 2e 20 31 3c 2f 68 33 3e 0d 0a 54 68 69 73 20 6f  . 1</h3>..This o
0980: 6e 65 20 69 73 20 74 68 65 20 6f 72 69 67 69 6e  ne is the origin
0990: 61 6c 20 73 65 74 20 6f 66 20 43 6f 6e 74 6f 75  al set of Contou
09a0: 72 20 4c 69 6e 65 73 20 74 6f 20 62 65 20 63 6c  r Lines to be cl
09b0: 69 70 70 65 64 2e 3c 2f 74 64 3e 0d 0a 3c 74 64  ipped.</td>..<td
09c0: 3e 3c 69 6d 67 20 62 6f 72 64 65 72 3d 22 31 22  ><img border="1"
09d0: 20 73 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77   src="http://www
09e0: 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69  .gaia-gis.it/gai
09f0: 61 2d 73 69 6e 73 2f 76 69 72 74 75 61 6c 6f 67  a-sins/virtualog
0a00: 72 2f 63 6c 69 70 2d 30 2e 70 6e 67 22 20 61 6c  r/clip-0.png" al
0a10: 74 3d 22 6f 72 69 67 69 6e 61 6c 20 64 61 74 61  t="original data
0a20: 73 65 74 22 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d  set"></td></tr>.
0a30: 0a 3c 74 72 3e 3c 74 64 3e 3c 68 33 3e 46 69 67  .<tr><td><h3>Fig
0a40: 2e 20 32 3c 2f 68 33 3e 0d 0a 54 68 69 73 20 69  . 2</h3>..This i
0a50: 73 20 74 68 65 20 66 69 6e 61 6c 20 72 65 73 75  s the final resu
0a60: 6c 74 20 6f 66 20 74 68 65 20 63 6c 69 70 70 69  lt of the clippi
0a70: 6e 67 20 6f 70 65 72 61 74 69 6f 6e 2e 3c 75 6c  ng operation.<ul
0a80: 3e 0d 0a 3c 6c 69 3e 74 68 65 20 53 74 75 64 79  >..<li>the Study
0a90: 20 41 72 65 61 20 62 6f 75 6e 64 61 72 79 20 28   Area boundary (
0aa0: 70 6f 6c 79 67 6f 6e 29 20 69 73 20 72 65 70 72  polygon) is repr
0ab0: 65 73 65 6e 74 65 64 20 69 6e 20 72 65 64 2e 3c  esented in red.<
0ac0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 43 6f  /li>..<li>the Co
0ad0: 6e 74 6f 75 72 20 4c 69 6e 65 73 20 61 72 65 20  ntour Lines are 
0ae0: 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 64  represented in d
0af0: 61 72 6b 20 62 6c 75 65 2e 3c 2f 6c 69 3e 0d 0a  ark blue.</li>..
0b00: 3c 6c 69 3e 74 68 65 20 61 7a 75 72 65 20 72 65  <li>the azure re
0b10: 63 74 61 6e 67 6c 65 20 6d 61 72 6b 73 20 74 68  ctangle marks th
0b20: 65 20 64 65 74 61 69 6c 20 61 72 65 61 20 73 68  e detail area sh
0b30: 6f 77 6e 20 69 6e 20 74 68 65 20 6e 65 78 74 20  own in the next 
0b40: 66 69 67 75 72 65 2e 3c 2f 6c 69 3e 20 0d 0a 3c  figure.</li> ..<
0b50: 2f 75 6c 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 3e 3c  /ul></td>..<td><
0b60: 69 6d 67 20 62 6f 72 64 65 72 3d 22 31 22 20 73  img border="1" s
0b70: 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 67  rc="http://www.g
0b80: 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d  aia-gis.it/gaia-
0b90: 73 69 6e 73 2f 76 69 72 74 75 61 6c 6f 67 72 2f  sins/virtualogr/
0ba0: 63 6c 69 70 2d 31 2e 70 6e 67 22 20 61 6c 74 3d  clip-1.png" alt=
0bb0: 22 63 6c 69 70 70 65 64 22 3e 3c 2f 74 64 3e 3c  "clipped"></td><
0bc0: 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 3c 68  /tr>..<tr><td><h
0bd0: 33 3e 46 69 67 2e 20 33 3c 2f 68 33 3e 54 68 69  3>Fig. 3</h3>Thi
0be0: 73 20 69 73 20 61 20 6d 61 67 6e 69 66 69 65 64  s is a magnified
0bf0: 20 64 65 74 61 69 6c 20 6f 66 20 74 68 65 20 53   detail of the S
0c00: 74 75 64 79 20 41 72 65 61 20 61 6e 64 20 43 6c  tudy Area and Cl
0c10: 69 70 70 65 64 20 43 6f 6e 74 6f 75 72 20 4c 69  ipped Contour Li
0c20: 6e 65 73 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 41 73  nes.<br><br>..As
0c30: 20 79 6f 75 20 63 61 6e 20 65 61 73 69 6c 79 20   you can easily 
0c40: 6e 6f 74 69 63 65 20 74 68 65 72 65 20 61 72 65  notice there are
0c50: 20 6c 6f 74 73 20 6f 66 20 43 6f 6e 74 6f 75 72   lots of Contour
0c60: 20 4c 69 6e 65 73 2c 20 61 6e 64 20 65 61 63 68   Lines, and each
0c70: 20 4c 69 6e 65 20 68 61 73 20 6d 61 6e 79 20 76   Line has many v
0c80: 65 72 74 65 78 65 73 2e 3c 62 72 3e 3c 62 72 3e  ertexes.<br><br>
0c90: 0d 0a 54 68 69 73 20 6f 6e 65 20 69 73 20 61 20  ..This one is a 
0ca0: 72 61 74 68 65 72 20 63 6f 6d 70 6c 65 78 20 70  rather complex p
0cb0: 72 6f 62 6c 65 6d 20 74 6f 20 62 65 20 72 65 73  roblem to be res
0cc0: 6f 6c 76 65 64 3a 20 61 6e 64 20 69 74 20 73 75  olved: and it su
0cd0: 72 65 6c 79 20 72 65 70 72 65 73 65 6e 74 73 20  rely represents 
0ce0: 61 20 74 68 6f 72 6f 75 67 68 20 61 6e 64 20 76  a thorough and v
0cf0: 65 72 79 20 64 65 6d 61 6e 64 69 6e 67 20 74 65  ery demanding te
0d00: 73 74 2e 3c 2f 74 64 3e 0d 0a 3c 74 64 3e 3c 69  st.</td>..<td><i
0d10: 6d 67 20 62 6f 72 64 65 72 3d 22 31 22 20 73 72  mg border="1" sr
0d20: 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 67 61  c="http://www.ga
0d30: 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d 73  ia-gis.it/gaia-s
0d40: 69 6e 73 2f 76 69 72 74 75 61 6c 6f 67 72 2f 63  ins/virtualogr/c
0d50: 6c 69 70 2d 32 2e 70 6e 67 22 20 61 6c 74 3d 22  lip-2.png" alt="
0d60: 6c 6f 61 64 5f 65 78 74 65 6e 73 69 6f 6e 22 3e  load_extension">
0d70: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61  </td></tr>..</ta
0d80: 62 6c 65 3e 0d 0a 3c 68 32 3e 54 68 65 20 53 70  ble>..<h2>The Sp
0d90: 61 74 69 61 6c 20 53 51 4c 20 61 70 70 72 6f 61  atial SQL approa
0da0: 63 68 3c 2f 68 32 3e 0d 0a 54 68 69 73 20 69 73  ch</h2>..This is
0db0: 20 61 20 70 75 72 65 20 64 61 74 61 2d 70 72 6f   a pure data-pro
0dc0: 63 65 73 73 69 6e 67 20 61 70 70 72 6f 61 63 68  cessing approach
0dd0: 3b 20 77 65 27 6c 6c 20 75 73 65 20 74 68 65 20  ; we'll use the 
0de0: 6d 6f 73 74 20 63 6c 61 73 73 69 63 61 6c 20 3c  most classical <
0df0: 62 3e 3c 69 3e 53 70 61 74 69 61 6c 20 49 73 20  b><i>Spatial Is 
0e00: 4e 6f 74 20 53 70 65 63 69 61 6c 3c 2f 69 3e 3c  Not Special</i><
0e10: 2f 62 3e 20 6d 65 74 68 6f 64 6f 6c 6f 67 79 2c  /b> methodology,
0e20: 20 69 2e 65 2e 20 77 65 27 6c 6c 20 67 6f 20 70   i.e. we'll go p
0e30: 65 72 66 6f 72 6d 69 6e 67 20 74 68 65 20 3c 62  erforming the <b
0e40: 3e 43 6c 69 70 70 69 6e 67 20 43 6f 6e 74 65 73  >Clipping Contes
0e50: 74 3c 2f 62 3e 20 65 78 61 63 74 6c 79 20 61 73  t</b> exactly as
0e60: 20 69 66 20 69 74 20 77 61 73 20 61 20 74 72 69   if it was a tri
0e70: 76 69 61 6c 20 6f 72 64 69 6e 61 72 79 20 53 51  vial ordinary SQ
0e80: 4c 20 71 75 65 72 79 20 70 65 72 66 6f 72 6d 65  L query performe
0e90: 64 20 6f 6e 20 62 65 68 61 6c 66 20 6f 66 20 70  d on behalf of p
0ea0: 6c 61 69 6e 20 67 65 6e 65 72 69 63 20 64 61 74  lain generic dat
0eb0: 61 2e 0d 0a 57 65 27 6c 6c 20 6e 6f 74 20 75 73  a...We'll not us
0ec0: 65 20 61 74 20 61 6c 6c 20 61 6e 79 20 47 49 53  e at all any GIS
0ed0: 2d 73 70 65 63 69 66 69 63 20 66 72 69 6c 6c 2c  -specific frill,
0ee0: 20 61 6e 64 20 77 65 27 6c 6c 20 73 69 6d 70 6c   and we'll simpl
0ef0: 79 20 75 73 65 20 61 20 63 6f 75 70 6c 65 20 6f  y use a couple o
0f00: 66 20 53 70 61 74 69 61 6c 20 53 51 4c 20 66 75  f Spatial SQL fu
0f10: 6e 63 74 69 6f 6e 73 20 77 68 65 72 65 20 73 74  nctions where st
0f20: 72 69 63 74 6c 79 20 72 65 71 75 69 72 65 64 2e  rictly required.
0f30: 0d 0a 28 3c 69 3e 42 54 57 20 69 74 27 73 20 61  ..(<i>BTW it's a
0f40: 20 67 6f 6f 64 20 6f 70 70 6f 72 74 75 6e 69 74   good opportunit
0f50: 79 20 74 6f 20 69 6e 74 72 6f 64 75 63 65 20 66  y to introduce f
0f60: 65 77 20 62 61 73 69 63 20 63 6f 6e 63 65 70 74  ew basic concept
0f70: 73 20 61 62 6f 75 74 20 53 70 61 74 69 61 6c 20  s about Spatial 
0f80: 53 51 4c 3c 2f 69 3e 29 2e 3c 62 72 3e 0d 0a 4c  SQL</i>).<br>..L
0f90: 65 74 27 73 20 67 6f 20 2e 2e 2e 0d 0a 3c 68 34  et's go .....<h4
0fa0: 3e 50 72 65 70 61 72 69 6e 67 20 74 68 65 20 53  >Preparing the S
0fb0: 51 4c 20 73 63 72 69 70 74 3c 2f 68 34 3e 0d 0a  QL script</h4>..
0fc0: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 2d 2d 0d 0a  <verbatim>..--..
0fd0: 2d 2d 20 53 51 4c 20 73 63 72 69 70 74 20 70 65  -- SQL script pe
0fe0: 72 66 6f 72 6d 69 6e 67 20 74 68 65 20 43 6c 69  rforming the Cli
0ff0: 70 70 69 6e 67 20 43 6f 6e 74 65 73 74 0d 0a 2d  pping Contest..-
1000: 2d 20 54 61 72 67 65 74 20 44 42 4d 53 3a 20 53  - Target DBMS: S
1010: 51 4c 69 74 65 20 77 69 74 68 20 53 70 61 74 69  QLite with Spati
1020: 61 4c 69 74 65 20 65 78 74 65 6e 73 69 6f 6e 0d  aLite extension.
1030: 0a 2d 2d 0d 0a 0d 0a 53 45 4c 45 43 54 20 44 61  .--....SELECT Da
1040: 74 65 54 69 6d 65 28 27 6e 6f 77 27 29 2c 20 27  teTime('now'), '
1050: 4c 6f 61 64 69 6e 67 20 74 68 65 20 53 74 75 64  Loading the Stud
1060: 79 41 72 65 61 20 53 48 50 27 3b 0d 0a 2d 2d 0d  yArea SHP';..--.
1070: 0a 2d 2d 20 6c 6f 61 64 69 6e 67 20 74 68 65 20  .-- loading the 
1080: 53 74 75 64 79 41 72 65 61 20 53 68 61 70 65 66  StudyArea Shapef
1090: 69 6c 65 20 69 6e 74 6f 20 74 68 65 20 44 42 0d  ile into the DB.
10a0: 0a 2d 2d 0d 0a 2e 6c 6f 61 64 73 68 70 20 53 74  .--...loadshp St
10b0: 75 64 79 41 72 65 61 31 4d 69 6c 65 42 75 66 66  udyArea1MileBuff
10c0: 65 72 20 53 74 75 64 79 41 72 65 61 31 4d 69 6c  er StudyArea1Mil
10d0: 65 42 75 66 66 65 72 20 43 50 31 32 35 32 20 32  eBuffer CP1252 2
10e0: 32 36 30 20 47 65 6f 6d 65 74 72 79 20 49 64 20  260 Geometry Id 
10f0: 50 4f 4c 59 47 4f 4e 20 32 64 20 6e 6f 20 6e 6f  POLYGON 2d no no
1100: 5f 73 70 61 74 69 61 6c 5f 69 6e 64 65 78 0d 0a  _spatial_index..
1110: 0d 0a 53 45 4c 45 43 54 20 44 61 74 65 54 69 6d  ..SELECT DateTim
1120: 65 28 27 6e 6f 77 27 29 2c 20 27 4c 6f 61 64 69  e('now'), 'Loadi
1130: 6e 67 20 74 68 65 20 43 6f 6e 74 6f 75 72 73 20  ng the Contours 
1140: 53 48 50 27 3b 0d 0a 2d 2d 0d 0a 2d 2d 20 6c 6f  SHP';..--..-- lo
1150: 61 64 69 6e 67 20 74 68 65 20 43 6f 6e 74 6f 75  ading the Contou
1160: 72 20 53 68 61 70 65 66 69 6c 65 20 69 6e 74 6f  r Shapefile into
1170: 20 74 68 65 20 44 42 0d 0a 2d 2d 0d 0a 2e 6c 6f   the DB..--...lo
1180: 61 64 73 68 70 20 43 6f 6e 74 6f 75 72 73 32 30  adshp Contours20
1190: 46 74 20 43 6f 6e 74 6f 75 72 73 32 30 46 74 20  Ft Contours20Ft 
11a0: 43 50 31 32 35 32 20 32 32 36 30 20 47 65 6f 6d  CP1252 2260 Geom
11b0: 65 74 72 79 20 49 64 20 4c 49 4e 45 53 54 52 49  etry Id LINESTRI
11c0: 4e 47 20 32 64 20 6e 6f 20 77 69 74 68 5f 73 70  NG 2d no with_sp
11d0: 61 74 69 61 6c 5f 69 6e 64 65 78 0d 0a 0d 0a 53  atial_index....S
11e0: 45 4c 45 43 54 20 44 61 74 65 54 69 6d 65 28 27  ELECT DateTime('
11f0: 6e 6f 77 27 29 2c 20 27 43 6c 69 70 70 69 6e 67  now'), 'Clipping
1200: 20 2e 2e 2e 20 70 6c 65 61 73 65 20 77 61 69 74   ... please wait
1210: 27 3b 0d 0a 2d 2d 0d 0a 2d 2d 20 63 72 65 61 74  ';..--..-- creat
1220: 69 6e 67 20 61 20 6e 65 77 20 74 61 62 6c 65 20  ing a new table 
1230: 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 43  containing the C
1240: 6c 69 70 70 65 64 20 43 6f 6e 74 6f 75 72 73 0d  lipped Contours.
1250: 0a 2d 2d 0d 0a 43 52 45 41 54 45 20 54 41 42 4c  .--..CREATE TABL
1260: 45 20 43 6f 6e 74 6f 75 72 73 32 30 46 74 43 6c  E Contours20FtCl
1270: 69 70 70 65 64 20 41 53 0d 0a 53 45 4c 45 43 54  ipped AS..SELECT
1280: 20 63 2e 49 64 20 41 53 20 49 64 2c 20 63 2e 4f   c.Id AS Id, c.O
1290: 42 4a 45 43 54 49 44 20 41 53 20 4f 42 4a 45 43  BJECTID AS OBJEC
12a0: 54 49 44 2c 20 0d 0a 20 20 63 2e 43 6f 6e 74 6f  TID, ..  c.Conto
12b0: 75 72 20 41 53 20 43 6f 6e 74 6f 75 72 2c 20 63  ur AS Contour, c
12c0: 2e 53 68 61 70 65 5f 4c 65 6e 67 20 41 53 20 53  .Shape_Leng AS S
12d0: 68 61 70 65 5f 4c 65 6e 67 2c 0d 0a 20 20 43 61  hape_Leng,..  Ca
12e0: 73 74 54 6f 4d 75 6c 74 69 4c 69 6e 65 73 74 72  stToMultiLinestr
12f0: 69 6e 67 28 53 54 5f 49 6e 74 65 72 73 65 63 74  ing(ST_Intersect
1300: 69 6f 6e 28 0d 0a 20 20 20 20 20 20 63 2e 47 65  ion(..      c.Ge
1310: 6f 6d 65 74 72 79 2c 20 61 2e 47 65 6f 6d 65 74  ometry, a.Geomet
1320: 72 79 29 29 20 41 53 20 47 65 6f 6d 65 74 72 79  ry)) AS Geometry
1330: 0d 0a 46 52 4f 4d 20 43 6f 6e 74 6f 75 72 73 32  ..FROM Contours2
1340: 30 46 74 20 41 53 20 63 2c 20 53 74 75 64 79 41  0Ft AS c, StudyA
1350: 72 65 61 31 4d 69 6c 65 42 75 66 66 65 72 20 41  rea1MileBuffer A
1360: 53 20 61 0d 0a 57 48 45 52 45 20 63 2e 52 4f 57  S a..WHERE c.ROW
1370: 49 44 20 49 4e 20 28 0d 0a 20 20 20 20 53 45 4c  ID IN (..    SEL
1380: 45 43 54 20 52 4f 57 49 44 20 0d 0a 20 20 20 20  ECT ROWID ..    
1390: 46 52 4f 4d 20 53 70 61 74 69 61 6c 49 6e 64 65  FROM SpatialInde
13a0: 78 0d 0a 20 20 20 20 57 48 45 52 45 20 66 5f 74  x..    WHERE f_t
13b0: 61 62 6c 65 5f 6e 61 6d 65 20 3d 20 27 43 6f 6e  able_name = 'Con
13c0: 74 6f 75 72 73 32 30 46 74 27 20 0d 0a 20 20 20  tours20Ft' ..   
13d0: 20 20 20 20 20 41 4e 44 20 73 65 61 72 63 68 5f       AND search_
13e0: 66 72 61 6d 65 20 3d 20 61 2e 47 65 6f 6d 65 74  frame = a.Geomet
13f0: 72 79 0d 0a 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54  ry..);....SELECT
1400: 20 44 61 74 65 54 69 6d 65 28 27 6e 6f 77 27 29   DateTime('now')
1410: 2c 20 27 64 65 6c 65 74 69 6e 67 20 4e 55 4c 4c  , 'deleting NULL
1420: 20 47 65 6f 6d 65 74 72 69 65 73 27 3b 0d 0a 2d   Geometries';..-
1430: 2d 0d 0a 2d 2d 20 63 6c 65 61 6e 20 75 70 0d 0a  -..-- clean up..
1440: 2d 2d 20 64 65 6c 65 74 69 6e 67 20 61 6e 79 20  -- deleting any 
1450: 4e 55 4c 4c 20 47 65 6f 6d 65 74 72 79 20 66 72  NULL Geometry fr
1460: 6f 6d 20 43 6c 69 70 70 65 64 20 43 6f 6e 74 6f  om Clipped Conto
1470: 75 72 73 0d 0a 2d 2d 0d 0a 44 45 4c 45 54 45 20  urs..--..DELETE 
1480: 46 52 4f 4d 20 43 6f 6e 74 6f 75 72 73 32 30 46  FROM Contours20F
1490: 74 43 6c 69 70 70 65 64 20 0d 0a 57 48 45 52 45  tClipped ..WHERE
14a0: 20 47 65 6f 6d 65 74 72 79 20 49 53 20 4e 55 4c   Geometry IS NUL
14b0: 4c 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 44 61 74  L;....SELECT Dat
14c0: 65 54 69 6d 65 28 27 6e 6f 77 27 29 2c 20 27 72  eTime('now'), 'r
14d0: 65 63 6f 76 65 72 69 6e 67 20 61 20 67 65 6e 75  ecovering a genu
14e0: 69 6e 65 20 47 65 6f 6d 65 74 72 79 20 63 6f 6c  ine Geometry col
14f0: 75 6d 6e 27 3b 0d 0a 2d 2d 0d 0a 2d 2d 20 72 65  umn';..--..-- re
1500: 63 6f 76 65 72 69 6e 67 20 61 20 67 65 6e 75 69  covering a genui
1510: 6e 65 20 47 65 6f 6d 65 74 72 79 20 43 6f 6c 75  ne Geometry Colu
1520: 6d 6e 20 28 43 6c 69 70 70 65 64 20 43 6f 6e 74  mn (Clipped Cont
1530: 6f 75 72 73 29 0d 0a 2d 2d 2d 0d 0a 53 45 4c 45  ours)..---..SELE
1540: 43 54 20 52 65 63 6f 76 65 72 47 65 6f 6d 65 74  CT RecoverGeomet
1550: 72 79 43 6f 6c 75 6d 6e 28 27 43 6f 6e 74 6f 75  ryColumn('Contou
1560: 72 73 32 30 46 74 43 6c 69 70 70 65 64 27 2c 20  rs20FtClipped', 
1570: 27 47 65 6f 6d 65 74 72 79 27 2c 20 32 32 36 30  'Geometry', 2260
1580: 2c 20 27 4d 55 4c 54 49 4c 49 4e 45 53 54 52 49  , 'MULTILINESTRI
1590: 4e 47 27 2c 20 32 29 3b 0d 0a 0d 0a 53 45 4c 45  NG', 2);....SELE
15a0: 43 54 20 44 61 74 65 54 69 6d 65 28 27 6e 6f 77  CT DateTime('now
15b0: 27 29 2c 20 27 63 72 65 61 74 69 6e 67 20 74 68  '), 'creating th
15c0: 65 20 53 70 61 74 69 61 6c 20 49 6e 64 65 78 27  e Spatial Index'
15d0: 3b 0d 0a 2d 2d 0d 0a 2d 2d 20 63 72 65 61 74 69  ;..--..-- creati
15e0: 6e 67 20 61 20 53 70 61 74 69 61 6c 20 28 49 6e  ng a Spatial (In
15f0: 64 65 78 20 73 75 70 70 6f 72 74 69 6e 67 20 43  dex supporting C
1600: 6c 69 70 70 65 64 20 43 6f 6e 74 6f 75 72 73 29  lipped Contours)
1610: 0d 0a 2d 2d 0d 0a 53 45 4c 45 43 54 20 43 72 65  ..--..SELECT Cre
1620: 61 74 65 53 70 61 74 69 61 6c 49 6e 64 65 78 28  ateSpatialIndex(
1630: 27 43 6f 6e 74 6f 75 72 73 32 30 46 74 43 6c 69  'Contours20FtCli
1640: 70 70 65 64 27 2c 20 27 47 65 6f 6d 65 74 72 79  pped', 'Geometry
1650: 27 29 3b 0d 0a 0d 0a 0d 0a 53 45 4c 45 43 54 20  ');......SELECT 
1660: 44 61 74 65 54 69 6d 65 28 27 6e 6f 77 27 29 2c  DateTime('now'),
1670: 20 27 61 6c 6c 20 64 6f 6e 65 20 2e 2e 2e 20 71   'all done ... q
1680: 75 69 74 74 69 6e 67 27 3b 0d 0a 2d 2d 0d 0a 2d  uitting';..--..-
1690: 2d 20 65 6e 64 20 6a 6f 62 0d 0a 2d 2d 0d 0a 3c  - end job..--..<
16a0: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 44 6f 6e 27  /verbatim>..Don'
16b0: 74 20 62 65 20 66 6f 75 6c 65 64 3b 20 63 6f 6d  t be fouled; com
16c0: 70 6c 65 78 69 74 79 20 69 73 20 6d 6f 72 65 20  plexity is more 
16d0: 61 70 70 61 72 65 6e 74 20 74 68 61 6e 20 72 65  apparent than re
16e0: 61 6c 2e 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e  al. The followin
16f0: 67 20 69 73 20 61 20 71 75 69 63 6b 20 65 78 70  g is a quick exp
1700: 6c 61 6e 61 74 69 6f 6e 20 6f 66 20 74 68 65 20  lanation of the 
1710: 73 74 65 70 20 62 79 20 73 74 65 70 20 70 72 6f  step by step pro
1720: 63 65 73 73 20 64 65 66 69 6e 65 64 20 62 79 20  cess defined by 
1730: 74 68 65 20 61 62 6f 76 65 20 53 51 4c 20 73 63  the above SQL sc
1740: 72 69 70 74 2e 0d 0a 3c 74 61 62 6c 65 20 63 65  ript...<table ce
1750: 6c 6c 73 70 61 63 69 6e 67 3d 22 36 22 20 63 65  llspacing="6" ce
1760: 6c 6c 70 61 64 64 69 6e 67 3d 22 36 22 3e 0d 0a  llpadding="6">..
1770: 3c 74 72 3e 3c 74 64 20 62 67 63 6f 6c 6f 72 3d  <tr><td bgcolor=
1780: 22 23 66 34 66 34 66 34 22 3e 3c 62 3e 2e 6c 6f  "#f4f4f4"><b>.lo
1790: 61 64 73 68 70 3c 2f 62 3e 20 3c 69 3e 70 61 72  adshp</b> <i>par
17a0: 61 6d 65 74 65 72 73 3c 2f 69 3e 3c 2f 74 64 3e  ameters</i></td>
17b0: 0d 0a 3c 74 64 3e 3c 68 33 3e 53 74 65 70 20 23  ..<td><h3>Step #
17c0: 31 3c 2f 68 33 3e 0d 0a 73 69 6d 70 6c 79 20 61  1</h3>..simply a
17d0: 20 3c 62 3e 64 6f 74 20 6d 61 63 72 6f 20 63 6f   <b>dot macro co
17e0: 6d 6d 61 6e 64 3c 2f 62 3e 20 75 6e 64 65 72 73  mmand</b> unders
17f0: 74 6f 6f 64 20 62 79 20 74 68 65 20 53 70 61 74  tood by the Spat
1800: 69 61 4c 69 74 65 20 66 72 6f 6e 74 2d 65 6e 64  iaLite front-end
1810: 20 74 6f 6f 6c 2c 20 61 6c 6c 6f 77 69 6e 67 20   tool, allowing 
1820: 74 6f 20 64 69 72 65 63 74 6c 79 20 69 6d 70 6f  to directly impo
1830: 72 74 20 61 6e 20 65 78 74 65 72 6e 61 6c 20 53  rt an external S
1840: 68 61 70 65 66 69 6c 65 20 69 6e 74 6f 20 61 20  hapefile into a 
1850: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 53 70  corresponding Sp
1860: 61 74 69 61 6c 20 54 61 62 6c 65 20 77 69 74 68  atial Table with
1870: 69 6e 20 74 68 65 20 44 42 2e 3c 2f 74 64 3e 3c  in the DB.</td><
1880: 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 3c 76  /tr>..<tr><td><v
1890: 65 72 62 61 74 69 6d 3e 0d 0a 43 52 45 41 54 45  erbatim>..CREATE
18a0: 20 54 41 42 4c 45 20 43 6f 6e 74 6f 75 72 73 32   TABLE Contours2
18b0: 30 46 74 43 6c 69 70 70 65 64 20 41 53 0d 0a 53  0FtClipped AS..S
18c0: 45 4c 45 43 54 20 63 2e 49 64 20 41 53 20 49 64  ELECT c.Id AS Id
18d0: 2c 20 63 2e 4f 42 4a 45 43 54 49 44 20 41 53 20  , c.OBJECTID AS 
18e0: 4f 42 4a 45 43 54 49 44 2c 20 0d 0a 20 20 63 2e  OBJECTID, ..  c.
18f0: 43 6f 6e 74 6f 75 72 20 41 53 20 43 6f 6e 74 6f  Contour AS Conto
1900: 75 72 2c 20 63 2e 53 68 61 70 65 5f 4c 65 6e 67  ur, c.Shape_Leng
1910: 20 41 53 20 53 68 61 70 65 5f 4c 65 6e 67 2c 0d   AS Shape_Leng,.
1920: 0a 20 20 43 61 73 74 54 6f 4d 75 6c 74 69 4c 69  .  CastToMultiLi
1930: 6e 65 73 74 72 69 6e 67 28 53 54 5f 49 6e 74 65  nestring(ST_Inte
1940: 72 73 65 63 74 69 6f 6e 28 0d 0a 20 20 20 20 20  rsection(..     
1950: 20 63 2e 47 65 6f 6d 65 74 72 79 2c 20 61 2e 47   c.Geometry, a.G
1960: 65 6f 6d 65 74 72 79 29 29 20 41 53 20 47 65 6f  eometry)) AS Geo
1970: 6d 65 74 72 79 0d 0a 46 52 4f 4d 20 43 6f 6e 74  metry..FROM Cont
1980: 6f 75 72 73 32 30 46 74 20 41 53 20 63 2c 20 53  ours20Ft AS c, S
1990: 74 75 64 79 41 72 65 61 31 4d 69 6c 65 42 75 66  tudyArea1MileBuf
19a0: 66 65 72 20 41 53 20 61 0d 0a 57 48 45 52 45 20  fer AS a..WHERE 
19b0: 63 2e 52 4f 57 49 44 20 49 4e 20 28 0d 0a 20 20  c.ROWID IN (..  
19c0: 20 20 53 45 4c 45 43 54 20 52 4f 57 49 44 20 0d    SELECT ROWID .
19d0: 0a 20 20 20 20 46 52 4f 4d 20 53 70 61 74 69 61  .    FROM Spatia
19e0: 6c 49 6e 64 65 78 0d 0a 20 20 20 20 57 48 45 52  lIndex..    WHER
19f0: 45 20 66 5f 74 61 62 6c 65 5f 6e 61 6d 65 20 3d  E f_table_name =
1a00: 20 27 43 6f 6e 74 6f 75 72 73 32 30 46 74 27 20   'Contours20Ft' 
1a10: 0d 0a 20 20 20 20 20 20 20 20 41 4e 44 20 73 65  ..        AND se
1a20: 61 72 63 68 5f 66 72 61 6d 65 20 3d 20 61 2e 47  arch_frame = a.G
1a30: 65 6f 6d 65 74 72 79 0d 0a 29 3b 0d 0a 3c 2f 76  eometry..);..</v
1a40: 65 72 62 61 74 69 6d 3e 3c 2f 74 64 3e 0d 0a 3c  erbatim></td>..<
1a50: 74 64 3e 3c 68 33 3e 53 74 65 70 20 23 32 3c 2f  td><h3>Step #2</
1a60: 68 33 3e 0d 0a 74 68 69 73 20 73 69 6e 67 6c 65  h3>..this single
1a70: 20 53 51 4c 20 71 75 65 72 79 20 70 65 72 66 6f   SQL query perfo
1a80: 72 6d 73 20 61 6c 6c 20 74 68 65 20 61 63 74 75  rms all the actu
1a90: 61 6c 20 43 6c 69 70 70 69 6e 67 20 74 61 73 6b  al Clipping task
1aa0: 2e 3c 62 72 3e 0d 0a 3c 62 3e 53 54 5f 49 6e 74  .<br>..<b>ST_Int
1ab0: 65 72 73 65 63 74 69 6f 6e 28 29 3c 2f 62 3e 20  ersection()</b> 
1ac0: 69 73 20 61 20 53 70 61 74 69 61 6c 20 53 51 4c  is a Spatial SQL
1ad0: 20 66 75 6e 63 74 69 6f 6e 20 63 6f 6d 70 75 74   function comput
1ae0: 69 6e 67 20 74 68 65 20 69 6e 74 65 72 73 65 63  ing the intersec
1af0: 74 69 6f 6e 20 62 65 74 77 65 65 6e 20 74 68 65  tion between the
1b00: 20 3c 62 3e 53 74 75 64 79 20 41 72 65 61 3c 2f   <b>Study Area</
1b10: 62 3e 20 28 3c 69 3e 70 6f 6c 79 67 6f 6e 3c 2f  b> (<i>polygon</
1b20: 69 3e 29 20 61 6e 64 20 65 61 63 68 20 3c 62 3e  i>) and each <b>
1b30: 43 6f 6e 74 6f 75 72 20 4c 69 6e 65 3c 2f 62 3e  Contour Line</b>
1b40: 20 28 3c 69 3e 6c 69 6e 65 73 74 72 69 6e 67 3c   (<i>linestring<
1b50: 2f 69 3e 29 2e 20 54 68 65 20 72 65 74 75 72 6e  /i>). The return
1b60: 65 64 20 72 65 73 75 6c 74 20 63 6f 75 6c 64 20  ed result could 
1b70: 62 65 3a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61 20 4c  be:<ul>..<li>a L
1b80: 69 6e 65 73 74 72 69 6e 67 20 6f 72 20 61 20 4d  inestring or a M
1b90: 75 6c 74 69 4c 69 6e 65 73 74 72 69 6e 67 20 28  ultiLinestring (
1ba0: 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 74 68 65  depending on the
1bb0: 20 73 70 65 63 69 66 69 63 20 73 68 61 70 65 20   specific shape 
1bc0: 6f 66 20 62 6f 74 68 20 67 65 6f 6d 65 74 72 69  of both geometri
1bd0: 65 73 29 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20  es)</li>..<li>a 
1be0: 4e 55 4c 4c 20 28 69 2e 65 2e 20 3c 2f 69 3e 61  NULL (i.e. </i>a
1bf0: 62 73 6f 6c 75 74 65 6c 79 20 6e 6f 74 68 69 6e  bsolutely nothin
1c00: 67 3c 2f 69 3e 29 20 69 66 20 74 68 65 20 43 6f  g</i>) if the Co
1c10: 6e 74 6f 75 72 20 4c 69 6e 65 20 61 6e 64 20 74  ntour Line and t
1c20: 68 65 20 53 74 75 64 79 20 41 72 65 61 20 64 6f  he Study Area do
1c30: 20 6e 6f 74 20 69 6e 74 65 72 73 65 63 74 20 61   not intersect a
1c40: 74 20 61 6c 6c 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  t all.</li>..<li
1c50: 3e 3c 62 3e 43 61 73 74 54 6f 4d 75 6c 74 69 4c  ><b>CastToMultiL
1c60: 69 6e 65 73 74 72 69 6e 67 28 29 3c 2f 62 3e 20  inestring()</b> 
1c70: 73 69 6d 70 6c 79 20 69 73 20 61 20 3c 75 3e 3c  simply is a <u><
1c80: 69 3e 63 61 73 74 20 6f 70 65 72 61 74 6f 72 3c  i>cast operator<
1c90: 2f 69 3e 3c 2f 75 3e 20 65 6e 73 75 72 69 6e 67  /i></u> ensuring
1ca0: 20 74 68 61 74 20 61 6c 6c 20 72 65 74 75 72 6e   that all return
1cb0: 65 64 20 67 65 6f 6d 65 74 72 69 65 73 20 77 69  ed geometries wi
1cc0: 6c 6c 20 62 65 20 6f 66 20 74 68 65 20 73 61 6d  ll be of the sam
1cd0: 65 20 74 79 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  e type.</li>..<l
1ce0: 69 3e 74 68 65 20 69 6e 6e 65 72 20 73 75 62 2d  i>the inner sub-
1cf0: 71 75 65 72 79 20 3c 62 3e 53 45 4c 45 43 54 20  query <b>SELECT 
1d00: 52 4f 57 49 44 20 46 52 4f 4d 20 53 70 61 74 69  ROWID FROM Spati
1d10: 61 6c 49 6e 64 65 78 20 2e 2e 2e 3c 2f 62 3e 20  alIndex ...</b> 
1d20: 69 73 20 73 69 6d 70 6c 79 20 69 6e 74 65 6e 64  is simply intend
1d30: 65 64 20 74 6f 20 61 63 63 65 73 73 20 74 68 65  ed to access the
1d40: 20 53 70 61 74 69 61 6c 20 49 6e 64 65 78 20 73   Spatial Index s
1d50: 75 70 70 6f 72 74 69 6e 67 20 74 68 65 20 43 6f  upporting the Co
1d60: 6e 74 6f 75 72 20 4c 69 6e 65 73 2c 20 73 6f 20  ntour Lines, so 
1d70: 74 6f 20 73 70 65 65 64 20 75 70 20 74 68 65 20  to speed up the 
1d80: 77 68 6f 6c 65 20 71 75 65 72 79 2e 3c 2f 6c 69  whole query.</li
1d90: 3e 0d 0a 3c 6c 69 3e 3c 62 3e 43 52 45 41 54 45  >..<li><b>CREATE
1da0: 20 54 41 42 4c 45 20 43 6f 6e 74 6f 75 72 73 32   TABLE Contours2
1db0: 30 46 74 43 6c 69 70 70 65 64 20 41 53 3c 2f 62  0FtClipped AS</b
1dc0: 3e 20 73 69 6d 70 6c 79 20 69 6e 74 65 6e 64 73  > simply intends
1dd0: 20 74 68 61 74 20 74 68 65 20 72 65 73 75 6c 74   that the result
1de0: 73 65 74 20 72 65 74 75 72 6e 65 64 20 62 79 20  set returned by 
1df0: 74 68 69 73 20 53 51 4c 20 71 75 65 72 79 20 68  this SQL query h
1e00: 61 73 20 74 6f 20 62 65 20 70 65 72 6d 61 6e 65  as to be permane
1e10: 6e 74 6c 79 20 73 61 76 65 64 20 69 6e 74 6f 20  ntly saved into 
1e20: 79 65 74 20 61 6e 6f 74 68 65 72 20 74 61 62 6c  yet another tabl
1e30: 65 20 28 74 6f 20 62 65 20 63 72 65 61 74 65 64  e (to be created
1e40: 20 6f 6e 20 74 68 65 20 66 6c 79 29 2e 3c 2f 6c   on the fly).</l
1e50: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c  i>..</ul><br>..<
1e60: 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c  /td></tr>..<tr><
1e70: 74 64 3e 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 44  td><verbatim>..D
1e80: 45 4c 45 54 45 20 46 52 4f 4d 20 43 6f 6e 74 6f  ELETE FROM Conto
1e90: 75 72 73 32 30 46 74 43 6c 69 70 70 65 64 20 0d  urs20FtClipped .
1ea0: 0a 57 48 45 52 45 20 47 65 6f 6d 65 74 72 79 20  .WHERE Geometry 
1eb0: 49 53 20 4e 55 4c 4c 3b 0d 0a 3c 2f 76 65 72 62  IS NULL;..</verb
1ec0: 61 74 69 6d 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 3e  atim></td>..<td>
1ed0: 3c 68 33 3e 53 74 65 70 20 23 33 3c 2f 68 33 3e  <h3>Step #3</h3>
1ee0: 0d 0a 6a 75 73 74 20 61 20 73 74 75 70 69 64 20  ..just a stupid 
1ef0: 70 6f 73 74 2d 70 72 6f 63 65 73 73 69 6e 67 20  post-processing 
1f00: 73 74 65 70 3b 20 74 68 65 20 70 72 65 76 69 6f  step; the previo
1f10: 75 73 20 71 75 65 72 79 20 68 61 73 20 73 75 72  us query has sur
1f20: 65 6c 79 20 67 65 6e 65 72 61 74 65 64 20 6d 61  ely generated ma
1f30: 6e 79 20 4e 55 4c 4c 20 67 65 6f 6d 65 74 72 69  ny NULL geometri
1f40: 65 73 2c 20 61 6e 64 20 77 65 27 6c 6c 20 6e 6f  es, and we'll no
1f50: 77 20 67 65 74 20 72 69 64 20 6f 66 20 61 6c 6c  w get rid of all
1f60: 20 74 68 65 6d 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75   them.</li>..</u
1f70: 6c 3e 3c 62 72 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74  l><br>..</td></t
1f80: 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 3c 76 65 72  r>..<tr><td><ver
1f90: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 52  batim>..SELECT R
1fa0: 65 63 6f 76 65 72 47 65 6f 6d 65 74 72 79 43 6f  ecoverGeometryCo
1fb0: 6c 75 6d 6e 28 27 43 6f 6e 74 6f 75 72 73 32 30  lumn('Contours20
1fc0: 46 74 43 6c 69 70 70 65 64 27 2c 20 27 47 65 6f  FtClipped', 'Geo
1fd0: 6d 65 74 72 79 27 2c 20 0d 0a 20 20 20 20 32 32  metry', ..    22
1fe0: 36 30 2c 20 27 4d 55 4c 54 49 4c 49 4e 45 53 54  60, 'MULTILINEST
1ff0: 52 49 4e 47 27 2c 20 32 29 3b 0d 0a 53 45 4c 45  RING', 2);..SELE
2000: 43 54 20 43 72 65 61 74 65 53 70 61 74 69 61 6c  CT CreateSpatial
2010: 49 6e 64 65 78 28 27 43 6f 6e 74 6f 75 72 73 32  Index('Contours2
2020: 30 46 74 43 6c 69 70 70 65 64 27 2c 20 27 47 65  0FtClipped', 'Ge
2030: 6f 6d 65 74 72 79 27 29 3b 0d 0a 3c 2f 76 65 72  ometry');..</ver
2040: 62 61 74 69 6d 3e 3c 2f 74 64 3e 0d 0a 3c 74 64  batim></td>..<td
2050: 3e 3c 68 33 3e 53 74 65 70 20 23 34 3c 2f 68 33  ><h3>Step #4</h3
2060: 3e 0d 0a 74 68 65 20 76 65 72 79 20 66 69 6e 61  >..the very fina
2070: 6c 20 70 6f 73 74 2d 70 72 6f 63 65 73 73 69 6e  l post-processin
2080: 67 20 73 74 65 70 3a 20 74 72 61 6e 73 66 6f 72  g step: transfor
2090: 6d 69 6e 67 20 74 68 65 20 74 61 62 6c 65 20 63  ming the table c
20a0: 6f 6e 74 61 69 6e 69 6e 67 20 61 6c 6c 20 43 6c  ontaining all Cl
20b0: 69 70 70 65 64 20 43 6f 6e 74 6f 75 72 20 4c 69  ipped Contour Li
20c0: 6e 65 73 20 69 6e 74 6f 20 61 20 67 65 6e 75 69  nes into a genui
20d0: 6e 65 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65  ne Spatial Table
20e0: 20 73 75 70 70 6f 72 74 65 64 20 62 79 20 69 74   supported by it
20f0: 73 20 6f 77 6e 20 53 70 61 74 69 61 6c 20 49 6e  s own Spatial In
2100: 64 65 78 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  dex.</li>..</ul>
2110: 3c 62 72 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e  <br>..</td></tr>
2120: 0d 0a 3c 74 72 3e 3c 74 64 3e 3c 76 65 72 62 61  ..<tr><td><verba
2130: 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 44 61 74  tim>..SELECT Dat
2140: 65 54 69 6d 65 28 27 6e 6f 77 27 29 2c 20 27 73  eTime('now'), 's
2150: 6f 6d 65 20 6d 65 73 73 61 67 65 27 3b 0d 0a 3c  ome message';..<
2160: 2f 76 65 72 62 61 74 69 6d 3e 3c 2f 74 64 3e 0d  /verbatim></td>.
2170: 0a 3c 74 64 3e 3c 68 33 3e 6d 65 61 73 75 72 69  .<td><h3>measuri
2180: 6e 67 20 74 68 65 20 74 69 6d 65 3c 2f 68 33 3e  ng the time</h3>
2190: 74 68 69 73 20 73 69 6d 70 6c 79 20 69 73 20 61  this simply is a
21a0: 20 77 65 69 72 64 20 53 51 4c 20 74 72 69 63 6b   weird SQL trick
21b0: 3b 20 77 65 27 6c 6c 20 71 75 65 72 79 20 74 68  ; we'll query th
21c0: 65 20 73 79 73 74 65 6d 20 63 6c 6f 63 6b 20 69  e system clock i
21d0: 6d 6d 65 64 69 61 74 65 6c 79 20 62 65 66 6f 72  mmediately befor
21e0: 65 20 61 6e 64 20 61 66 74 65 72 20 70 65 72 66  e and after perf
21f0: 6f 72 6d 69 6e 67 20 65 61 63 68 20 73 74 65 70  orming each step
2200: 2c 20 73 6f 20 74 6f 20 67 65 74 20 66 75 6c 6c  , so to get full
2210: 20 74 72 61 63 65 20 6f 66 20 74 68 65 20 63 6f   trace of the co
2220: 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 69 6d 69  rresponding timi
2230: 6e 67 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  ngs.</li>..</ul>
2240: 3c 62 72 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e  <br>..</td></tr>
2250: 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 68 34 3e  ..</table>..<h4>
2260: 42 72 69 6e 67 69 6e 67 20 74 68 69 6e 67 73 20  Bringing things 
2270: 74 6f 20 61 20 68 65 61 64 3a 20 72 75 6e 6e 69  to a head: runni
2280: 6e 67 20 74 68 65 20 74 65 73 74 3c 2f 68 34 3e  ng the test</h4>
2290: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 23 20  ..<verbatim>..# 
22a0: 73 70 61 74 69 61 6c 69 74 65 20 6d 79 5f 74 65  spatialite my_te
22b0: 73 74 2e 73 71 6c 69 74 65 20 3c 20 74 65 73 74  st.sqlite < test
22c0: 2e 73 71 6c 0d 0a 0d 0a 53 70 61 74 69 61 4c 69  .sql....SpatiaLi
22d0: 74 65 20 76 65 72 73 69 6f 6e 20 2e 2e 3a 20 34  te version ..: 4
22e0: 2e 30 2e 30 2d 52 43 32 09 53 75 70 70 6f 72 74  .0.0-RC2.Support
22f0: 65 64 20 45 78 74 65 6e 73 69 6f 6e 73 3a 0d 0a  ed Extensions:..
2300: 09 2d 20 27 56 69 72 74 75 61 6c 53 68 61 70 65  .- 'VirtualShape
2310: 27 09 5b 64 69 72 65 63 74 20 53 68 61 70 65 66  '.[direct Shapef
2320: 69 6c 65 20 61 63 63 65 73 73 5d 0d 0a 09 2d 20  ile access]...- 
2330: 27 56 69 72 74 75 61 6c 44 62 66 27 09 09 5b 64  'VirtualDbf'..[d
2340: 69 72 65 63 74 20 44 42 46 20 61 63 63 65 73 73  irect DBF access
2350: 5d 0d 0a 09 2d 20 27 56 69 72 74 75 61 6c 58 4c  ]...- 'VirtualXL
2360: 27 09 09 5b 64 69 72 65 63 74 20 58 4c 53 20 61  '..[direct XLS a
2370: 63 63 65 73 73 5d 0d 0a 09 2d 20 27 56 69 72 74  ccess]...- 'Virt
2380: 75 61 6c 54 65 78 74 27 09 09 5b 64 69 72 65 63  ualText'..[direc
2390: 74 20 43 53 56 2f 54 58 54 20 61 63 63 65 73 73  t CSV/TXT access
23a0: 5d 0d 0a 09 2d 20 27 56 69 72 74 75 61 6c 4e 65  ]...- 'VirtualNe
23b0: 74 77 6f 72 6b 27 09 5b 44 69 6a 6b 73 74 72 61  twork'.[Dijkstra
23c0: 20 73 68 6f 72 74 65 73 74 20 70 61 74 68 5d 0d   shortest path].
23d0: 0a 09 2d 20 27 52 54 72 65 65 27 09 09 5b 53 70  ..- 'RTree'..[Sp
23e0: 61 74 69 61 6c 20 49 6e 64 65 78 20 2d 20 52 2a  atial Index - R*
23f0: 54 72 65 65 5d 0d 0a 09 2d 20 27 4d 62 72 43 61  Tree]...- 'MbrCa
2400: 63 68 65 27 09 09 5b 53 70 61 74 69 61 6c 20 49  che'..[Spatial I
2410: 6e 64 65 78 20 2d 20 4d 42 52 20 63 61 63 68 65  ndex - MBR cache
2420: 5d 0d 0a 09 2d 20 27 56 69 72 74 75 61 6c 53 70  ]...- 'VirtualSp
2430: 61 74 69 61 6c 49 6e 64 65 78 27 09 5b 52 2a 54  atialIndex'.[R*T
2440: 72 65 65 20 6d 65 74 61 68 61 6e 64 6c 65 72 5d  ree metahandler]
2450: 0d 0a 09 2d 20 27 56 69 72 74 75 61 6c 46 44 4f  ...- 'VirtualFDO
2460: 27 09 09 5b 46 44 4f 2d 4f 47 52 20 69 6e 74 65  '..[FDO-OGR inte
2470: 72 6f 70 65 72 61 62 69 6c 69 74 79 5d 0d 0a 09  roperability]...
2480: 2d 20 27 53 70 61 74 69 61 4c 69 74 65 27 09 09  - 'SpatiaLite'..
2490: 5b 53 70 61 74 69 61 6c 20 53 51 4c 20 2d 20 4f  [Spatial SQL - O
24a0: 47 43 5d 0d 0a 50 52 4f 4a 2e 34 20 76 65 72 73  GC]..PROJ.4 vers
24b0: 69 6f 6e 20 2e 2e 2e 2e 2e 2e 3a 20 52 65 6c 2e  ion ......: Rel.
24c0: 20 34 2e 37 2e 31 2c 20 32 33 20 53 65 70 74 65   4.7.1, 23 Septe
24d0: 6d 62 65 72 20 32 30 30 39 0d 0a 47 45 4f 53 20  mber 2009..GEOS 
24e0: 76 65 72 73 69 6f 6e 20 2e 2e 2e 2e 2e 2e 2e 2e  version ........
24f0: 3a 20 33 2e 32 2e 30 2d 43 41 50 49 2d 31 2e 36  : 3.2.0-CAPI-1.6
2500: 2e 30 0d 0a 0d 0a 32 30 31 32 2d 31 31 2d 31 30  .0....2012-11-10
2510: 20 30 30 3a 30 33 3a 35 32 7c 4c 6f 61 64 69 6e   00:03:52|Loadin
2520: 67 20 74 68 65 20 53 74 75 64 79 41 72 65 61 20  g the StudyArea 
2530: 53 48 50 0d 0a 32 30 31 32 2d 31 31 2d 31 30 20  SHP..2012-11-10 
2540: 30 30 3a 30 33 3a 35 32 7c 4c 6f 61 64 69 6e 67  00:03:52|Loading
2550: 20 74 68 65 20 43 6f 6e 74 6f 75 72 73 20 53 48   the Contours SH
2560: 50 0d 0a 32 30 31 32 2d 31 31 2d 31 30 20 30 30  P..2012-11-10 00
2570: 3a 30 34 3a 35 34 7c 43 6c 69 70 70 69 6e 67 20  :04:54|Clipping 
2580: 2e 2e 2e 20 70 6c 65 61 73 65 20 77 61 69 74 0d  ... please wait.
2590: 0a 32 30 31 32 2d 31 31 2d 31 30 20 30 30 3a 30  .2012-11-10 00:0
25a0: 37 3a 33 31 7c 64 65 6c 65 74 69 6e 67 20 4e 55  7:31|deleting NU
25b0: 4c 4c 20 47 65 6f 6d 65 74 72 69 65 73 0d 0a 32  LL Geometries..2
25c0: 30 31 32 2d 31 31 2d 31 30 20 30 30 3a 30 37 3a  012-11-10 00:07:
25d0: 33 33 7c 72 65 63 6f 76 65 72 69 6e 67 20 61 20  33|recovering a 
25e0: 67 65 6e 75 69 6e 65 20 47 65 6f 6d 65 74 72 79  genuine Geometry
25f0: 20 63 6f 6c 75 6d 6e 0d 0a 32 30 31 32 2d 31 31   column..2012-11
2600: 2d 31 30 20 30 30 3a 30 37 3a 33 34 7c 63 72 65  -10 00:07:34|cre
2610: 61 74 69 6e 67 20 74 68 65 20 53 70 61 74 69 61  ating the Spatia
2620: 6c 20 49 6e 64 65 78 0d 0a 32 30 31 32 2d 31 31  l Index..2012-11
2630: 2d 31 30 20 30 30 3a 30 37 3a 33 36 7c 61 6c 6c  -10 00:07:36|all
2640: 20 64 6f 6e 65 20 2e 2e 2e 20 71 75 69 74 74 69   done ... quitti
2650: 6e 67 0d 0a 23 0d 0a 3c 2f 76 65 72 62 61 74 69  ng..#..</verbati
2660: 6d 3e 0d 0a 3c 68 32 3e 46 69 6e 61 6c 20 63 6f  m>..<h2>Final co
2670: 6e 73 69 64 65 72 61 74 69 6f 6e 73 3c 2f 68 32  nsiderations</h2
2680: 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 54 68 65  >..<ul>..<li>The
2690: 20 77 68 6f 6c 65 20 70 72 6f 63 65 73 73 20 74   whole process t
26a0: 6f 6f 6b 20 6c 65 73 73 20 74 68 61 6e 20 3c 62  ook less than <b
26b0: 3e 34 20 6d 69 6e 75 74 65 73 3c 2f 62 3e 3c 2f  >4 minutes</b></
26c0: 6c 69 3e 0d 0a 3c 6c 69 3e 41 62 6f 75 74 20 3c  li>..<li>About <
26d0: 62 3e 31 20 6d 69 6e 75 74 65 3c 2f 62 3e 20 77  b>1 minute</b> w
26e0: 61 73 20 73 70 65 6e 74 20 6c 6f 61 64 69 6e 67  as spent loading
26f0: 20 74 68 65 20 53 68 61 70 65 66 69 6c 65 73 20   the Shapefiles 
2700: 61 6e 64 20 62 75 69 6c 64 69 6e 67 20 74 68 65  and building the
2710: 20 73 75 70 70 6f 72 74 69 6e 67 20 53 70 61 74   supporting Spat
2720: 69 61 6c 20 49 6e 64 65 78 3c 2f 6c 69 3e 0d 0a  ial Index</li>..
2730: 3c 6c 69 3e 4c 65 73 73 20 74 68 61 6e 20 3c 62  <li>Less than <b
2740: 3e 31 30 20 73 65 63 6f 6e 64 73 3c 2f 62 3e 20  >10 seconds</b> 
2750: 77 65 72 65 20 73 70 65 6e 74 20 70 65 72 66 6f  were spent perfo
2760: 72 6d 69 6e 67 20 70 6f 73 74 2d 70 72 6f 63 65  rming post-proce
2770: 73 73 69 6e 67 20 73 74 65 70 73 2e 3c 2f 6c 69  ssing steps.</li
2780: 3e 0d 0a 3c 6c 69 3e 54 68 65 20 68 61 72 64 2d  >..<li>The hard-
2790: 63 6f 72 65 20 70 72 6f 62 6c 65 6d 20 69 74 73  core problem its
27a0: 65 6c 66 20 28 67 65 6e 65 72 61 74 69 6e 67 20  elf (generating 
27b0: 61 20 43 6c 69 70 70 65 64 20 73 65 74 20 6f 66  a Clipped set of
27c0: 20 43 6f 6e 74 6f 75 72 20 4c 69 6e 65 73 29 20   Contour Lines) 
27d0: 74 6f 6f 6b 20 61 62 6f 75 74 20 3c 62 3e 32 20  took about <b>2 
27e0: 6d 69 6e 75 74 65 73 20 61 6e 64 20 68 61 6c 66  minutes and half
27f0: 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c  </b>.</li>..</ul
2800: 3e 3c 62 72 3e 0d 0a 3c 75 3e 50 6c 65 61 73 65  ><br>..<u>Please
2810: 20 6e 6f 74 65 3c 2f 75 3e 3a 20 74 68 69 73 20   note</u>: this 
2820: 3c 62 3e 43 6c 69 70 70 69 6e 67 20 43 6f 6e 74  <b>Clipping Cont
2830: 65 73 74 3c 2f 62 3e 20 72 65 61 6c 6c 79 20 69  est</b> really i
2840: 73 20 6c 69 6b 65 20 3c 62 3e 63 6f 6d 70 61 72  s like <b>compar
2850: 69 6e 67 20 61 70 70 6c 65 73 20 61 6e 64 20 6f  ing apples and o
2860: 72 61 6e 67 65 73 3c 2f 62 3e 2e 0d 0a 3c 75 6c  ranges</b>...<ul
2870: 3e 0d 0a 3c 6c 69 3e 74 68 65 20 43 50 55 73 20  >..<li>the CPUs 
2880: 75 73 65 64 20 74 6f 20 61 63 74 75 61 6c 6c 79  used to actually
2890: 20 72 75 6e 20 74 68 65 20 74 65 73 74 73 20 61   run the tests a
28a0: 72 65 20 6f 66 20 64 69 66 66 65 72 65 6e 74 20  re of different 
28b0: 67 65 6e 65 72 61 74 69 6f 6e 73 2c 20 61 6e 64  generations, and
28c0: 20 6f 62 76 69 6f 75 73 6c 79 20 68 61 76 65 20   obviously have 
28d0: 64 69 66 66 65 72 65 6e 74 20 69 6e 74 72 69 6e  different intrin
28e0: 73 69 63 20 73 70 65 65 64 73 2e 3c 2f 6c 69 3e  sic speeds.</li>
28f0: 0d 0a 3c 6c 69 3e 69 74 27 73 20 6e 6f 74 20 61  ..<li>it's not a
2900: 74 20 61 6c 6c 20 63 6c 65 61 72 6c 79 20 73 74  t all clearly st
2910: 61 74 65 64 20 69 66 20 74 68 65 20 44 65 73 6b  ated if the Desk
2920: 74 6f 70 20 47 49 53 20 61 70 70 73 20 70 65 72  top GIS apps per
2930: 6d 61 6e 65 6e 74 6c 79 20 73 61 76 65 64 20 74  manently saved t
2940: 68 65 20 43 6c 69 70 70 65 64 20 43 6f 6e 74 6f  he Clipped Conto
2950: 75 72 20 4c 69 6e 65 73 20 73 6f 6d 65 77 68 65  ur Lines somewhe
2960: 72 65 20 6f 72 20 6e 6f 74 2e 20 41 6e 64 20 69  re or not. And i
2970: 74 27 73 20 6e 6f 74 20 61 74 20 61 6c 6c 20 63  t's not at all c
2980: 6c 65 61 72 20 77 68 69 63 68 20 6b 69 6e 64 20  lear which kind 
2990: 6f 66 20 64 61 74 61 20 73 74 6f 72 61 67 65 20  of data storage 
29a0: 74 68 65 79 20 75 73 65 64 20 28 64 69 72 65 63  they used (direc
29b0: 74 6c 79 20 61 63 63 65 73 73 69 6e 67 20 74 68  tly accessing th
29c0: 65 20 64 69 73 6b 2d 62 61 73 65 64 20 53 68 61  e disk-based Sha
29d0: 70 65 66 69 6c 65 73 20 3f 20 6c 6f 61 64 69 6e  pefiles ? loadin
29e0: 67 20 61 6c 6c 20 74 68 65 20 73 74 75 66 66 20  g all the stuff 
29f0: 69 6e 20 6d 65 6d 6f 72 79 20 3f 20 73 6f 6d 65  in memory ? some
2a00: 20 6f 74 68 65 72 20 6b 69 6e 64 20 6f 66 20 70   other kind of p
2a10: 72 6f 70 65 72 6c 79 20 73 74 72 75 63 74 75 72  roperly structur
2a20: 65 64 20 64 69 73 6b 2d 62 61 73 65 64 20 73 74  ed disk-based st
2a30: 6f 72 61 67 65 2c 20 6d 61 79 20 62 65 20 74 65  orage, may be te
2a40: 6d 70 6f 72 61 72 79 20 61 6e 64 20 74 72 61 6e  mporary and tran
2a50: 73 69 65 6e 74 20 3f 29 3c 2f 6c 69 3e 0d 0a 3c  sient ?)</li>..<
2a60: 6c 69 3e 74 68 65 20 61 6d 6f 75 6e 74 20 6f 66  li>the amount of
2a70: 20 61 76 61 69 6c 61 62 6c 65 20 52 41 4d 20 69   available RAM i
2a80: 73 20 61 62 73 6f 6c 75 74 65 6c 79 20 6e 6f 74  s absolutely not
2a90: 20 72 65 6c 65 76 61 6e 74 3b 20 74 68 69 73 20   relevant; this 
2aa0: 43 6f 6e 74 65 73 74 20 63 6f 75 6c 64 20 65 76  Contest could ev
2ab0: 65 6e 74 75 61 6c 6c 79 20 62 65 6e 65 66 69 74  entually benefit
2ac0: 20 66 72 6f 6d 20 61 20 66 61 73 74 65 72 20 43   from a faster C
2ad0: 50 55 2c 20 62 75 74 20 74 68 65 20 72 65 71 75  PU, but the requ
2ae0: 69 72 65 64 20 6d 65 6d 6f 72 79 20 66 6f 6f 74  ired memory foot
2af0: 70 72 69 6e 74 20 69 73 20 6d 69 6e 69 6d 61 6c  print is minimal
2b00: 20 28 6a 75 73 74 20 66 65 77 20 68 75 6e 64 72   (just few hundr
2b10: 65 64 74 68 20 4d 42 20 69 6e 20 74 68 65 20 53  edth MB in the S
2b20: 70 61 74 69 61 4c 69 74 65 27 73 20 63 61 73 65  patiaLite's case
2b30: 29 2e 0d 0a 43 6f 6e 73 75 6d 69 6e 67 20 68 75  )...Consuming hu
2b40: 67 65 20 61 6d 6f 75 6e 74 73 20 6f 66 20 52 41  ge amounts of RA
2b50: 4d 20 64 6f 65 73 6e 27 74 20 6c 6f 6f 6b 73 20  M doesn't looks 
2b60: 61 74 20 61 6c 6c 20 61 20 77 69 73 65 20 73 6f  at all a wise so
2b70: 6c 75 74 69 6f 6e 2c 20 61 6e 64 20 69 73 6e 27  lution, and isn'
2b80: 74 20 61 74 20 61 6c 6c 20 73 74 72 69 63 74 6c  t at all strictl
2b90: 79 20 72 65 71 75 69 72 65 64 20 69 6e 20 74 68  y required in th
2ba0: 69 73 20 73 70 65 63 69 66 69 63 20 63 61 73 65  is specific case
2bb0: 2e 20 57 68 65 6e 20 73 75 63 68 20 61 20 63 6f  . When such a co
2bc0: 6e 64 69 74 69 6f 6e 20 65 6d 65 72 67 65 73 20  ndition emerges 
2bd0: 74 68 69 73 20 77 69 6c 6c 20 70 72 6f 62 61 62  this will probab
2be0: 6c 79 20 6d 65 61 6e 20 74 68 61 74 20 73 6f 6d  ly mean that som
2bf0: 65 20 3c 75 3e 3c 69 3e 62 61 72 62 61 72 69 63  e <u><i>barbaric
2c00: 20 62 72 75 74 65 2d 66 6f 72 63 65 3c 2f 69 3e   brute-force</i>
2c10: 3c 2f 75 3e 20 64 61 74 61 20 61 63 63 65 73 73  </u> data access
2c20: 20 73 74 72 61 74 65 67 79 20 68 61 73 20 62 65   strategy has be
2c30: 65 6e 20 62 61 64 6c 79 20 61 64 6f 70 74 65 64  en badly adopted
2c40: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 64 6f 70  .</li>..<li>adop
2c50: 74 69 6e 67 20 73 6f 6d 65 20 6b 69 6e 64 20 6f  ting some kind o
2c60: 66 20 70 61 72 61 6c 6c 65 6c 20 70 72 6f 63 65  f parallel proce
2c70: 73 73 69 6e 67 20 77 69 6c 6c 20 6f 62 76 69 6f  ssing will obvio
2c80: 75 73 6c 79 20 69 6e 74 72 6f 64 75 63 65 20 61  usly introduce a
2c90: 20 6e 6f 74 69 63 65 61 62 6c 65 20 70 65 72 66   noticeable perf
2ca0: 6f 72 6d 61 6e 63 65 20 62 6f 6f 73 74 20 28 53  ormance boost (S
2cb0: 70 61 74 69 61 4c 69 74 65 20 69 73 20 73 69 6e  patiaLite is sin
2cc0: 67 6c 65 20 74 68 72 65 61 64 65 64 3b 20 73 6f  gle threaded; so
2cd0: 20 75 73 69 6e 67 20 61 20 71 75 61 64 2d 63 6f   using a quad-co
2ce0: 72 65 20 70 72 6f 63 65 73 73 6f 72 20 68 61 64  re processor had
2cf0: 20 61 62 73 6f 6c 75 74 65 6c 79 20 6e 6f 20 65   absolutely no e
2d00: 66 66 65 63 74 20 61 74 20 61 6c 6c 29 2e 3c 2f  ffect at all).</
2d10: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 68 34 3e  li>..</ul>..<h4>
2d20: 57 68 61 74 20 61 72 65 20 77 65 20 6d 65 61 73  What are we meas
2d30: 75 72 69 6e 67 2c 20 72 65 61 6c 6c 79 20 3f 3c  uring, really ?<
2d40: 2f 68 34 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  /h4>..<ul>..<li>
2d50: 6d 61 6e 79 20 47 46 4f 53 53 20 69 6d 70 6c 65  many GFOSS imple
2d60: 6d 65 6e 74 61 74 69 6f 6e 73 20 28 51 47 49 53  mentations (QGIS
2d70: 2c 20 50 6f 73 74 47 49 53 2c 20 53 70 61 74 69  , PostGIS, Spati
2d80: 61 4c 69 74 65 29 20 61 72 65 20 62 61 73 65 64  aLite) are based
2d90: 20 6f 6e 20 3c 61 20 68 72 65 66 3d 22 68 74 74   on <a href="htt
2da0: 70 3a 2f 2f 74 72 61 63 2e 6f 73 67 65 6f 2e 6f  p://trac.osgeo.o
2db0: 72 67 2f 67 65 6f 73 2f 22 3e 47 45 4f 53 3c 2f  rg/geos/">GEOS</
2dc0: 61 3e 3b 20 73 6f 20 61 6e 79 20 6d 65 61 73 75  a>; so any measu
2dd0: 72 65 64 20 74 69 6d 65 20 65 66 66 65 63 74 69  red time effecti
2de0: 76 65 6c 79 20 72 65 70 72 65 73 65 6e 74 73 20  vely represents 
2df0: 74 68 65 20 69 6e 74 72 69 6e 73 69 63 20 65 66  the intrinsic ef
2e00: 66 69 63 69 65 6e 63 79 20 6f 66 20 47 45 4f 53  ficiency of GEOS
2e10: 20 6d 75 63 68 20 6d 6f 72 65 20 74 68 61 6e 20   much more than 
2e20: 74 68 65 20 65 66 66 69 63 69 65 6e 63 79 20 6f  the efficiency o
2e30: 66 20 74 68 65 20 74 6f 70 2d 6c 65 76 65 6c 20  f the top-level 
2e40: 61 70 70 6c 69 63 61 74 69 6f 6e 20 69 74 73 65  application itse
2e50: 6c 66 2e 0d 0a 49 66 20 61 20 64 69 66 66 65 72  lf...If a differ
2e60: 65 6e 63 65 20 65 78 69 73 74 73 20 62 65 74 77  ence exists betw
2e70: 65 65 6e 20 64 69 66 66 65 72 65 6e 74 20 47 45  een different GE
2e80: 4f 53 2d 62 61 73 65 64 20 61 70 70 73 2c 20 74  OS-based apps, t
2e90: 68 69 73 20 69 73 20 73 69 6d 70 6c 79 20 77 68  his is simply wh
2ea0: 65 6e 20 74 68 65 20 74 6f 70 2d 6c 65 76 65 6c  en the top-level
2eb0: 20 61 70 70 73 20 62 61 64 6c 79 20 69 6e 74 72   apps badly intr
2ec0: 6f 64 75 63 65 73 20 73 6f 6d 65 20 66 75 72 74  oduces some furt
2ed0: 68 65 72 20 6f 76 65 72 68 65 61 64 20 74 68 75  her overhead thu
2ee0: 73 20 72 65 64 75 63 69 6e 67 20 74 68 65 20 6f  s reducing the o
2ef0: 76 65 72 61 6c 6c 20 65 66 66 69 63 69 65 6e 63  verall efficienc
2f00: 79 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 6f 74 68  y.</li>..<li>oth
2f10: 65 72 20 47 46 4f 53 53 20 4a 61 76 61 20 69 6d  er GFOSS Java im
2f20: 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 28 67  plementations (g
2f30: 76 53 49 47 2c 20 4f 70 65 6e 4a 75 6d 70 2c 20  vSIG, OpenJump, 
2f40: 75 44 49 47 29 20 61 72 65 20 62 61 73 65 64 20  uDIG) are based 
2f50: 6f 6e 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70  on <a href="http
2f60: 3a 2f 2f 77 77 77 2e 76 69 76 69 64 73 6f 6c 75  ://www.vividsolu
2f70: 74 69 6f 6e 73 2e 63 6f 6d 2f 6a 74 73 2f 6a 74  tions.com/jts/jt
2f80: 73 68 6f 6d 65 2e 68 74 6d 22 3e 4a 54 53 3c 2f  shome.htm">JTS</
2f90: 61 3e 3b 20 62 75 74 20 47 45 4f 53 20 73 69 6d  a>; but GEOS sim
2fa0: 70 6c 79 20 69 73 20 61 20 74 72 61 6e 73 70 6f  ply is a transpo
2fb0: 73 69 74 69 6f 6e 20 69 6e 20 43 2b 2b 20 6f 66  sition in C++ of
2fc0: 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 4a 61   the original Ja
2fd0: 76 61 2d 62 61 73 65 64 20 4a 54 53 2c 20 74 68  va-based JTS, th
2fe0: 65 20 75 6e 64 65 72 6c 61 79 69 6e 67 20 61 6c  e underlaying al
2ff0: 67 6f 72 69 74 68 6d 73 20 61 72 65 20 65 78 61  gorithms are exa
3000: 63 74 6c 79 20 74 68 65 20 73 61 6d 65 20 66 6f  ctly the same fo
3010: 72 20 62 6f 74 68 20 6c 69 62 72 61 72 69 65 73  r both libraries
3020: 2e 0d 0a 53 6f 2c 20 72 6f 75 67 68 6c 79 20 73  ...So, roughly s
3030: 70 65 61 6b 69 6e 67 2c 20 61 6c 6c 20 47 46 4f  peaking, all GFO
3040: 53 53 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20  SS applications 
3050: 28 62 6f 74 68 20 43 2c 20 43 2b 2b 20 61 6e 64  (both C, C++ and
3060: 20 4a 61 76 61 29 20 61 66 74 65 72 20 61 6c 6c   Java) after all
3070: 20 61 72 65 20 62 61 73 65 64 20 6f 6e 20 74 68   are based on th
3080: 65 20 74 6f 70 20 6f 66 20 74 68 65 20 73 61 6d  e top of the sam
3090: 65 20 62 61 73 65 2d 6c 65 76 65 6c 20 61 6c 67  e base-level alg
30a0: 6f 72 69 74 68 6d 73 2e 0d 0a 41 6e 64 20 6e 6f  orithms...And no
30b0: 74 20 61 74 20 61 6c 6c 20 73 75 72 70 72 69 73  t at all surpris
30c0: 69 6e 67 6c 79 20 61 6c 6c 20 6d 65 61 73 75 72  ingly all measur
30d0: 65 64 20 74 69 6d 69 6e 67 73 20 61 72 65 20 71  ed timings are q
30e0: 75 69 74 65 20 65 78 61 63 74 6c 79 20 74 68 65  uite exactly the
30f0: 20 73 61 6d 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69   same.</li>..<li
3100: 3e 77 69 74 68 20 74 68 65 20 72 65 6d 61 72 6b  >with the remark
3110: 61 62 6c 65 20 65 78 63 65 70 74 69 6f 6e 20 6f  able exception o
3120: 66 20 47 52 41 53 53 20 47 49 53 3b 20 74 68 69  f GRASS GIS; thi
3130: 73 20 6f 6e 65 20 61 64 6f 70 74 73 20 61 6e 20  s one adopts an 
3140: 6f 72 69 67 69 6e 61 6c 20 61 70 70 72 6f 61 63  original approac
3150: 68 20 6f 66 20 69 74 73 20 6f 77 6e 2c 20 62 65  h of its own, be
3160: 69 6e 67 20 62 61 73 65 64 20 6f 6e 20 61 20 63  ing based on a c
3170: 6f 6e 63 65 70 74 75 61 6c 6c 79 20 64 69 66 66  onceptually diff
3180: 65 72 65 6e 74 20 47 65 6f 6d 65 74 72 79 20 6d  erent Geometry m
3190: 6f 64 65 6c 20 28 74 6f 70 6f 6c 6f 67 79 20 76  odel (topology v
31a0: 73 20 73 69 6d 70 6c 65 20 66 65 61 74 75 72 65  s simple feature
31b0: 73 29 2e 0d 0a 41 6e 79 77 61 79 2c 20 69 6e 20  s)...Anyway, in 
31c0: 74 68 69 73 20 63 61 73 65 20 74 6f 6f 20 74 69  this case too ti
31d0: 6d 69 6e 67 73 20 61 72 65 20 76 65 72 79 20 73  mings are very s
31e0: 69 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 6f 74  imilar to the ot
31f0: 68 65 72 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  hers.</li>..<li>
3200: 49 4d 48 4f 20 69 74 27 73 20 61 20 67 6f 6f 64  IMHO it's a good
3210: 20 64 65 6d 6f 6e 73 74 72 61 74 69 6f 6e 20 74   demonstration t
3220: 68 61 74 20 77 65 20 68 61 76 65 20 63 6f 6d 70  hat we have comp
3230: 6c 65 73 73 69 76 65 6c 79 20 72 65 61 63 68 65  lessively reache
3240: 64 20 74 68 65 20 62 65 73 74 20 70 6f 73 73 69  d the best possi
3250: 62 6c 65 20 65 66 66 69 63 69 65 6e 63 79 20 66  ble efficiency f
3260: 6f 72 20 74 68 69 73 20 6b 69 6e 64 20 6f 66 20  or this kind of 
3270: 70 72 6f 62 6c 65 6d 73 2e 20 41 6e 64 20 74 68  problems. And th
3280: 61 74 20 6f 70 65 6e 6e 65 73 73 20 63 6f 6d 62  at openness comb
3290: 69 6e 65 64 20 77 69 74 68 20 63 6f 6c 6c 61 62  ined with collab
32a0: 6f 72 61 74 69 6f 6e 2f 63 6f 6d 70 65 74 69 74  oration/competit
32b0: 69 6f 6e 20 62 65 74 77 65 65 6e 20 6d 61 6e 79  ion between many
32c0: 20 64 69 66 66 65 72 65 6e 74 20 69 6e 64 65 70   different indep
32d0: 65 6e 64 65 6e 74 20 70 72 6f 6a 65 63 74 73 20  endent projects 
32e0: 61 6c 77 61 79 73 20 6c 65 61 64 73 20 74 6f 20  always leads to 
32f0: 67 6f 6f 64 2c 20 72 6f 62 75 73 74 20 61 6e 64  good, robust and
3300: 20 65 66 66 69 63 69 65 6e 74 20 73 6f 66 74 77   efficient softw
3310: 61 72 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 6d  are.</li>..<li>m
3320: 61 6e 79 20 70 72 6f 70 72 69 65 74 61 72 79 20  any proprietary 
3330: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20  implementations 
3340: 6c 6f 6f 6b 73 20 74 6f 20 62 65 20 65 6d 62 61  looks to be emba
3350: 72 72 61 73 73 61 6e 67 6c 79 20 6c 65 73 73 20  rrassangly less 
3360: 65 66 66 69 63 69 65 6e 74 2e 0d 0a 41 20 73 61  efficient...A sa
3370: 64 20 64 65 6d 6f 6e 73 74 72 61 74 69 6f 6e 20  d demonstration 
3380: 74 68 61 74 20 61 20 64 65 76 65 6c 6f 70 6d 65  that a developme
3390: 6e 74 20 70 6f 6c 69 63 79 20 62 61 73 65 64 20  nt policy based 
33a0: 6f 6e 20 63 6c 6f 73 65 64 6e 65 73 73 20 61 6e  on closedness an
33b0: 64 20 73 65 63 72 65 63 79 20 76 65 72 79 20 64  d secrecy very d
33c0: 69 66 66 69 63 75 6c 74 6c 79 20 70 61 79 73 20  ifficultly pays 
33d0: 6f 6e 20 6c 6f 6e 67 20 74 65 72 6d 20 70 65 72  on long term per
33e0: 69 6f 64 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 6c 69  iods.</li>..</li
33f0: 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 3c 68  >..</ul>..<br><h
3400: 72 3e 0d 0a 42 61 63 6b 20 74 6f 20 3c 61 20 68  r>..Back to <a h
3410: 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77  ref="https://www
3420: 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73  .gaia-gis.it/fos
3430: 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c 69 74  sil/libspatialit
3440: 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 73 77 69 74  e/wiki?name=swit
3450: 63 68 69 6e 67 2d 74 6f 2d 34 2e 30 23 76 69 72  ching-to-4.0#vir
3460: 74 75 61 6c 6f 67 72 22 3e 6d 61 69 6e 20 70 61  tualogr">main pa
3470: 67 65 3c 2f 61 3e 0a 5a 20 35 38 38 61 37 64 32  ge</a>.Z 588a7d2
3480: 30 61 65 64 66 62 39 66 35 35 37 33 34 33 32 33  0aedfb9f55734323
3490: 33 39 37 37 64 31 32 39 37 0a                    3977d1297.