Hex Artifact Content
Not logged in

Artifact 467ae03c8fceaa028dab4796c0d700dee83917df:

Wiki page [tesselations-4.0] by sandro 2012-08-30 13:27:11.
0000: 44 20 32 30 31 32 2d 30 38 2d 33 30 54 31 33 3a  D 2012-08-30T13:
0010: 32 37 3a 31 31 2e 34 34 35 0a 4c 20 74 65 73 73  27:11.445.L tess
0020: 65 6c 61 74 69 6f 6e 73 2d 34 2e 30 0a 50 20 64  elations-4.0.P d
0030: 35 36 31 65 31 31 31 62 34 66 39 61 61 61 37 30  561e111b4f9aaa70
0040: 65 35 37 64 37 63 31 62 33 31 61 66 65 35 30 33  e57d7c1b31afe503
0050: 65 37 66 35 66 64 35 0a 55 20 73 61 6e 64 72 6f  e7f5fd5.U sandro
0060: 0a 57 20 32 30 31 32 37 0a 3c 68 32 3e 54 65 73  .W 20127.<h2>Tes
0070: 73 65 6c 6c 61 74 69 6f 6e 2d 72 65 6c 61 74 65  sellation-relate
0080: 64 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e 73 20  d SQL functions 
0090: 73 75 70 70 6f 72 74 65 64 20 69 6e 20 76 65 72  supported in ver
00a0: 73 69 6f 6e 20 34 2e 30 2e 30 3c 2f 68 32 3e 0d  sion 4.0.0</h2>.
00b0: 0a 42 61 63 6b 20 74 6f 20 3c 61 20 68 72 65 66  .Back to <a href
00c0: 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61  ="https://www.ga
00d0: 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c  ia-gis.it/fossil
00e0: 2f 6c 69 62 73 70 61 74 69 61 6c 69 74 65 2f 77  /libspatialite/w
00f0: 69 6b 69 3f 6e 61 6d 65 3d 73 77 69 74 63 68 69  iki?name=switchi
0100: 6e 67 2d 74 6f 2d 34 2e 30 23 74 65 73 73 65 6c  ng-to-4.0#tessel
0110: 6c 61 74 69 6f 6e 22 3e 6d 61 69 6e 20 70 61 67  lation">main pag
0120: 65 3c 2f 61 3e 0d 0a 3c 68 33 3e 47 65 6e 65 72  e</a>..<h3>Gener
0130: 61 6c 69 74 69 65 73 20 61 62 6f 75 74 20 74 65  alities about te
0140: 73 73 65 6c 6c 61 74 69 6f 6e 73 3c 2f 68 33 3e  ssellations</h3>
0150: 0d 0a 3c 69 3e 54 65 73 73 65 6c 6c 61 74 69 6f  ..<i>Tessellatio
0160: 6e 20 69 73 20 74 68 65 20 70 72 6f 63 65 73 73  n is the process
0170: 20 6f 66 20 63 72 65 61 74 69 6e 67 20 61 20 74   of creating a t
0180: 77 6f 2d 64 69 6d 65 6e 73 69 6f 6e 61 6c 20 70  wo-dimensional p
0190: 6c 61 6e 65 20 75 73 69 6e 67 20 74 68 65 20 72  lane using the r
01a0: 65 70 65 74 69 74 69 6f 6e 20 6f 66 20 61 20 67  epetition of a g
01b0: 65 6f 6d 65 74 72 69 63 20 73 68 61 70 65 20 77  eometric shape w
01c0: 69 74 68 20 6e 6f 20 6f 76 65 72 6c 61 70 73 20  ith no overlaps 
01d0: 61 6e 64 20 6e 6f 20 67 61 70 73 2e 3c 2f 69 3e  and no gaps.</i>
01e0: 0d 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a  ..<a href="http:
01f0: 2f 2f 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f  //en.wikipedia.o
0200: 72 67 2f 77 69 6b 69 2f 54 65 73 73 65 6c 6c 61  rg/wiki/Tessella
0210: 74 69 6f 6e 22 3e 72 65 61 64 20 6d 6f 72 65 3c  tion">read more<
0220: 2f 61 3e 3c 62 72 3e 3c 62 72 3e 0d 0a 41 20 74  /a><br><br>..A t
0230: 65 73 73 65 6c 6c 61 74 69 6f 6e 20 63 6f 75 6c  essellation coul
0240: 64 20 62 65 20 65 76 65 6e 74 75 61 6c 6c 79 20  d be eventually 
0250: 62 61 73 65 64 20 6f 6e 20 69 64 65 6e 74 69 63  based on identic
0260: 61 6c 20 3c 69 3e 63 65 6c 6c 73 3c 2f 69 3e 2c  al <i>cells</i>,
0270: 20 61 6c 6c 20 6f 66 20 65 78 61 63 74 6c 79 20   all of exactly 
0280: 74 68 65 20 73 61 6d 65 20 73 68 61 70 65 20 61  the same shape a
0290: 6e 64 20 73 69 7a 65 2e 0d 0a 49 6e 20 74 68 69  nd size...In thi
02a0: 73 20 63 61 73 65 20 77 65 27 6c 6c 20 68 61 76  s case we'll hav
02b0: 65 20 61 20 3c 69 3e 72 65 67 75 6c 61 72 20 74  e a <i>regular t
02c0: 65 73 73 65 6c 6c 61 74 69 6f 6e 3c 2f 69 3e 2e  essellation</i>.
02d0: 3c 62 72 3e 0d 0a 4a 75 73 74 20 61 20 71 75 69  <br>..Just a qui
02e0: 63 6b 20 72 65 63 61 6c 6c 20 6f 66 20 65 6c 65  ck recall of ele
02f0: 6d 65 6e 74 61 72 79 20 67 65 6f 6d 65 74 72 79  mentary geometry
0300: 3b 20 74 68 65 72 65 20 61 72 65 20 73 69 6d 70  ; there are simp
0310: 6c 79 20 3c 62 3e 33 3c 2f 62 3e 20 72 65 67 75  ly <b>3</b> regu
0320: 6c 61 72 20 70 6f 6c 79 67 6f 6e 61 6c 20 73 68  lar polygonal sh
0330: 61 70 65 73 20 77 65 20 63 61 6e 20 75 73 65 20  apes we can use 
0340: 69 6e 20 6f 72 64 65 72 20 74 6f 20 67 65 74 20  in order to get 
0350: 61 20 72 65 67 75 6c 61 72 20 74 65 73 73 65 6c  a regular tessel
0360: 6c 61 74 69 6f 6e 3a 20 74 68 65 20 3c 62 3e 65  lation: the <b>e
0370: 71 75 69 6c 61 74 65 72 61 6c 20 74 72 69 61 6e  quilateral trian
0380: 67 6c 65 3c 2f 62 3e 2c 20 74 68 65 20 3c 62 3e  gle</b>, the <b>
0390: 73 71 75 61 72 65 3c 2f 62 3e 20 61 6e 64 20 74  square</b> and t
03a0: 68 65 20 3c 62 3e 72 65 67 75 6c 61 72 20 68 65  he <b>regular he
03b0: 78 61 67 6f 6e 3c 2f 62 3e 2e 3c 62 72 3e 3c 62  xagon</b>.<br><b
03c0: 72 3e 0d 0a 4f 6e 20 74 68 65 20 6f 74 68 65 72  r>..On the other
03d0: 20 77 61 79 20 6d 61 6e 79 20 74 65 73 73 65 6c   way many tessel
03e0: 6c 61 74 69 6f 6e 73 20 61 72 65 6e 27 74 20 72  lations aren't r
03f0: 65 67 75 6c 61 72 20 61 74 20 61 6c 6c 2c 20 62  egular at all, b
0400: 65 63 61 75 73 65 20 65 61 63 68 20 73 69 6e 67  ecause each sing
0410: 6c 65 20 63 65 6c 6c 20 68 61 73 20 61 6e 20 69  le cell has an i
0420: 6e 64 69 76 69 64 75 61 6c 20 73 69 7a 65 20 61  ndividual size a
0430: 6e 64 20 73 68 61 70 65 20 6f 66 20 69 74 73 20  nd shape of its 
0440: 6f 77 6e 2e 3c 62 72 3e 0d 0a 49 74 27 73 20 72  own.<br>..It's r
0450: 65 61 6c 6c 79 20 69 6e 74 65 72 65 73 74 69 6e  eally interestin
0460: 67 20 74 6f 20 6e 6f 74 65 20 74 68 61 74 20 6d  g to note that m
0470: 61 6e 79 20 3c 69 3e 6e 61 74 75 72 61 6c 20 73  any <i>natural s
0480: 68 61 70 65 73 3c 2f 69 3e 20 63 6c 6f 73 65 6c  hapes</i> closel
0490: 79 20 72 65 73 65 6d 62 6c 65 20 61 20 74 65 73  y resemble a tes
04a0: 73 65 6c 6c 61 74 69 6f 6e 3a 20 67 6f 69 6e 67  sellation: going
04b0: 20 66 72 6f 6d 20 62 69 6f 6c 6f 67 79 20 74 6f   from biology to
04c0: 20 63 72 79 73 74 61 6c 6c 6f 67 72 61 70 68 79   crystallography
04d0: 20 73 69 6e 63 65 20 67 65 6f 6c 6f 67 79 20 61   since geology a
04e0: 6e 64 20 6c 61 6e 64 73 63 61 70 65 73 20 69 74  nd landscapes it
04f0: 27 73 20 6e 6f 74 20 61 74 20 61 6c 6c 20 64 69  's not at all di
0500: 66 66 69 63 75 6c 74 20 74 6f 20 69 64 65 6e 74  fficult to ident
0510: 69 66 79 20 6d 61 6e 79 20 6e 61 74 75 72 61 6c  ify many natural
0520: 20 74 65 73 73 65 6c 6c 61 74 69 6f 6e 20 65 78   tessellation ex
0530: 61 6d 70 6c 65 73 20 3c 69 3e 6f 6e 20 74 68 65  amples <i>on the
0540: 20 77 69 6c 64 3c 2f 69 3e 2e 0d 0a 53 6f 20 69   wild</i>...So i
0550: 74 27 73 20 6e 6f 74 20 61 74 20 61 6c 6c 20 73  t's not at all s
0560: 75 72 70 72 69 73 69 6e 67 20 74 6f 20 64 69 73  urprising to dis
0570: 63 6f 76 65 72 20 74 68 61 74 20 74 65 73 73 65  cover that tesse
0580: 6c 6c 61 74 69 6f 6e 73 20 61 72 65 20 6f 66 74  llations are oft
0590: 65 6e 20 75 73 65 66 75 6c 20 69 6e 20 67 65 6f  en useful in geo
05a0: 67 72 61 70 68 79 20 61 73 20 77 65 6c 6c 2e 0d  graphy as well..
05b0: 0a 3c 68 33 3e 53 65 74 74 69 6e 67 20 75 70 20  .<h3>Setting up 
05c0: 61 20 74 65 73 74 62 65 64 20 44 42 3c 2f 68 33  a testbed DB</h3
05d0: 3e 0d 0a 49 6e 20 74 68 69 73 20 73 68 6f 72 74  >..In this short
05e0: 20 74 75 74 6f 72 69 61 6c 20 77 65 27 6c 6c 20   tutorial we'll 
05f0: 75 73 65 20 61 20 76 65 72 79 20 73 69 6d 70 6c  use a very simpl
0600: 65 20 53 70 61 74 69 61 4c 69 74 65 20 44 42 2c  e SpatiaLite DB,
0610: 20 6a 75 73 74 20 63 6f 6e 74 61 69 6e 69 6e 67   just containing
0620: 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 47   the following G
0630: 65 6f 6d 65 74 72 79 20 74 61 62 6c 65 73 3a 3c  eometry tables:<
0640: 75 6c 3e 0d 0a 3c 6c 69 3e 41 64 6d 69 6e 69 73  ul>..<li>Adminis
0650: 74 72 61 74 69 76 65 20 62 6f 75 6e 64 61 72 69  trative boundari
0660: 65 73 20 66 6f 72 20 49 74 61 6c 79 20 72 65 67  es for Italy reg
0670: 69 6f 6e 73 3a 20 79 6f 75 20 63 61 6e 20 3c 61  ions: you can <a
0680: 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77   href="http://ww
0690: 77 2e 69 73 74 61 74 2e 69 74 2f 69 74 2f 66 69  w.istat.it/it/fi
06a0: 6c 65 73 2f 32 30 31 31 2f 30 34 2f 72 65 67 32  les/2011/04/reg2
06b0: 30 31 31 2e 7a 69 70 22 3e 64 6f 77 6e 6c 6f 61  011.zip">downloa
06c0: 64 3c 2f 61 3e 20 74 68 69 73 20 64 61 74 61 73  d</a> this datas
06d0: 65 74 20 66 72 6f 6d 20 49 53 54 41 54 20 28 72  et from ISTAT (r
06e0: 65 6c 65 61 73 65 64 20 6f 6e 20 43 43 2d 42 59  eleased on CC-BY
06f0: 20 6c 69 63 65 6e 73 65 20 74 65 72 6d 73 29 2e   license terms).
0700: 3c 62 72 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 4d  <br></li>..<li>M
0710: 61 69 6e 20 49 74 61 6c 69 61 6e 20 70 6f 70 75  ain Italian popu
0720: 6c 61 74 65 64 20 70 6c 61 63 65 73 20 28 6e 61  lated places (na
0730: 6d 65 6c 79 2c 20 4c 6f 63 61 6c 20 43 6f 75 6e  mely, Local Coun
0740: 63 69 6c 73 29 3a 20 79 6f 75 20 63 61 6e 20 3c  cils): you can <
0750: 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 64  a href="http://d
0760: 6f 77 6e 6c 6f 61 64 2e 67 65 6f 6e 61 6d 65 73  ownload.geonames
0770: 2e 6f 72 67 2f 65 78 70 6f 72 74 2f 64 75 6d 70  .org/export/dump
0780: 2f 61 6c 6c 43 6f 75 6e 74 72 69 65 73 2e 7a 69  /allCountries.zi
0790: 70 22 3e 64 6f 77 6e 6c 6f 61 64 3c 2f 61 3e 20  p">download</a> 
07a0: 74 68 69 73 20 64 61 74 61 73 65 74 20 66 72 6f  this dataset fro
07b0: 6d 20 47 65 6f 4e 61 6d 65 73 20 28 72 65 6c 65  m GeoNames (rele
07c0: 61 73 65 64 20 6f 6e 20 43 43 2d 42 59 20 6c 69  ased on CC-BY li
07d0: 63 65 6e 73 65 20 74 65 72 6d 73 29 2e 3c 62 72  cense terms).<br
07e0: 3e 0d 0a 50 6c 65 61 73 65 20 6e 6f 74 65 3a 20  >..Please note: 
07f0: 74 68 69 73 20 6f 6e 65 20 69 73 20 61 20 77 6f  this one is a wo
0800: 72 6c 64 77 69 64 65 20 64 61 74 61 73 65 74 3b  rldwide dataset;
0810: 20 69 74 61 6c 69 61 6e 20 70 6f 70 75 6c 61 74   italian populat
0820: 65 64 20 70 6c 61 63 65 73 20 68 61 76 65 20 74  ed places have t
0830: 68 65 6e 20 62 65 65 6e 20 65 78 74 72 61 63 74  hen been extract
0840: 65 64 20 69 6d 70 6f 73 69 6e 67 20 74 68 65 20  ed imposing the 
0850: 53 51 4c 20 63 6c 61 75 73 65 3c 62 72 3e 0d 0a  SQL clause<br>..
0860: 3c 62 3e 57 48 45 52 45 20 63 6f 75 6e 74 79 5f  <b>WHERE county_
0870: 63 6f 64 65 20 3d 20 27 49 54 27 20 41 4e 44 20  code = 'IT' AND 
0880: 70 6f 70 75 6c 61 74 69 6f 6e 20 3e 20 30 3c 2f  population > 0</
0890: 62 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62  b></li>..</ul><b
08a0: 72 3e 0d 0a 4a 75 73 74 20 74 6f 20 6b 65 65 70  r>..Just to keep
08b0: 20 61 6e 79 20 65 78 61 6d 70 6c 65 20 61 73 20   any example as 
08c0: 73 69 6d 70 6c 65 20 61 73 20 70 6f 73 73 69 62  simple as possib
08d0: 6c 65 2c 20 62 6f 74 68 20 64 61 74 61 73 65 74  le, both dataset
08e0: 73 20 68 61 76 65 20 62 65 65 6e 20 72 65 66 65  s have been refe
08f0: 72 65 6e 63 65 64 20 69 6e 74 6f 20 74 68 65 20  renced into the 
0900: 3c 62 3e 53 52 49 44 3d 32 33 30 33 32 20 2d 20  <b>SRID=23032 - 
0910: 45 44 35 30 20 2f 20 55 54 4d 20 7a 6f 6e 65 20  ED50 / UTM zone 
0920: 33 32 20 4e 3c 2f 62 3e 0d 0a 3c 62 72 3e 3c 62  32 N</b>..<br><b
0930: 72 3e 3c 68 72 3e 0d 0a 3c 68 33 3e 43 72 65 61  r><hr>..<h3>Crea
0940: 74 69 6e 67 20 72 65 67 75 6c 61 72 20 74 65 73  ting regular tes
0950: 73 65 6c 6c 61 74 69 6f 6e 73 20 69 6e 20 53 70  sellations in Sp
0960: 61 74 69 61 6c 20 53 51 4c 3c 2f 68 33 3e 0d 0a  atial SQL</h3>..
0970: 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69  <table cellspaci
0980: 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69  ng="4" cellpaddi
0990: 6e 67 3d 22 34 22 3e 0d 0a 3c 74 72 3e 3c 74 64  ng="4">..<tr><td
09a0: 20 63 6f 6c 73 70 61 6e 3d 22 32 22 3e 0d 0a 3c   colspan="2">..<
09b0: 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23  table bgcolor="#
09c0: 66 30 66 30 66 30 22 20 63 65 6c 6c 73 70 61 63  f0f0f0" cellspac
09d0: 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64  ing="4" cellpadd
09e0: 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74  ing="8">..<tr><t
09f0: 64 3e 0d 0a 3c 69 3e 67 65 6e 65 72 69 63 20 70  d>..<i>generic p
0a00: 72 6f 74 6f 74 79 70 65 73 3c 2f 69 3e 3a 3c 68  rototypes</i>:<h
0a10: 72 3e 0d 0a 53 54 5f 78 78 78 78 47 72 69 64 28  r>..ST_xxxxGrid(
0a20: 20 69 6e 70 75 74 20 3c 69 3e 47 65 6f 6d 65 74   input <i>Geomet
0a30: 72 79 3c 2f 69 3e 2c 20 73 69 7a 65 20 3c 69 3e  ry</i>, size <i>
0a40: 64 6f 75 62 6c 65 20 70 72 65 63 69 73 69 6f 6e  double precision
0a50: 3c 2f 69 3e 20 29 20 3a 20 67 72 69 64 20 3c 69  </i> ) : grid <i
0a60: 3e 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 3c 62 72  >Geometry</i><br
0a70: 3e 0d 0a 53 54 5f 78 78 78 78 47 72 69 64 28 20  >..ST_xxxxGrid( 
0a80: 69 6e 70 75 74 20 3c 69 3e 47 65 6f 6d 65 74 72  input <i>Geometr
0a90: 79 3c 2f 69 3e 2c 20 73 69 7a 65 20 3c 69 3e 64  y</i>, size <i>d
0aa0: 6f 75 62 6c 65 20 70 72 65 63 69 73 69 6f 6e 3c  ouble precision<
0ab0: 2f 69 3e 2c 20 65 64 67 65 73 5f 6f 6e 6c 79 20  /i>, edges_only 
0ac0: 3c 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20 29  <i>boolean</i> )
0ad0: 20 3a 20 67 72 69 64 20 3c 69 3e 47 65 6f 6d 65   : grid <i>Geome
0ae0: 74 72 79 3c 2f 69 3e 3c 62 72 3e 0d 0a 53 54 5f  try</i><br>..ST_
0af0: 78 78 78 78 47 72 69 64 28 20 69 6e 70 75 74 20  xxxxGrid( input 
0b00: 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 2c  <i>Geometry</i>,
0b10: 20 73 69 7a 65 20 3c 69 3e 64 6f 75 62 6c 65 20   size <i>double 
0b20: 70 72 65 63 69 73 69 6f 6e 3c 2f 69 3e 2c 20 65  precision</i>, e
0b30: 64 67 65 73 5f 6f 6e 6c 79 20 3c 69 3e 62 6f 6f  dges_only <i>boo
0b40: 6c 65 61 6e 3c 2f 69 3e 2c 20 6f 72 69 67 69 6e  lean</i>, origin
0b50: 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f 69 3e   <i>Geometry</i>
0b60: 20 29 20 3a 20 67 72 69 64 20 3c 69 3e 47 65 6f   ) : grid <i>Geo
0b70: 6d 65 74 72 79 3c 2f 69 3e 0d 0a 3c 2f 74 64 3e  metry</i>..</td>
0b80: 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c  </tr></table>..<
0b90: 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 3c 62 3e  ul>..<li>the <b>
0ba0: 69 6e 70 75 74 3c 2f 62 3e 20 47 65 6f 6d 65 74  input</b> Geomet
0bb0: 72 79 20 69 73 20 61 6c 77 61 79 73 20 65 78 70  ry is always exp
0bc0: 65 63 74 65 64 20 74 6f 20 62 65 20 61 20 50 6f  ected to be a Po
0bd0: 6c 79 67 6f 6e 20 6f 72 20 61 20 4d 75 6c 74 69  lygon or a Multi
0be0: 50 6f 6c 79 67 6f 6e 2c 20 61 6e 64 20 77 69 6c  Polygon, and wil
0bf0: 6c 20 62 65 20 65 78 61 63 74 6c 79 20 63 6f 76  l be exactly cov
0c00: 65 72 65 64 20 62 79 20 74 68 65 20 72 65 74 75  ered by the retu
0c10: 72 6e 65 64 20 67 72 69 64 2e 3c 2f 6c 69 3e 0d  rned grid.</li>.
0c20: 0a 3c 6c 69 3e 74 68 65 20 3c 62 3e 73 69 7a 65  .<li>the <b>size
0c30: 3c 2f 62 3e 20 61 72 67 75 6d 65 6e 74 20 69 64  </b> argument id
0c40: 65 6e 74 69 66 69 65 73 20 74 68 65 20 65 64 67  entifies the edg
0c50: 65 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20  e length of the 
0c60: 67 72 69 64 20 63 65 6c 6c 2e 3c 2f 6c 69 3e 0d  grid cell.</li>.
0c70: 0a 3c 6c 69 3e 74 68 65 20 6f 70 74 69 6f 6e 61  .<li>the optiona
0c80: 6c 20 3c 62 3e 65 64 67 65 73 5f 6f 6e 6c 79 3c  l <b>edges_only<
0c90: 2f 62 3e 20 61 72 67 75 6d 65 6e 74 20 77 69 6c  /b> argument wil
0ca0: 6c 20 62 65 20 69 6e 74 65 72 70 72 65 74 65 64  l be interpreted
0cb0: 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 3c 75 6c 3e   as follows:<ul>
0cc0: 0d 0a 3c 6c 69 3e 69 66 20 3c 62 3e 46 41 4c 53  ..<li>if <b>FALS
0cd0: 45 3c 2f 62 3e 20 28 3c 69 3e 64 65 66 61 75 6c  E</b> (<i>defaul
0ce0: 74 20 76 61 6c 75 65 3c 2f 69 3e 29 20 61 20 4d  t value</i>) a M
0cf0: 75 6c 74 69 50 6f 6c 79 67 6f 6e 20 77 69 6c 6c  ultiPolygon will
0d00: 20 62 65 20 72 65 74 75 72 6e 65 64 2e 3c 2f 6c   be returned.</l
0d10: 69 3e 0d 0a 3c 6c 69 3e 69 66 20 3c 62 3e 54 52  i>..<li>if <b>TR
0d20: 55 45 3c 2f 62 3e 20 61 20 4d 75 6c 74 69 4c 69  UE</b> a MultiLi
0d30: 6e 65 73 74 72 69 6e 67 20 77 69 6c 6c 20 62 65  nestring will be
0d40: 20 72 65 74 75 72 6e 65 64 20 28 73 69 6d 70 6c   returned (simpl
0d50: 79 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74  y representing t
0d60: 68 65 20 63 65 6c 6c 73 20 65 64 67 65 73 29 2e  he cells edges).
0d70: 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69  </li>..</ul></li
0d80: 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6f 70 74 69 6f  >..<li>the optio
0d90: 6e 61 6c 20 3c 62 3e 6f 72 69 67 69 6e 3c 2f 62  nal <b>origin</b
0da0: 3e 20 47 65 6f 6d 65 74 72 79 20 69 73 20 61 6c  > Geometry is al
0db0: 77 61 79 73 20 61 73 73 75 6d 65 64 20 74 6f 20  ways assumed to 
0dc0: 62 65 20 61 20 50 6f 69 6e 74 2c 20 61 6e 64 20  be a Point, and 
0dd0: 77 69 6c 6c 20 69 64 65 6e 74 69 66 79 20 74 68  will identify th
0de0: 65 20 67 72 69 64 27 73 20 6f 72 69 67 69 6e 2e  e grid's origin.
0df0: 0d 0a 42 79 20 64 65 66 61 75 6c 74 20 61 20 3c  ..By default a <
0e00: 62 3e 28 30 2c 20 30 29 3c 2f 62 3e 20 6f 72 69  b>(0, 0)</b> ori
0e10: 67 69 6e 20 77 69 6c 6c 20 62 65 20 61 73 73 75  gin will be assu
0e20: 6d 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  med.</li>..</ul>
0e30: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e  </td></tr>..<tr>
0e40: 3c 74 64 3e 0d 0a 3c 68 34 3e 75 73 69 6e 67 20  <td>..<h4>using 
0e50: 53 71 75 61 72 65 20 63 65 6c 6c 73 3c 2f 68 34  Square cells</h4
0e60: 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f  >..<table bgcolo
0e70: 72 3d 22 23 66 30 66 30 66 30 22 20 63 65 6c 6c  r="#f0f0f0" cell
0e80: 73 70 61 63 69 6e 67 3d 22 34 22 20 63 65 6c 6c  spacing="4" cell
0e90: 70 61 64 64 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74  padding="8">..<t
0ea0: 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 53 45 4c 45 43  r><td>..<b>SELEC
0eb0: 54 20 53 54 5f 53 71 75 61 72 65 47 72 69 64 28  T ST_SquareGrid(
0ec0: 67 65 6f 6d 65 74 72 79 2c 20 31 30 30 30 30 29  geometry, 10000)
0ed0: 3c 62 72 3e 0d 0a 46 52 4f 4d 20 72 65 67 69 6f  <br>..FROM regio
0ee0: 6e 73 3c 62 72 3e 57 48 45 52 45 20 63 6f 64 5f  ns<br>WHERE cod_
0ef0: 72 65 67 20 3d 20 39 3b 3c 2f 62 3e 0d 0a 3c 2f  reg = 9;</b>..</
0f00: 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c  td></tr>..</tabl
0f10: 65 3e 3c 62 72 3e 0d 0a 54 68 69 73 20 53 51 4c  e><br>..This SQL
0f20: 20 71 75 65 72 79 20 77 69 6c 6c 20 72 65 74 75   query will retu
0f30: 72 6e 20 61 20 72 65 67 75 6c 61 72 20 67 72 69  rn a regular gri
0f40: 64 20 28 73 71 75 61 72 65 20 63 65 6c 6c 73 29  d (square cells)
0f50: 20 63 6f 76 65 72 69 6e 67 20 54 75 73 63 61 6e   covering Tuscan
0f60: 79 20 28 3c 62 3e 63 6f 64 5f 72 65 67 3d 39 3c  y (<b>cod_reg=9<
0f70: 2f 62 3e 29 2e 3c 62 72 3e 0d 0a 45 61 63 68 20  /b>).<br>..Each 
0f80: 67 72 69 64 27 73 20 63 65 6c 6c 20 77 69 6c 6c  grid's cell will
0f90: 20 68 61 76 65 20 61 6e 20 65 64 67 65 20 6c 65   have an edge le
0fa0: 6e 67 74 68 20 6f 66 20 65 78 61 63 74 6c 79 20  ngth of exactly 
0fb0: 3c 62 3e 31 30 20 4b 6d 3c 2f 62 3e 0d 0a 3c 2f  <b>10 Km</b>..</
0fc0: 74 64 3e 0d 0a 3c 74 64 3e 3c 69 6d 67 20 62 6f  td>..<td><img bo
0fd0: 72 64 65 72 3d 22 31 22 20 73 72 63 3d 22 68 74  rder="1" src="ht
0fe0: 74 70 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69  tp://www.gaia-gi
0ff0: 73 2e 69 74 2f 67 61 69 61 2d 73 69 6e 73 2f 77  s.it/gaia-sins/w
1000: 72 69 74 65 2d 76 69 65 77 2d 70 69 63 73 2f 73  rite-view-pics/s
1010: 71 75 61 72 65 2d 67 72 69 64 2e 70 6e 67 22 20  quare-grid.png" 
1020: 61 6c 74 3d 22 73 71 75 61 72 65 20 67 72 69 64  alt="square grid
1030: 22 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74  "></td></tr>..<t
1040: 72 3e 3c 74 64 3e 0d 0a 3c 68 34 3e 75 73 69 6e  r><td>..<h4>usin
1050: 67 20 54 72 69 61 6e 67 75 6c 61 72 20 63 65 6c  g Triangular cel
1060: 6c 73 3c 2f 68 34 3e 0d 0a 3c 74 61 62 6c 65 20  ls</h4>..<table 
1070: 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 30  bgcolor="#f0f0f0
1080: 22 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 34  " cellspacing="4
1090: 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 38  " cellpadding="8
10a0: 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62  ">..<tr><td>..<b
10b0: 3e 53 45 4c 45 43 54 20 53 54 5f 54 72 69 61 6e  >SELECT ST_Trian
10c0: 67 75 6c 61 72 47 72 69 64 28 67 65 6f 6d 65 74  gularGrid(geomet
10d0: 72 79 2c 20 31 30 30 30 30 29 3c 62 72 3e 0d 0a  ry, 10000)<br>..
10e0: 46 52 4f 4d 20 72 65 67 69 6f 6e 73 3c 62 72 3e  FROM regions<br>
10f0: 57 48 45 52 45 20 63 6f 64 5f 72 65 67 20 3d 20  WHERE cod_reg = 
1100: 39 3b 3c 2f 62 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74  9;</b>..</td></t
1110: 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 3c 2f 74 64  r>..</table></td
1120: 3e 0d 0a 3c 74 64 3e 3c 69 6d 67 20 62 6f 72 64  >..<td><img bord
1130: 65 72 3d 22 31 22 20 73 72 63 3d 22 68 74 74 70  er="1" src="http
1140: 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e  ://www.gaia-gis.
1150: 69 74 2f 67 61 69 61 2d 73 69 6e 73 2f 77 72 69  it/gaia-sins/wri
1160: 74 65 2d 76 69 65 77 2d 70 69 63 73 2f 74 72 69  te-view-pics/tri
1170: 2d 67 72 69 64 2e 70 6e 67 22 20 61 6c 74 3d 22  -grid.png" alt="
1180: 74 72 69 61 6e 67 75 6c 61 72 20 67 72 69 64 22  triangular grid"
1190: 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72  ></td></tr>..<tr
11a0: 3e 3c 74 64 3e 0d 0a 3c 68 34 3e 75 73 69 6e 67  ><td>..<h4>using
11b0: 20 48 65 78 61 67 6f 6e 61 6c 20 63 65 6c 6c 73   Hexagonal cells
11c0: 3c 2f 68 34 3e 0d 0a 3c 74 61 62 6c 65 20 62 67  </h4>..<table bg
11d0: 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 30 22 20  color="#f0f0f0" 
11e0: 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 34 22 20  cellspacing="4" 
11f0: 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 38 22 3e  cellpadding="8">
1200: 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 53  ..<tr><td>..<b>S
1210: 45 4c 45 43 54 20 53 54 5f 48 65 78 61 67 6f 6e  ELECT ST_Hexagon
1220: 61 6c 47 72 69 64 28 67 65 6f 6d 65 74 72 79 2c  alGrid(geometry,
1230: 20 31 30 30 30 30 29 3c 62 72 3e 0d 0a 46 52 4f   10000)<br>..FRO
1240: 4d 20 72 65 67 69 6f 6e 73 3c 62 72 3e 57 48 45  M regions<br>WHE
1250: 52 45 20 63 6f 64 5f 72 65 67 20 3d 20 39 3b 3c  RE cod_reg = 9;<
1260: 2f 62 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d  /b>..</td></tr>.
1270: 0a 3c 2f 74 61 62 6c 65 3e 3c 2f 74 64 3e 0d 0a  .</table></td>..
1280: 3c 74 64 3e 3c 69 6d 67 20 62 6f 72 64 65 72 3d  <td><img border=
1290: 22 31 22 20 73 72 63 3d 22 68 74 74 70 3a 2f 2f  "1" src="http://
12a0: 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f  www.gaia-gis.it/
12b0: 67 61 69 61 2d 73 69 6e 73 2f 77 72 69 74 65 2d  gaia-sins/write-
12c0: 76 69 65 77 2d 70 69 63 73 2f 68 65 78 2d 67 72  view-pics/hex-gr
12d0: 69 64 2e 70 6e 67 22 20 61 6c 74 3d 22 68 65 78  id.png" alt="hex
12e0: 61 67 6f 6e 61 6c 20 67 72 69 64 22 3e 3c 2f 74  agonal grid"></t
12f0: 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65  d></tr>..</table
1300: 3e 0d 0a 3c 62 72 3e 3c 68 72 3e 0d 0a 3c 68 33  >..<br><hr>..<h3
1310: 3e 44 65 6c 61 75 6e 61 79 20 54 72 69 61 6e 67  >Delaunay Triang
1320: 75 6c 61 74 69 6f 6e 73 3c 2f 68 33 3e 0d 0a 54  ulations</h3>..T
1330: 72 69 61 6e 67 75 6c 61 74 69 6f 6e 73 20 73 69  riangulations si
1340: 6d 70 6c 79 20 72 65 70 72 65 73 65 6e 74 20 61  mply represent a
1350: 20 73 70 65 63 69 61 6c 20 63 61 73 65 20 6f 66   special case of
1360: 20 74 65 73 73 65 6c 6c 61 74 69 6f 6e 73 3a 20   tessellations: 
1370: 69 6e 20 74 68 69 73 20 63 61 73 65 20 61 6c 6c  in this case all
1380: 20 63 65 6c 6c 73 20 61 72 65 20 72 65 70 72 65   cells are repre
1390: 73 65 6e 74 65 64 20 62 79 20 67 65 6e 65 72 69  sented by generi
13a0: 63 20 3c 62 3e 74 72 69 61 6e 67 6c 65 73 3c 2f  c <b>triangles</
13b0: 62 3e 2c 20 6e 6f 74 20 6e 65 63 65 73 73 61 72  b>, not necessar
13c0: 69 6c 79 20 6f 66 20 74 68 65 20 65 71 75 69 6c  ily of the equil
13d0: 61 74 65 72 61 6c 20 6b 69 6e 64 2e 3c 62 72 3e  ateral kind.<br>
13e0: 0d 0a 41 20 3c 62 3e 44 65 6c 61 75 6e 61 79 20  ..A <b>Delaunay 
13f0: 54 72 69 61 6e 67 75 6c 61 74 69 6f 6e 3c 2f 62  Triangulation</b
1400: 3e 20 69 73 20 76 65 72 79 20 70 65 63 75 6c 69  > is very peculi
1410: 61 72 20 62 65 63 61 75 73 65 20 61 20 73 70 65  ar because a spe
1420: 63 69 66 69 63 20 63 6f 6e 73 74 72 61 69 6e 74  cific constraint
1430: 20 69 73 20 69 6d 70 6f 73 65 64 2e 3c 62 72 3e   is imposed.<br>
1440: 0d 0a 41 6c 6c 20 74 72 69 61 6e 67 6c 65 73 20  ..All triangles 
1450: 69 6e 20 61 20 44 65 6c 61 75 6e 61 79 20 74 72  in a Delaunay tr
1460: 69 61 6e 67 75 6c 61 74 69 6f 6e 20 6d 75 73 74  iangulation must
1470: 20 73 61 74 69 73 66 79 20 74 68 65 20 3c 75 3e   satisfy the <u>
1480: 3c 69 3e 65 6d 70 74 79 20 63 69 72 63 6c 65 3c  <i>empty circle<
1490: 2f 69 3e 3c 2f 75 3e 20 70 72 6f 70 65 72 74 79  /i></u> property
14a0: 3a 20 69 2e 65 2e 20 66 6f 72 20 65 61 63 68 20  : i.e. for each 
14b0: 65 64 67 65 20 77 65 20 63 61 6e 20 66 69 6e 64  edge we can find
14c0: 20 61 20 63 69 72 63 6c 65 20 63 6f 6e 74 61 69   a circle contai
14d0: 6e 69 6e 67 20 74 68 65 20 65 64 67 65 27 73 20  ning the edge's 
14e0: 65 6e 64 70 6f 69 6e 74 73 20 62 75 74 20 6e 6f  endpoints but no
14f0: 74 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 6e 79  t containing any
1500: 20 6f 74 68 65 72 20 70 6f 69 6e 74 73 2e 0d 0a   other points...
1510: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f  <a href="http://
1520: 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72 67  en.wikipedia.org
1530: 2f 77 69 6b 69 2f 44 65 6c 61 75 6e 61 79 5f 74  /wiki/Delaunay_t
1540: 72 69 61 6e 67 75 6c 61 74 69 6f 6e 22 3e 72 65  riangulation">re
1550: 61 64 20 6d 6f 72 65 3c 2f 61 3e 3c 62 72 3e 3c  ad more</a><br><
1560: 62 72 3e 0d 0a 43 6f 6d 70 75 74 69 6e 67 20 61  br>..Computing a
1570: 20 44 65 6c 61 75 6e 61 79 20 54 72 69 61 6e 67   Delaunay Triang
1580: 75 6c 61 74 69 6f 6e 20 72 65 70 72 65 73 65 6e  ulation represen
1590: 74 69 6e 67 20 6d 61 6e 79 20 70 6f 69 6e 74 73  ting many points
15a0: 20 69 73 20 61 20 76 65 72 79 20 63 6f 6d 70 6c   is a very compl
15b0: 65 78 20 6f 70 65 72 61 74 69 6f 6e 2c 20 61 6e  ex operation, an
15c0: 64 20 6f 6e 65 20 70 6f 73 73 69 62 6c 79 20 69  d one possibly i
15d0: 6d 70 6f 73 69 6e 67 20 61 20 68 75 67 65 20 63  mposing a huge c
15e0: 6f 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6c 6f 61  omputational loa
15f0: 64 20 61 6e 64 20 6d 61 79 20 62 65 20 72 65 71  d and may be req
1600: 75 69 72 69 6e 67 20 61 20 6c 6f 6e 67 20 74 69  uiring a long ti
1610: 6d 65 2e 0d 0a 48 61 70 70 69 6c 79 20 65 6e 6f  me...Happily eno
1620: 75 67 68 20 6d 61 6e 79 20 68 69 67 68 6c 79 20  ugh many highly 
1630: 65 66 66 69 63 69 65 6e 74 20 61 6c 67 6f 72 69  efficient algori
1640: 74 68 6d 73 20 68 61 76 65 20 62 65 65 6e 20 61  thms have been a
1650: 6c 72 65 61 64 79 20 64 65 76 65 6c 6f 70 65 64  lready developed
1660: 20 66 6f 72 20 74 68 65 20 44 65 6c 61 75 6e 61   for the Delauna
1670: 79 20 70 72 6f 62 6c 65 6d 2e 3c 62 72 3e 0d 0a  y problem.<br>..
1680: 54 68 65 20 6e 65 78 74 2d 74 6f 2d 63 6f 6d 65  The next-to-come
1690: 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f   <a href="http:/
16a0: 2f 74 72 61 63 2e 6f 73 67 65 6f 2e 6f 72 67 2f  /trac.osgeo.org/
16b0: 67 65 6f 73 2f 22 3e 47 45 4f 53 20 33 2e 34 2e  geos/">GEOS 3.4.
16c0: 30 3c 2f 61 3e 20 77 69 6c 6c 20 73 75 70 70 6f  0</a> will suppo
16d0: 72 74 20 44 65 6c 61 75 6e 61 79 20 54 72 69 61  rt Delaunay Tria
16e0: 6e 67 75 6c 61 74 69 6f 6e 73 3b 20 74 68 69 73  ngulations; this
16f0: 20 47 45 4f 53 20 76 65 72 73 69 6f 6e 20 69 73   GEOS version is
1700: 20 63 75 72 72 65 6e 74 6c 79 20 73 74 69 6c 6c   currently still
1710: 20 75 6e 64 65 72 20 61 63 74 69 76 65 20 64 65   under active de
1720: 76 65 6c 6f 70 6d 65 6e 74 2c 20 62 75 74 20 74  velopment, but t
1730: 68 65 20 3c 69 3e 65 78 70 65 72 69 6d 65 6e 74  he <i>experiment
1740: 61 6c 3c 2f 69 3e 20 62 61 73 65 2d 63 6f 64 65  al</i> base-code
1750: 20 28 3c 69 3e 74 72 75 6e 6b 3c 2f 69 3e 29 20   (<i>trunk</i>) 
1760: 73 65 65 6d 73 20 74 6f 20 62 65 20 73 74 61 62  seems to be stab
1770: 6c 65 20 65 6e 6f 75 67 68 20 74 6f 20 62 65 20  le enough to be 
1780: 73 61 66 65 6c 79 20 74 65 73 74 65 64 2e 0d 0a  safely tested...
1790: 53 70 61 74 69 61 4c 69 74 65 20 61 6c 72 65 61  SpatiaLite alrea
17a0: 64 79 20 72 65 6c 69 65 73 20 6f 6e 20 47 45 4f  dy relies on GEO
17b0: 53 20 66 6f 72 20 6d 61 6e 79 20 74 61 73 6b 73  S for many tasks
17c0: 2c 20 73 6f 20 69 6e 74 65 67 72 61 74 69 6e 67  , so integrating
17d0: 20 61 20 73 6d 6f 6f 74 68 20 73 75 70 70 6f 72   a smooth suppor
17e0: 74 20 66 6f 72 20 44 65 6c 61 75 6e 61 79 20 54  t for Delaunay T
17f0: 72 69 61 6e 67 75 6c 61 74 69 6f 6e 20 61 73 20  riangulation as 
1800: 77 65 6c 6c 20 77 61 73 6e 27 74 20 61 74 20 61  well wasn't at a
1810: 6c 6c 20 64 69 66 66 69 63 75 6c 74 2e 3c 62 72  ll difficult.<br
1820: 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 67  ><br>..<table bg
1830: 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 30 22 20  color="#f0f0f0" 
1840: 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 34 22 20  cellspacing="4" 
1850: 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 38 22 3e  cellpadding="8">
1860: 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 69 3e 70  ..<tr><td>..<i>p
1870: 72 6f 74 6f 74 79 70 65 3c 2f 69 3e 3a 3c 68 72  rototype</i>:<hr
1880: 3e 0d 0a 53 54 5f 44 65 6c 61 75 6e 61 79 54 72  >..ST_DelaunayTr
1890: 69 61 6e 67 75 6c 61 74 69 6f 6e 28 20 69 6e 70  iangulation( inp
18a0: 75 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f  ut <i>Geometry</
18b0: 69 3e 20 29 20 3a 20 64 65 6c 61 75 6e 61 79 20  i> ) : delaunay 
18c0: 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 3c  <i>Geometry</i><
18d0: 62 72 3e 0d 0a 53 54 5f 44 65 6c 61 75 6e 61 79  br>..ST_Delaunay
18e0: 54 72 69 61 6e 67 75 6c 61 74 69 6f 6e 28 20 69  Triangulation( i
18f0: 6e 70 75 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79  nput <i>Geometry
1900: 3c 2f 69 3e 2c 20 65 64 67 65 73 5f 6f 6e 6c 79  </i>, edges_only
1910: 20 3c 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20   <i>boolean</i> 
1920: 29 20 3a 20 64 65 6c 61 75 6e 61 79 20 3c 69 3e  ) : delaunay <i>
1930: 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 3c 62 72 3e  Geometry</i><br>
1940: 0d 0a 53 54 5f 44 65 6c 61 75 6e 61 79 54 72 69  ..ST_DelaunayTri
1950: 61 6e 67 75 6c 61 74 69 6f 6e 28 20 69 6e 70 75  angulation( inpu
1960: 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f 69  t <i>Geometry</i
1970: 3e 2c 20 65 64 67 65 73 5f 6f 6e 6c 79 20 3c 69  >, edges_only <i
1980: 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 2c 20 74 6f  >boolean</i>, to
1990: 6c 65 72 61 6e 63 65 20 3c 69 3e 64 6f 75 62 6c  lerance <i>doubl
19a0: 65 20 70 72 65 63 69 73 69 6f 6e 3c 2f 69 3e 20  e precision</i> 
19b0: 29 20 3a 20 64 65 6c 61 75 6e 61 79 20 3c 69 3e  ) : delaunay <i>
19c0: 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 0d 0a 3c 2f  Geometry</i>..</
19d0: 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e  td></tr></table>
19e0: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20  ..<ul>..<li>the 
19f0: 3c 62 3e 69 6e 70 75 74 3c 2f 62 3e 20 47 65 6f  <b>input</b> Geo
1a00: 6d 65 74 72 79 20 63 61 6e 20 62 65 20 6f 66 20  metry can be of 
1a10: 61 62 73 6f 6c 75 74 65 6c 79 20 61 72 62 69 74  absolutely arbit
1a20: 72 61 72 79 20 74 79 70 65 3b 20 61 6c 6c 20 4c  rary type; all L
1a30: 69 6e 65 73 74 72 69 6e 67 73 20 61 6e 64 20 2f  inestrings and /
1a40: 20 6f 72 20 50 6f 6c 79 67 6f 77 6e 73 20 77 69   or Polygowns wi
1a50: 6c 6c 20 65 76 65 6e 74 75 61 6c 6c 79 20 62 65  ll eventually be
1a60: 20 64 69 73 73 6f 6c 76 65 64 20 69 6e 74 6f 20   dissolved into 
1a70: 50 6f 69 6e 74 73 20 63 6f 72 72 65 73 70 6f 6e  Points correspon
1a80: 64 69 6e 67 20 74 6f 20 76 65 72 74 69 63 65 73  ding to vertices
1a90: 2e 3c 62 72 3e 0d 0a 53 6f 20 61 66 74 65 72 20  .<br>..So after 
1aa0: 61 6c 6c 20 53 54 5f 44 65 6c 61 75 6e 61 79 54  all ST_DelaunayT
1ab0: 72 69 61 6e 67 75 6c 61 74 69 6f 6e 28 29 20 77  riangulation() w
1ac0: 69 6c 6c 20 61 6c 77 61 79 73 20 70 72 6f 63 65  ill always proce
1ad0: 73 73 20 61 20 4d 75 6c 74 69 50 6f 69 6e 74 2e  ss a MultiPoint.
1ae0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6f  </li>..<li>the o
1af0: 70 74 69 6f 6e 61 6c 20 3c 62 3e 65 64 67 65 73  ptional <b>edges
1b00: 5f 6f 6e 6c 79 3c 2f 62 3e 20 61 72 67 75 6d 65  _only</b> argume
1b10: 6e 74 20 77 69 6c 6c 20 62 65 20 69 6e 74 65 72  nt will be inter
1b20: 70 72 65 74 65 64 20 61 73 20 66 6f 6c 6c 6f 77  preted as follow
1b30: 73 3a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69 66 20 3c  s:<ul>..<li>if <
1b40: 62 3e 46 41 4c 53 45 3c 2f 62 3e 20 28 3c 69 3e  b>FALSE</b> (<i>
1b50: 64 65 66 61 75 6c 74 20 76 61 6c 75 65 3c 2f 69  default value</i
1b60: 3e 29 20 61 20 4d 75 6c 74 69 50 6f 6c 79 67 6f  >) a MultiPolygo
1b70: 6e 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72 6e  n will be return
1b80: 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66  ed.</li>..<li>if
1b90: 20 3c 62 3e 54 52 55 45 3c 2f 62 3e 20 61 20 4d   <b>TRUE</b> a M
1ba0: 75 6c 74 69 4c 69 6e 65 73 74 72 69 6e 67 20 77  ultiLinestring w
1bb0: 69 6c 6c 20 62 65 20 72 65 74 75 72 6e 65 64 20  ill be returned 
1bc0: 28 73 69 6d 70 6c 79 20 72 65 70 72 65 73 65 6e  (simply represen
1bd0: 74 69 6e 67 20 74 68 65 20 74 72 69 61 6e 67 6c  ting the triangl
1be0: 65 73 20 65 64 67 65 73 29 2e 3c 2f 6c 69 3e 0d  es edges).</li>.
1bf0: 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  .</ul></li>..<li
1c00: 3e 74 68 65 20 6f 70 74 69 6f 6e 61 6c 20 3c 62  >the optional <b
1c10: 3e 74 6f 6c 65 72 61 6e 63 65 3c 2f 62 3e 20 61  >tolerance</b> a
1c20: 72 67 75 6d 65 6e 74 20 69 73 20 69 6e 74 65 6e  rgument is inten
1c30: 64 65 64 20 74 6f 20 6e 6f 72 6d 61 6c 69 7a 65  ded to normalize
1c40: 20 74 68 65 20 69 6e 70 75 74 20 70 6f 69 6e 74   the input point
1c50: 2d 73 65 74 2c 20 73 75 70 70 72 65 73 73 69 6e  -set, suppressin
1c60: 67 20 72 65 70 65 61 74 65 64 20 28 6f 72 20 74  g repeated (or t
1c70: 6f 6f 20 6d 75 63 68 20 63 6c 6f 73 65 29 20 70  oo much close) p
1c80: 6f 69 6e 74 73 2e 0d 0a 42 79 20 64 65 66 61 75  oints...By defau
1c90: 6c 74 20 61 20 3c 62 3e 30 2e 30 3c 2f 62 3e 20  lt a <b>0.0</b> 
1ca0: 74 6f 6c 65 72 61 6e 63 65 20 77 69 6c 6c 20 62  tolerance will b
1cb0: 65 20 61 73 73 75 6d 65 64 2e 3c 2f 6c 69 3e 0d  e assumed.</li>.
1cc0: 0a 3c 2f 75 6c 3e 3c 2f 74 64 3e 3c 2f 74 72 3e  .</ul></td></tr>
1cd0: 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 74 61 62 6c 65  </table>..<table
1ce0: 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 34 22   cellspacing="4"
1cf0: 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 34 22   cellpadding="4"
1d00: 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 74 61  >..<tr><td>..<ta
1d10: 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30  ble bgcolor="#f0
1d20: 66 30 66 30 22 20 63 65 6c 6c 73 70 61 63 69 6e  f0f0" cellspacin
1d30: 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69 6e  g="4" cellpaddin
1d40: 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e  g="8">..<tr><td>
1d50: 0d 0a 3c 62 3e 53 45 4c 45 43 54 20 53 54 5f 44  ..<b>SELECT ST_D
1d60: 65 6c 61 75 6e 61 79 54 72 69 61 6e 67 75 6c 61  elaunayTriangula
1d70: 74 69 6f 6e 28 53 54 5f 43 6f 6c 6c 65 63 74 28  tion(ST_Collect(
1d80: 67 65 6f 6d 65 74 72 79 29 29 3c 62 72 3e 0d 0a  geometry))<br>..
1d90: 46 52 4f 4d 20 69 74 61 6c 79 5f 70 6f 70 75 6c  FROM italy_popul
1da0: 61 74 65 64 5f 70 6c 61 63 65 73 3b 3c 2f 62 3e  ated_places;</b>
1db0: 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f  ..</td></tr>..</
1dc0: 74 61 62 6c 65 3e 3c 62 72 3e 0d 0a 54 68 69 73  table><br>..This
1dd0: 20 53 51 4c 20 71 75 65 72 79 20 77 69 6c 6c 20   SQL query will 
1de0: 72 65 74 75 72 6e 20 61 20 44 65 6c 61 75 6e 61  return a Delauna
1df0: 79 20 54 72 69 61 6e 67 75 6c 61 74 69 6f 6e 20  y Triangulation 
1e00: 62 61 73 65 64 20 6f 6e 20 49 74 61 6c 79 27 73  based on Italy's
1e10: 20 70 6f 70 75 6c 61 74 65 64 20 70 6c 61 63 65   populated place
1e20: 73 20 28 61 62 6f 75 74 20 38 2c 30 30 30 2b 20  s (about 8,000+ 
1e30: 50 6f 69 6e 74 73 29 2e 3c 62 72 3e 0d 0a 54 68  Points).<br>..Th
1e40: 65 20 76 69 73 75 61 6c 20 65 78 61 6d 70 6c 65  e visual example
1e50: 20 73 69 6d 70 6c 79 20 63 6f 76 65 72 73 20 54   simply covers T
1e60: 75 73 63 61 6e 79 2c 20 73 6f 20 74 68 65 20 65  uscany, so the e
1e70: 6e 73 75 72 65 20 61 6e 20 65 61 73 79 20 72 65  nsure an easy re
1e80: 61 64 61 62 69 6c 69 74 79 2e 20 0d 0a 3c 2f 74  adability. ..</t
1e90: 64 3e 0d 0a 3c 74 64 3e 3c 69 6d 67 20 62 6f 72  d>..<td><img bor
1ea0: 64 65 72 3d 22 31 22 20 73 72 63 3d 22 68 74 74  der="1" src="htt
1eb0: 70 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73  p://www.gaia-gis
1ec0: 2e 69 74 2f 67 61 69 61 2d 73 69 6e 73 2f 77 72  .it/gaia-sins/wr
1ed0: 69 74 65 2d 76 69 65 77 2d 70 69 63 73 2f 64 65  ite-view-pics/de
1ee0: 6c 61 75 6e 61 79 2e 70 6e 67 22 20 61 6c 74 3d  launay.png" alt=
1ef0: 22 64 65 6c 61 75 6e 61 79 20 74 72 69 61 6e 67  "delaunay triang
1f00: 75 6c 61 74 69 6f 6e 22 3e 3c 2f 74 64 3e 3c 2f  ulation"></td></
1f10: 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c  tr>..</table>..<
1f20: 62 72 3e 3c 68 72 3e 0d 0a 3c 68 33 3e 56 6f 72  br><hr>..<h3>Vor
1f30: 6f 6e 6f 6a 20 44 69 61 67 72 61 6d 73 3c 2f 68  onoj Diagrams</h
1f40: 33 3e 0d 0a 3c 74 61 62 6c 65 20 63 65 6c 6c 73  3>..<table cells
1f50: 70 61 63 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70  pacing="4" cellp
1f60: 61 64 64 69 6e 67 3d 22 34 22 3e 0d 0a 3c 74 72  adding="4">..<tr
1f70: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74  ><td align="cent
1f80: 65 72 22 3e 3c 69 6d 67 20 62 6f 72 64 65 72 3d  er"><img border=
1f90: 22 31 22 20 73 72 63 3d 22 68 74 74 70 3a 2f 2f  "1" src="http://
1fa0: 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f  www.gaia-gis.it/
1fb0: 67 61 69 61 2d 73 69 6e 73 2f 77 72 69 74 65 2d  gaia-sins/write-
1fc0: 76 69 65 77 2d 70 69 63 73 2f 76 6f 72 6f 6e 6f  view-pics/vorono
1fd0: 6a 2d 31 2e 70 6e 67 22 20 61 6c 74 3d 22 76 6f  j-1.png" alt="vo
1fe0: 72 6f 6e 6f 6a 2d 64 65 6c 61 75 6e 61 79 20 72  ronoj-delaunay r
1ff0: 65 6c 61 74 69 6f 6e 73 68 69 70 22 3e 0d 0a 3c  elationship">..<
2000: 2f 74 64 3e 3c 74 64 3e 0d 0a 54 68 65 20 3c 62  /td><td>..The <b
2010: 3e 56 6f 72 6f 6e 6f 6a 20 44 69 61 67 72 61 6d  >Voronoj Diagram
2020: 3c 2f 62 3e 20 73 69 6d 70 6c 79 20 69 73 20 74  </b> simply is t
2030: 68 65 20 3c 69 3e 3c 75 3e 64 75 61 6c 20 67 72  he <i><u>dual gr
2040: 61 70 68 3c 2f 75 3e 3c 2f 69 3e 20 6f 66 20 74  aph</u></i> of t
2050: 68 65 20 3c 62 3e 44 65 6c 61 75 6e 61 79 20 54  he <b>Delaunay T
2060: 72 69 61 6e 67 75 6c 61 74 69 6f 6e 3c 2f 62 3e  riangulation</b>
2070: 2e 0d 0a 41 20 56 6f 72 6f 6e 6f 6a 20 44 69 61  ...A Voronoj Dia
2080: 67 72 61 6d 20 73 74 69 6c 6c 20 69 73 20 61 20  gram still is a 
2090: 74 65 73 73 65 6c 6c 61 74 69 6f 6e 2c 20 61 6e  tessellation, an
20a0: 64 20 63 65 6c 6c 73 20 69 6e 20 61 20 56 6f 72  d cells in a Vor
20b0: 6f 6e 6f 6a 20 63 61 6e 20 68 61 76 65 20 61 6e  onoj can have an
20c0: 79 20 61 72 62 69 74 72 61 72 79 20 70 6f 6c 79  y arbitrary poly
20d0: 67 6f 6e 61 6c 20 28 69 72 72 65 67 75 6c 61 72  gonal (irregular
20e0: 29 20 73 68 61 70 65 2e 3c 62 72 3e 3c 62 72 3e  ) shape.<br><br>
20f0: 0d 0a 54 68 69 73 20 66 69 67 75 72 65 20 63 6c  ..This figure cl
2100: 65 61 72 6c 79 20 73 68 6f 77 73 20 74 68 65 20  early shows the 
2110: 72 65 6c 61 74 69 6f 6e 20 6a 6f 69 6e 69 6e 67  relation joining
2120: 20 74 68 65 20 44 65 6c 61 75 6e 61 79 20 54 72   the Delaunay Tr
2130: 69 61 6e 67 75 6c 61 74 69 6f 6e 20 61 6e 64 20  iangulation and 
2140: 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e  the correspondin
2150: 67 20 56 6f 72 6f 6e 6f 6a 20 44 69 61 67 72 61  g Voronoj Diagra
2160: 6d 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 45 61 63 68  m.<br><br>..Each
2170: 20 73 69 6e 67 6c 65 20 56 6f 72 6f 6e 6f 6a 27   single Voronoj'
2180: 73 20 63 65 6c 6c 20 69 73 20 6f 62 74 61 69 6e  s cell is obtain
2190: 65 64 20 62 79 20 63 6f 6e 6e 65 63 74 69 6e 67  ed by connecting
21a0: 20 61 6c 6c 20 74 68 65 20 3c 69 3e 63 69 72 63   all the <i>circ
21b0: 75 6d 63 65 6e 74 65 72 73 3c 2f 69 3e 20 6f 66  umcenters</i> of
21c0: 20 61 64 6a 61 63 65 6e 74 20 44 65 6c 61 75 6e   adjacent Delaun
21d0: 61 79 27 73 20 74 72 69 61 6e 67 6c 65 73 3b 20  ay's triangles; 
21e0: 63 6f 6e 73 65 71 75 65 6e 74 6c 79 20 65 61 63  consequently eac
21f0: 68 20 56 6f 72 6f 6e 6f 6a 20 63 65 6c 6c 20 73  h Voronoj cell s
2200: 75 72 65 6c 79 20 63 6f 6e 74 61 69 6e 73 20 6f  urely contains o
2210: 6e 65 20 28 61 6e 64 20 6f 6e 6c 79 20 6f 6e 65  ne (and only one
2220: 29 20 44 65 6c 61 75 6e 61 79 27 73 20 6e 6f 64  ) Delaunay's nod
2230: 65 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68 65 20  e.<br><br>..The 
2240: 63 65 6c 6c 20 69 6e 20 74 68 65 20 56 6f 72 6f  cell in the Voro
2250: 6e 6f 6a 20 44 69 61 67 72 61 6d 20 70 72 65 73  noj Diagram pres
2260: 65 6e 74 73 20 61 6e 20 69 6e 74 65 72 65 73 74  ents an interest
2270: 69 6e 67 20 70 72 6f 70 65 72 74 79 3a 20 61 6c  ing property: al
2280: 6c 20 70 6f 69 6e 74 73 20 66 61 6c 6c 69 6e 67  l points falling
2290: 20 77 69 74 68 69 6e 20 74 68 65 20 73 61 6d 65   within the same
22a0: 20 63 65 6c 6c 20 61 72 65 20 65 6e 73 75 72 65   cell are ensure
22b0: 64 20 74 6f 20 62 65 20 6e 65 61 72 65 73 74 20  d to be nearest 
22c0: 74 6f 20 74 68 65 20 44 65 6c 61 75 6e 61 79 27  to the Delaunay'
22d0: 73 20 6e 6f 64 65 20 70 6c 61 63 65 64 20 6f 6e  s node placed on
22e0: 20 74 68 65 20 63 65 6c 6c 20 69 74 73 65 6c 66   the cell itself
22f0: 20 74 68 61 6e 20 74 6f 20 61 6e 79 20 6f 74 68   than to any oth
2300: 65 72 20 44 65 6c 61 75 6e 61 79 27 73 20 6e 6f  er Delaunay's no
2310: 64 65 20 70 6c 61 63 65 64 20 69 6e 20 61 20 64  de placed in a d
2320: 69 66 66 65 72 65 6e 74 20 63 65 6c 6c 2e 3c 62  ifferent cell.<b
2330: 72 3e 3c 62 72 3e 0d 0a 53 6f 20 74 68 65 20 56  r><br>..So the V
2340: 6f 72 6f 6e 6f 6a 20 44 69 61 67 72 61 6d 20 69  oronoj Diagram i
2350: 73 20 61 20 76 65 72 79 20 65 66 66 65 63 74 69  s a very effecti
2360: 76 65 20 63 6f 6e 63 65 70 74 75 61 6c 20 74 6f  ve conceptual to
2370: 6f 6c 20 61 6c 6c 6f 77 69 6e 67 20 74 6f 20 64  ol allowing to d
2380: 69 76 69 64 65 20 61 6e 20 61 72 62 69 74 72 61  ivide an arbitra
2390: 72 79 20 73 70 61 63 65 20 72 65 67 69 6f 6e 20  ry space region 
23a0: 69 6e 74 6f 20 6d 61 6e 79 20 3c 69 3e 72 61 74  into many <i>rat
23b0: 69 6f 6e 61 6c 6c 79 20 64 65 66 69 6e 65 64 3c  ionally defined<
23c0: 2f 69 3e 20 63 65 6c 6c 73 2c 20 61 6e 64 20 69  /i> cells, and i
23d0: 73 20 74 68 75 73 20 77 69 64 65 6c 79 20 75 73  s thus widely us
23e0: 65 64 20 6f 6e 20 6d 61 6e 79 20 61 70 70 6c 69  ed on many appli
23f0: 63 61 74 69 76 65 20 66 69 65 6c 64 73 20 62 61  cative fields ba
2400: 73 65 64 20 6f 6e 20 43 6f 6d 70 75 74 61 74 69  sed on Computati
2410: 6f 6e 61 6c 20 47 65 6f 6d 65 74 72 79 2e 0d 0a  onal Geometry...
2420: 54 68 69 73 20 6f 62 76 69 6f 75 73 6c 79 20 69  This obviously i
2430: 6e 63 6c 75 64 69 6e 67 20 47 65 6f 67 72 61 70  ncluding Geograp
2440: 68 79 20 69 74 73 65 6c 66 2e 3c 62 72 3e 3c 62  hy itself.<br><b
2450: 72 3e 0d 0a 3c 61 20 68 72 65 66 3d 22 68 74 74  r>..<a href="htt
2460: 70 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 64 69 61  p://en.wikipedia
2470: 2e 6f 72 67 2f 77 69 6b 69 2f 56 6f 72 6f 6e 6f  .org/wiki/Vorono
2480: 69 5f 74 65 73 73 65 6c 6c 61 74 69 6f 6e 22 3e  i_tessellation">
2490: 72 65 61 64 20 6d 6f 72 65 3c 2f 61 3e 0d 0a 3c  read more</a>..<
24a0: 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c  /td></tr>..<tr><
24b0: 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72  td align="center
24c0: 22 3e 0d 0a 3c 69 6d 67 20 62 6f 72 64 65 72 3d  ">..<img border=
24d0: 22 31 22 20 73 72 63 3d 22 68 74 74 70 3a 2f 2f  "1" src="http://
24e0: 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f  www.gaia-gis.it/
24f0: 67 61 69 61 2d 73 69 6e 73 2f 77 72 69 74 65 2d  gaia-sins/write-
2500: 76 69 65 77 2d 70 69 63 73 2f 76 6f 72 6f 6e 6f  view-pics/vorono
2510: 6a 2d 6f 70 65 6e 2e 70 6e 67 22 20 61 6c 74 3d  j-open.png" alt=
2520: 22 76 6f 72 6f 6e 6f 6a 20 6f 70 65 6e 22 3e 20  "voronoj open"> 
2530: 0d 0a 3c 2f 74 64 3e 3c 74 64 3e 0d 0a 3c 75 3e  ..</td><td>..<u>
2540: 50 6c 65 61 73 65 20 6e 6f 74 65 3c 2f 75 3e 3a  Please note</u>:
2550: 20 61 6e 79 20 56 6f 72 6f 6e 6f 6a 20 44 69 61   any Voronoj Dia
2560: 67 72 61 6d 20 77 69 6c 6c 20 61 6c 77 61 79 73  gram will always
2570: 20 70 72 65 73 65 6e 74 20 61 6e 20 75 6e 70 6c   present an unpl
2580: 65 61 73 61 6e 74 20 63 6f 6d 70 6c 69 63 61 74  easant complicat
2590: 69 6f 6e 3b 20 77 68 65 6e 20 72 65 61 63 68 69  ion; when reachi
25a0: 6e 67 20 74 68 65 20 65 78 74 65 72 69 6f 72 20  ng the exterior 
25b0: 62 6f 75 6e 64 61 72 79 20 6f 66 20 74 68 65 20  boundary of the 
25c0: 69 6e 70 75 74 20 70 6f 69 6e 74 2d 73 65 74 2c  input point-set,
25d0: 20 74 68 65 72 65 20 61 72 65 6e 27 74 20 65 6e   there aren't en
25e0: 6f 75 67 68 20 70 6f 69 6e 74 73 20 61 6c 6c 6f  ough points allo
25f0: 77 69 6e 67 20 74 6f 20 70 72 6f 70 65 72 6c 79  wing to properly
2600: 20 63 6c 6f 73 65 20 61 20 63 65 6c 6c 2e 3c 62   close a cell.<b
2610: 72 3e 0d 0a 41 6e 64 20 63 6f 6e 73 65 71 75 65  r>..And conseque
2620: 6e 74 6c 79 20 6d 61 6e 79 20 63 65 6c 6c 73 20  ntly many cells 
2630: 6c 61 79 69 6e 67 20 6e 65 61 72 20 74 6f 20 74  laying near to t
2640: 68 65 20 65 78 74 65 72 69 6f 72 20 62 6f 75 6e  he exterior boun
2650: 64 61 72 79 20 61 63 74 75 61 6c 6c 79 20 61 72  dary actually ar
2660: 65 20 3c 69 3e 6f 70 65 6e 20 63 65 6c 6c 73 3c  e <i>open cells<
2670: 2f 69 3e 2c 20 70 72 65 73 65 6e 74 69 6e 67 20  /i>, presenting 
2680: 65 64 67 65 73 20 67 6f 69 6e 67 20 64 69 72 65  edges going dire
2690: 63 74 6c 79 20 74 6f 20 74 68 65 20 3c 69 3e 69  ctly to the <i>i
26a0: 6e 66 69 6e 69 74 65 3c 2f 69 3e 2e 3c 62 72 3e  nfinite</i>.<br>
26b0: 3c 62 72 3e 0d 0a 54 68 65 20 64 69 72 65 63 74  <br>..The direct
26c0: 69 6f 6e 73 20 6f 66 20 73 75 63 68 20 65 64 67  ions of such edg
26d0: 65 73 20 61 72 65 20 61 62 73 6f 6c 75 74 65 6c  es are absolutel
26e0: 79 20 77 65 6c 6c 20 64 65 74 65 72 6d 69 6e 65  y well determine
26f0: 64 3b 20 62 75 74 20 61 73 73 69 67 6e 69 6e 67  d; but assigning
2700: 20 74 68 65 6d 20 61 20 66 69 6e 69 74 65 20 6c   them a finite l
2710: 65 6e 67 74 68 20 69 73 6e 27 74 20 61 6c 6c 6f  ength isn't allo
2720: 77 65 64 20 61 74 20 61 6c 6c 2e 20 41 6e 64 20  wed at all. And 
2730: 63 6f 6e 73 65 71 75 65 6e 74 6c 79 20 69 73 6e  consequently isn
2740: 27 74 20 70 6f 73 73 69 62 6c 65 20 64 65 66 69  't possible defi
2750: 6e 69 6e 67 20 61 20 70 6f 6c 79 67 6f 6e 20 72  ning a polygon r
2760: 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 65 73  epresenting thes
2770: 65 20 63 65 6c 6c 73 2e 3c 62 72 3e 3c 62 72 3e  e cells.<br><br>
2780: 0d 0a 54 68 69 73 20 66 69 67 75 72 65 20 73 68  ..This figure sh
2790: 6f 77 73 20 61 20 6c 69 6d 69 74 65 64 20 56 6f  ows a limited Vo
27a0: 72 6f 6e 6f 6a 20 44 69 61 67 72 61 6d 20 61 6c  ronoj Diagram al
27b0: 77 61 79 73 20 62 61 73 65 64 20 6f 6e 20 74 68  ways based on th
27c0: 65 20 73 61 6d 65 20 64 61 74 61 73 65 74 20 61  e same dataset a
27d0: 73 20 61 62 6f 76 65 2c 20 62 75 74 20 74 68 69  s above, but thi
27e0: 73 20 74 69 6d 65 20 69 6e 63 6c 75 64 69 6e 67  s time including
27f0: 20 6f 6e 6c 79 20 50 6f 70 75 6c 61 74 65 64 20   only Populated 
2800: 50 6c 61 63 65 73 20 6c 61 79 69 6e 67 20 6f 6e  Places laying on
2810: 20 74 68 65 20 49 73 6c 61 6e 64 20 6f 66 20 45   the Island of E
2820: 6c 62 61 2e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e  lba...</td></tr>
2830: 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d  ..<tr><td align=
2840: 22 63 65 6e 74 65 72 22 3e 0d 0a 3c 69 6d 67 20  "center">..<img 
2850: 62 6f 72 64 65 72 3d 22 31 22 20 73 72 63 3d 22  border="1" src="
2860: 68 74 74 70 3a 2f 2f 77 77 77 2e 67 61 69 61 2d  http://www.gaia-
2870: 67 69 73 2e 69 74 2f 67 61 69 61 2d 73 69 6e 73  gis.it/gaia-sins
2880: 2f 77 72 69 74 65 2d 76 69 65 77 2d 70 69 63 73  /write-view-pics
2890: 2f 76 6f 72 6f 6e 6f 6a 2d 66 72 61 6d 65 2e 70  /voronoj-frame.p
28a0: 6e 67 22 20 61 6c 74 3d 22 76 6f 72 6f 6e 6f 6a  ng" alt="voronoj
28b0: 20 66 72 61 6d 65 22 3e 20 0d 0a 3c 2f 74 64 3e   frame"> ..</td>
28c0: 3c 74 64 3e 0d 0a 41 6e 79 77 61 79 20 77 65 20  <td>..Anyway we 
28d0: 63 61 6e 20 75 73 65 66 75 6c 6c 79 20 61 70 70  can usefully app
28e0: 6c 79 20 61 20 3c 69 3e 74 72 69 63 6b 3c 2f 69  ly a <i>trick</i
28f0: 3e 20 65 66 66 65 63 74 69 76 65 6c 79 20 61 6c  > effectively al
2900: 6c 6f 77 69 6e 67 20 74 6f 20 65 6e 73 75 72 65  lowing to ensure
2910: 20 74 68 61 74 20 61 6c 6c 20 63 65 6c 6c 73 20   that all cells 
2920: 69 6e 20 61 20 56 6f 72 6f 6e 6f 6a 20 77 69 6c  in a Voronoj wil
2930: 6c 20 62 65 20 70 72 6f 70 65 72 6c 79 20 3c 69  l be properly <i
2940: 3e 63 6c 6f 73 65 64 3c 2f 69 3e 2e 3c 62 72 3e  >closed</i>.<br>
2950: 3c 62 72 3e 0d 0a 57 65 20 73 69 6d 70 6c 79 20  <br>..We simply 
2960: 68 61 76 65 20 74 6f 20 63 6f 6e 73 74 72 61 69  have to constrai
2970: 6e 20 74 68 65 20 56 6f 72 6f 6e 6f 6a 20 44 69  n the Voronoj Di
2980: 61 67 72 61 6d 20 77 69 74 68 69 6e 20 61 20 72  agram within a r
2990: 65 63 74 61 6e 67 75 6c 61 72 20 66 72 61 6d 65  ectangular frame
29a0: 20 6f 66 20 61 72 62 69 74 72 61 72 79 20 73 69   of arbitrary si
29b0: 7a 65 2c 20 74 68 65 6e 20 63 6f 6d 70 75 74 69  ze, then computi
29c0: 6e 67 20 74 68 65 20 69 6e 74 65 72 73 65 63 74  ng the intersect
29d0: 69 6f 6e 73 20 62 65 74 77 65 65 6e 20 69 6e 66  ions between inf
29e0: 69 6e 69 74 65 20 6c 69 6e 65 73 20 61 6e 64 20  inite lines and 
29f0: 74 68 65 20 66 72 61 6d 65 20 69 74 73 65 6c 66  the frame itself
2a00: 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68 69 73 20  .<br><br>..This 
2a10: 66 69 67 75 72 65 20 73 68 6f 77 73 20 74 68 65  figure shows the
2a20: 20 73 61 6d 65 20 56 6f 72 6f 6e 6f 6a 20 61 73   same Voronoj as
2a30: 20 62 65 66 6f 72 65 2c 20 74 68 69 73 20 74 69   before, this ti
2a40: 6d 65 20 6f 70 70 6f 72 74 75 6e 65 6c 79 20 66  me opportunely f
2a50: 72 61 6d 65 64 3b 20 61 73 20 79 6f 75 20 63 61  ramed; as you ca
2a60: 6e 20 65 61 73 69 6c 79 20 6e 6f 74 69 63 65 2c  n easily notice,
2a70: 20 6e 6f 77 20 61 6c 6c 20 63 65 6c 6c 73 20 61   now all cells a
2a80: 72 65 20 73 75 72 65 6c 79 20 63 6c 6f 73 65 64  re surely closed
2a90: 20 61 6e 64 20 63 61 6e 20 62 65 20 73 61 66 65   and can be safe
2aa0: 6c 79 20 62 65 20 72 65 70 72 65 73 65 6e 74 65  ly be represente
2ab0: 64 20 62 79 20 61 20 77 65 6c 6c 20 64 65 66 69  d by a well defi
2ac0: 6e 65 64 20 70 6f 6c 79 67 6f 6e 2e 3c 62 72 3e  ned polygon.<br>
2ad0: 3c 62 72 3e 0d 0a 54 68 65 20 73 69 7a 65 20 28  <br>..The size (
2ae0: 61 6b 61 20 65 78 74 65 6e 74 29 20 6f 66 20 74  aka extent) of t
2af0: 68 65 20 66 72 61 6d 65 20 69 73 20 61 62 73 6f  he frame is abso
2b00: 6c 75 74 65 6c 79 20 61 72 62 69 74 72 61 72 79  lutely arbitrary
2b10: 2c 20 61 6e 64 20 63 61 6e 20 62 65 20 66 72 65  , and can be fre
2b20: 65 6c 79 20 73 65 74 20 61 73 20 79 6f 75 20 77  ely set as you w
2b30: 69 73 68 20 62 65 74 74 65 72 20 61 63 63 6f 72  ish better accor
2b40: 64 69 6e 67 6c 79 20 74 6f 20 79 6f 75 72 20 73  dingly to your s
2b50: 70 65 63 69 66 69 63 20 72 65 71 75 69 72 65 6d  pecific requirem
2b60: 65 6e 74 73 2e 3c 62 72 3e 0d 0a 3c 75 3e 50 6c  ents.<br>..<u>Pl
2b70: 65 61 73 65 20 6e 6f 74 69 63 65 3c 2f 75 3e 3a  ease notice</u>:
2b80: 20 74 68 65 20 62 6c 75 65 20 61 6e 64 20 74 68   the blue and th
2b90: 65 20 72 65 64 20 66 72 61 6d 65 20 68 61 76 65  e red frame have
2ba0: 20 61 20 73 74 72 6f 6e 67 6c 79 20 64 69 66 66   a strongly diff
2bb0: 65 72 65 6e 74 20 65 78 74 65 6e 74 2c 20 62 75  erent extent, bu
2bc0: 74 20 62 6f 74 68 20 74 68 65 6d 20 68 61 76 65  t both them have
2bd0: 20 74 68 65 20 73 61 6d 65 20 69 64 65 6e 74 69   the same identi
2be0: 63 61 6c 20 6f 76 65 72 61 6c 6c 20 73 68 61 70  cal overall shap
2bf0: 65 2e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a  e...</td></tr>..
2c00: 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 61 20 68 72 65  </table>..<a hre
2c10: 66 3d 22 68 74 74 70 3a 2f 2f 74 72 61 63 2e 6f  f="http://trac.o
2c20: 73 67 65 6f 2e 6f 72 67 2f 67 65 6f 73 2f 22 3e  sgeo.org/geos/">
2c30: 47 45 4f 53 20 33 2e 34 2e 30 3c 2f 61 3e 20 77  GEOS 3.4.0</a> w
2c40: 69 6c 6c 20 6e 6f 74 20 64 69 72 65 63 74 6c 79  ill not directly
2c50: 20 73 75 70 70 6f 72 74 20 56 6f 72 6f 6e 6f 6a   support Voronoj
2c60: 3b 20 73 6f 20 74 68 65 20 53 70 61 74 69 61 4c  ; so the SpatiaL
2c70: 69 74 65 20 6f 77 6e 20 73 75 70 70 6f 72 74 20  ite own support 
2c80: 69 73 20 62 61 73 65 64 20 6f 6e 20 61 6e 20 6f  is based on an o
2c90: 72 69 67 69 6e 61 6c 20 69 6d 70 6c 65 6d 65 6e  riginal implemen
2ca0: 74 61 74 69 6f 6e 20 28 62 61 73 65 64 20 69 6e  tation (based in
2cb0: 20 74 75 72 6e 20 6f 6e 20 74 68 65 20 44 65 6c   turn on the Del
2cc0: 61 75 6e 61 79 20 73 75 70 70 6f 72 74 20 6d 61  aunay support ma
2cd0: 64 65 20 61 76 61 69 6c 61 62 6c 65 20 62 79 20  de available by 
2ce0: 47 45 4f 53 29 2e 3c 62 72 3e 3c 62 72 3e 0d 0a  GEOS).<br><br>..
2cf0: 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22  <table bgcolor="
2d00: 23 66 30 66 30 66 30 22 20 63 65 6c 6c 73 70 61  #f0f0f0" cellspa
2d10: 63 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64  cing="4" cellpad
2d20: 64 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c  ding="8">..<tr><
2d30: 74 64 3e 0d 0a 3c 69 3e 70 72 6f 74 6f 74 79 70  td>..<i>prototyp
2d40: 65 3c 2f 69 3e 3a 3c 68 72 3e 0d 0a 53 54 5f 56  e</i>:<hr>..ST_V
2d50: 6f 72 6f 6e 6f 6a 44 69 61 67 72 61 6d 28 20 69  oronojDiagram( i
2d60: 6e 70 75 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79  nput <i>Geometry
2d70: 3c 2f 69 3e 20 29 20 3a 20 76 6f 72 6f 6e 6f 6a  </i> ) : voronoj
2d80: 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f 69 3e   <i>Geometry</i>
2d90: 3c 62 72 3e 0d 0a 53 54 5f 56 6f 72 6f 6e 6f 6a  <br>..ST_Voronoj
2da0: 44 69 61 67 72 61 6d 28 20 69 6e 70 75 74 20 3c  Diagram( input <
2db0: 69 3e 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 2c 20  i>Geometry</i>, 
2dc0: 65 64 67 65 73 5f 6f 6e 6c 79 20 3c 69 3e 62 6f  edges_only <i>bo
2dd0: 6f 6c 65 61 6e 3c 2f 69 3e 20 29 20 3a 20 76 6f  olean</i> ) : vo
2de0: 72 6f 6e 6f 6a 20 3c 69 3e 47 65 6f 6d 65 74 72  ronoj <i>Geometr
2df0: 79 3c 2f 69 3e 3c 62 72 3e 0d 0a 53 54 5f 56 6f  y</i><br>..ST_Vo
2e00: 72 6f 6e 6f 6a 44 69 61 67 72 61 6d 28 20 69 6e  ronojDiagram( in
2e10: 70 75 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c  put <i>Geometry<
2e20: 2f 69 3e 2c 20 65 64 67 65 73 5f 6f 6e 6c 79 20  /i>, edges_only 
2e30: 3c 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 2c 20  <i>boolean</i>, 
2e40: 65 78 74 72 61 5f 66 72 61 6d 65 5f 73 69 7a 65  extra_frame_size
2e50: 20 3c 69 3e 64 6f 75 62 6c 65 20 70 72 65 63 69   <i>double preci
2e60: 73 69 6f 6e 3c 2f 69 3e 20 29 20 3a 20 76 6f 72  sion</i> ) : vor
2e70: 6f 6e 6f 6a 20 3c 69 3e 47 65 6f 6d 65 74 72 79  onoj <i>Geometry
2e80: 3c 2f 69 3e 3c 62 72 3e 0d 0a 53 54 5f 56 6f 72  </i><br>..ST_Vor
2e90: 6f 6e 6f 6a 44 69 61 67 72 61 6d 28 20 69 6e 70  onojDiagram( inp
2ea0: 75 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f  ut <i>Geometry</
2eb0: 69 3e 2c 20 65 64 67 65 73 5f 6f 6e 6c 79 20 3c  i>, edges_only <
2ec0: 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 2c 20 65  i>boolean</i>, e
2ed0: 78 74 72 61 5f 66 72 61 6d 65 5f 73 69 7a 65 20  xtra_frame_size 
2ee0: 3c 69 3e 64 6f 75 62 6c 65 20 70 72 65 63 69 73  <i>double precis
2ef0: 69 6f 6e 3c 2f 69 3e 2c 20 74 6f 6c 65 72 61 6e  ion</i>, toleran
2f00: 63 65 20 3c 69 3e 64 6f 75 62 6c 65 20 70 72 65  ce <i>double pre
2f10: 63 69 73 69 6f 6e 3c 2f 69 3e 20 29 20 3a 20 76  cision</i> ) : v
2f20: 6f 72 6f 6e 6f 6a 20 3c 69 3e 47 65 6f 6d 65 74  oronoj <i>Geomet
2f30: 72 79 3c 2f 69 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74  ry</i>..</td></t
2f40: 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 75 6c 3e  r></table>..<ul>
2f50: 0d 0a 3c 6c 69 3e 74 68 65 20 3c 62 3e 69 6e 70  ..<li>the <b>inp
2f60: 75 74 3c 2f 62 3e 20 47 65 6f 6d 65 74 72 79 20  ut</b> Geometry 
2f70: 63 61 6e 20 62 65 20 6f 66 20 61 62 73 6f 6c 75  can be of absolu
2f80: 74 65 6c 79 20 61 72 62 69 74 72 61 72 79 20 74  tely arbitrary t
2f90: 79 70 65 3b 20 61 6c 6c 20 4c 69 6e 65 73 74 72  ype; all Linestr
2fa0: 69 6e 67 73 20 61 6e 64 20 2f 20 6f 72 20 50 6f  ings and / or Po
2fb0: 6c 79 67 6f 77 6e 73 20 77 69 6c 6c 20 65 76 65  lygowns will eve
2fc0: 6e 74 75 61 6c 6c 79 20 62 65 20 64 69 73 73 6f  ntually be disso
2fd0: 6c 76 65 64 20 69 6e 74 6f 20 50 6f 69 6e 74 73  lved into Points
2fe0: 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74   corresponding t
2ff0: 6f 20 76 65 72 74 69 63 65 73 2e 3c 62 72 3e 0d  o vertices.<br>.
3000: 0a 53 6f 20 61 66 74 65 72 20 61 6c 6c 20 53 54  .So after all ST
3010: 5f 56 6f 72 6f 6e 6f 6a 44 69 61 67 72 61 6d 28  _VoronojDiagram(
3020: 29 20 28 65 78 61 63 74 6c 79 20 61 73 20 53 54  ) (exactly as ST
3030: 5f 44 65 6c 61 75 6e 61 79 54 72 69 61 6e 67 75  _DelaunayTriangu
3040: 6c 61 74 69 6f 6e 29 20 77 69 6c 6c 20 61 6c 77  lation) will alw
3050: 61 79 73 20 70 72 6f 63 65 73 73 20 61 20 4d 75  ays process a Mu
3060: 6c 74 69 50 6f 69 6e 74 2e 3c 2f 6c 69 3e 0d 0a  ltiPoint.</li>..
3070: 3c 6c 69 3e 74 68 65 20 6f 70 74 69 6f 6e 61 6c  <li>the optional
3080: 20 3c 62 3e 65 64 67 65 73 5f 6f 6e 6c 79 3c 2f   <b>edges_only</
3090: 62 3e 20 61 72 67 75 6d 65 6e 74 20 77 69 6c 6c  b> argument will
30a0: 20 62 65 20 69 6e 74 65 72 70 72 65 74 65 64 20   be interpreted 
30b0: 61 73 20 66 6f 6c 6c 6f 77 73 3a 3c 75 6c 3e 0d  as follows:<ul>.
30c0: 0a 3c 6c 69 3e 69 66 20 3c 62 3e 46 41 4c 53 45  .<li>if <b>FALSE
30d0: 3c 2f 62 3e 20 28 3c 69 3e 64 65 66 61 75 6c 74  </b> (<i>default
30e0: 20 76 61 6c 75 65 3c 2f 69 3e 29 20 61 20 4d 75   value</i>) a Mu
30f0: 6c 74 69 50 6f 6c 79 67 6f 6e 20 77 69 6c 6c 20  ltiPolygon will 
3100: 62 65 20 72 65 74 75 72 6e 65 64 2e 3c 2f 6c 69  be returned.</li
3110: 3e 0d 0a 3c 6c 69 3e 69 66 20 3c 62 3e 54 52 55  >..<li>if <b>TRU
3120: 45 3c 2f 62 3e 20 61 20 4d 75 6c 74 69 4c 69 6e  E</b> a MultiLin
3130: 65 73 74 72 69 6e 67 20 77 69 6c 6c 20 62 65 20  estring will be 
3140: 72 65 74 75 72 6e 65 64 20 28 73 69 6d 70 6c 79  returned (simply
3150: 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68   representing th
3160: 65 20 74 72 69 61 6e 67 6c 65 73 20 65 64 67 65  e triangles edge
3170: 73 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c  s).</li>..</ul><
3180: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6f 70  /li>..<li>the op
3190: 74 69 6f 6e 61 6c 20 3c 62 3e 65 78 74 72 61 5f  tional <b>extra_
31a0: 66 72 61 6d 65 5f 73 69 7a 65 3c 2f 62 3e 20 61  frame_size</b> a
31b0: 6c 6c 6f 77 73 20 74 6f 20 66 72 65 65 6c 79 20  llows to freely 
31c0: 73 65 74 20 74 68 65 20 65 78 74 65 6e 74 20 6f  set the extent o
31d0: 66 20 74 68 65 20 66 72 61 6d 65 2e 3c 62 72 3e  f the frame.<br>
31e0: 0d 0a 54 68 69 73 20 61 72 67 75 6d 65 6e 74 20  ..This argument 
31f0: 69 73 20 69 6e 74 65 6e 64 65 64 20 61 73 20 61  is intended as a
3200: 20 3c 69 3e 70 65 72 63 65 6e 74 3c 2f 69 3e 20   <i>percent</i> 
3210: 69 6e 63 72 65 61 73 65 20 6f 66 20 74 68 65 20  increase of the 
3220: 3c 69 3e 6e 61 74 75 72 61 6c 20 65 78 74 65 6e  <i>natural exten
3230: 74 3c 2f 69 3e 20 6f 66 20 56 6f 72 6f 6e 6f 6a  t</i> of Voronoj
3240: 20 61 73 20 64 65 74 65 72 6d 69 6e 65 64 20 62   as determined b
3250: 79 20 65 76 61 6c 75 61 74 69 6e 67 20 61 6c 6c  y evaluating all
3260: 20 44 65 6c 61 75 6e 61 79 27 73 20 6e 6f 64 65   Delaunay's node
3270: 73 20 61 6e 64 20 63 69 72 63 75 6d 63 65 6e 74  s and circumcent
3280: 65 72 73 2e 3c 62 72 3e 0d 0a 42 79 20 64 65 66  ers.<br>..By def
3290: 61 75 6c 74 20 61 20 3c 62 3e 35 25 20 65 78 74  ault a <b>5% ext
32a0: 72 61 5f 66 72 61 6d 65 5f 73 69 7a 65 3c 2f 62  ra_frame_size</b
32b0: 3e 20 69 73 20 61 73 73 75 6d 65 64 2e 3c 2f 6c  > is assumed.</l
32c0: 69 3e 20 0d 0a 3c 6c 69 3e 74 68 65 20 6f 70 74  i> ..<li>the opt
32d0: 69 6f 6e 61 6c 20 3c 62 3e 74 6f 6c 65 72 61 6e  ional <b>toleran
32e0: 63 65 3c 2f 62 3e 20 61 72 67 75 6d 65 6e 74 20  ce</b> argument 
32f0: 69 73 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 6e  is intended to n
3300: 6f 72 6d 61 6c 69 7a 65 20 74 68 65 20 69 6e 70  ormalize the inp
3310: 75 74 20 70 6f 69 6e 74 2d 73 65 74 2c 20 73 75  ut point-set, su
3320: 70 70 72 65 73 73 69 6e 67 20 72 65 70 65 61 74  ppressing repeat
3330: 65 64 20 70 6f 69 6e 74 73 20 28 73 69 6d 70 6c  ed points (simpl
3340: 79 20 75 73 65 64 20 77 68 65 6e 20 69 6e 74 65  y used when inte
3350: 72 6e 61 6c 6c 79 20 63 6f 6d 70 75 74 69 6e 67  rnally computing
3360: 20 74 68 65 20 44 65 6c 61 75 6e 61 79 20 54 72   the Delaunay Tr
3370: 69 61 6e 67 75 6c 61 74 69 6f 6e 29 2e 0d 0a 42  iangulation)...B
3380: 79 20 64 65 66 61 75 6c 74 20 61 20 3c 62 3e 30  y default a <b>0
3390: 2e 30 3c 2f 62 3e 20 74 6f 6c 65 72 61 6e 63 65  .0</b> tolerance
33a0: 20 77 69 6c 6c 20 62 65 20 61 73 73 75 6d 65 64   will be assumed
33b0: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 74  .</li>..</ul></t
33c0: 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d  d></tr></table>.
33d0: 0a 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63  .<table cellspac
33e0: 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64  ing="4" cellpadd
33f0: 69 6e 67 3d 22 34 22 3e 0d 0a 3c 74 72 3e 3c 74  ing="4">..<tr><t
3400: 64 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c  d>..<table bgcol
3410: 6f 72 3d 22 23 66 30 66 30 66 30 22 20 63 65 6c  or="#f0f0f0" cel
3420: 6c 73 70 61 63 69 6e 67 3d 22 34 22 20 63 65 6c  lspacing="4" cel
3430: 6c 70 61 64 64 69 6e 67 3d 22 38 22 3e 0d 0a 3c  lpadding="8">..<
3440: 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 53 45 4c 45  tr><td>..<b>SELE
3450: 43 54 20 53 54 5f 56 6f 72 6f 6e 6f 6a 44 69 61  CT ST_VoronojDia
3460: 67 72 61 6d 28 53 54 5f 43 6f 6c 6c 65 63 74 28  gram(ST_Collect(
3470: 67 65 6f 6d 65 74 72 79 29 29 3c 62 72 3e 0d 0a  geometry))<br>..
3480: 46 52 4f 4d 20 69 74 61 6c 79 5f 70 6f 70 75 6c  FROM italy_popul
3490: 61 74 65 64 5f 70 6c 61 63 65 73 3b 3c 2f 62 3e  ated_places;</b>
34a0: 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f  ..</td></tr>..</
34b0: 74 61 62 6c 65 3e 3c 62 72 3e 0d 0a 54 68 69 73  table><br>..This
34c0: 20 53 51 4c 20 71 75 65 72 79 20 77 69 6c 6c 20   SQL query will 
34d0: 72 65 74 75 72 6e 20 61 20 56 6f 72 6f 6e 6f 6a  return a Voronoj
34e0: 20 44 69 61 67 72 61 6d 20 62 61 73 65 64 20 6f   Diagram based o
34f0: 6e 20 49 74 61 6c 79 27 73 20 70 6f 70 75 6c 61  n Italy's popula
3500: 74 65 64 20 70 6c 61 63 65 73 20 28 61 62 6f 75  ted places (abou
3510: 74 20 38 2c 30 30 30 2b 20 50 6f 69 6e 74 73 29  t 8,000+ Points)
3520: 2e 3c 62 72 3e 0d 0a 54 68 65 20 76 69 73 75 61  .<br>..The visua
3530: 6c 20 65 78 61 6d 70 6c 65 20 73 69 6d 70 6c 79  l example simply
3540: 20 63 6f 76 65 72 73 20 54 75 73 63 61 6e 79 2c   covers Tuscany,
3550: 20 73 6f 20 74 68 65 20 65 6e 73 75 72 65 20 61   so the ensure a
3560: 6e 20 65 61 73 79 20 72 65 61 64 61 62 69 6c 69  n easy readabili
3570: 74 79 2e 3c 62 72 3e 0d 0a 41 6c 6c 20 3c 69 3e  ty.<br>..All <i>
3580: 70 6f 70 75 6c 61 74 65 64 20 70 6c 61 63 65 73  populated places
3590: 3c 2f 69 3e 20 28 61 6b 61 20 63 65 6c 6c 20 3c  </i> (aka cell <
35a0: 69 3e 73 65 65 64 73 3c 2f 69 3e 29 20 61 72 65  i>seeds</i>) are
35b0: 20 65 78 70 6c 69 63 69 74 6c 79 20 72 65 70 72   explicitly repr
35c0: 65 73 65 6e 74 65 64 2e 20 0d 0a 3c 2f 74 64 3e  esented. ..</td>
35d0: 0d 0a 3c 74 64 3e 3c 69 6d 67 20 62 6f 72 64 65  ..<td><img borde
35e0: 72 3d 22 31 22 20 73 72 63 3d 22 68 74 74 70 3a  r="1" src="http:
35f0: 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69  //www.gaia-gis.i
3600: 74 2f 67 61 69 61 2d 73 69 6e 73 2f 77 72 69 74  t/gaia-sins/writ
3610: 65 2d 76 69 65 77 2d 70 69 63 73 2f 76 6f 72 6f  e-view-pics/voro
3620: 6e 6f 6a 2d 32 2e 70 6e 67 22 20 61 6c 74 3d 22  noj-2.png" alt="
3630: 76 6f 72 6f 6e 6f 6a 20 64 69 61 67 72 61 6d 22  voronoj diagram"
3640: 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74  ></td></tr>..</t
3650: 61 62 6c 65 3e 0d 0a 3c 62 72 3e 3c 68 72 3e 0d  able>..<br><hr>.
3660: 0a 3c 68 33 3e 44 65 6c 61 75 6e 61 79 20 54 72  .<h3>Delaunay Tr
3670: 69 61 6e 67 75 6c 61 74 69 6f 6e 2c 20 43 6f 6e  iangulation, Con
3680: 76 65 78 20 48 75 6c 6c 20 61 6e 64 20 43 6f 6e  vex Hull and Con
3690: 63 61 76 65 20 48 75 6c 6c 3c 2f 68 33 3e 0d 0a  cave Hull</h3>..
36a0: 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69  <table cellspaci
36b0: 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69  ng="4" cellpaddi
36c0: 6e 67 3d 22 34 22 3e 0d 0a 3c 74 72 3e 3c 74 64  ng="4">..<tr><td
36d0: 3e 3c 69 6d 67 20 62 6f 72 64 65 72 3d 22 31 22  ><img border="1"
36e0: 20 73 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77   src="http://www
36f0: 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69  .gaia-gis.it/gai
3700: 61 2d 73 69 6e 73 2f 77 72 69 74 65 2d 76 69 65  a-sins/write-vie
3710: 77 2d 70 69 63 73 2f 63 6f 6e 76 65 78 2e 70 6e  w-pics/convex.pn
3720: 67 22 20 61 6c 74 3d 22 64 65 6c 61 75 6e 61 79  g" alt="delaunay
3730: 2d 63 6f 6e 76 65 78 68 75 6c 6c 20 72 65 6c 61  -convexhull rela
3740: 74 69 6f 6e 73 68 69 70 22 3e 0d 0a 3c 2f 74 64  tionship">..</td
3750: 3e 3c 74 64 3e 0d 0a 41 6e 20 69 6e 74 65 72 65  ><td>..An intere
3760: 73 74 69 6e 67 20 70 6f 69 6e 74 20 61 62 73 6f  sting point abso
3770: 6c 75 74 65 6c 79 20 77 6f 72 74 68 20 74 6f 20  lutely worth to 
3780: 62 65 20 65 78 70 6c 69 63 69 74 6c 79 20 6e 6f  be explicitly no
3790: 74 65 64 3a 20 74 68 65 20 62 6f 75 6e 64 61 72  ted: the boundar
37a0: 79 20 6f 66 20 61 6e 79 20 3c 62 3e 44 65 6c 61  y of any <b>Dela
37b0: 75 6e 61 79 20 54 72 69 61 6e 67 75 6c 61 74 69  unay Triangulati
37c0: 6f 6e 3c 2f 62 3e 20 65 78 61 63 74 6c 79 20 63  on</b> exactly c
37d0: 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 74 68  orresponds to th
37e0: 65 20 3c 62 3e 43 6f 6e 76 65 78 20 48 75 6c 6c  e <b>Convex Hull
37f0: 3c 2f 62 3e 20 66 6f 72 20 74 68 65 20 73 61 6d  </b> for the sam
3800: 65 20 69 6e 70 75 74 20 47 65 6f 6d 65 74 72 79  e input Geometry
3810: 2e 0d 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 70  ...<a href="http
3820: 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e  ://en.wikipedia.
3830: 6f 72 67 2f 77 69 6b 69 2f 43 6f 6e 76 65 78 5f  org/wiki/Convex_
3840: 68 75 6c 6c 22 3e 72 65 61 64 20 6d 6f 72 65 3c  hull">read more<
3850: 2f 61 3e 3c 62 72 3e 3c 62 72 3e 0d 0a 41 6e 64  /a><br><br>..And
3860: 20 74 68 69 73 20 69 6e 20 74 75 72 6e 20 6f 70   this in turn op
3870: 65 6e 73 20 74 68 65 20 77 61 79 20 74 6f 20 61  ens the way to a
3880: 20 66 75 72 74 68 65 72 20 63 6f 6e 73 69 64 65   further conside
3890: 72 61 74 69 6f 6e 3a 20 77 65 20 63 6f 75 6c 64  ration: we could
38a0: 20 70 75 72 70 6f 73 65 6c 79 20 73 69 6d 70 6c   purposely simpl
38b0: 69 66 79 20 61 20 44 65 6c 61 75 6e 61 79 20 54  ify a Delaunay T
38c0: 72 69 61 6e 67 75 6c 61 74 69 6f 6e 20 73 6f 20  riangulation so 
38d0: 74 6f 20 67 65 74 20 61 20 3c 62 3e 63 6f 6e 63  to get a <b>conc
38e0: 61 76 65 20 68 75 6c 6c 3c 2f 62 3e 2e 3c 62 72  ave hull</b>.<br
38f0: 3e 0d 0a 59 6f 75 20 63 61 6e 20 67 65 74 20 6d  >..You can get m
3900: 6f 72 65 20 65 78 74 65 6e 73 69 76 65 20 69 6e  ore extensive in
3910: 66 6f 72 6d 61 74 69 6f 6e 73 20 61 62 6f 75 74  formations about
3920: 20 74 68 69 73 20 61 70 70 72 6f 61 63 68 20 66   this approach f
3930: 72 6f 6d 20 3c 61 20 68 72 65 66 3d 22 68 74 74  rom <a href="htt
3940: 70 3a 2f 2f 67 72 61 73 73 2e 6f 73 67 65 6f 2e  p://grass.osgeo.
3950: 6f 72 67 2f 77 69 6b 69 2f 43 72 65 61 74 65 5f  org/wiki/Create_
3960: 63 6f 6e 63 61 76 65 5f 68 75 6c 6c 22 3e 68 65  concave_hull">he
3970: 72 65 3c 2f 61 3e 3c 62 72 3e 3c 62 72 3e 0d 0a  re</a><br><br>..
3980: 3c 75 3e 50 6c 65 61 73 65 20 6e 6f 74 65 20 77  <u>Please note w
3990: 65 6c 6c 3c 2f 75 3e 3a 20 74 68 65 20 3c 62 3e  ell</u>: the <b>
39a0: 63 6f 6e 76 65 78 20 68 75 6c 6c 3c 2f 62 3e 20  convex hull</b> 
39b0: 63 6f 6e 63 65 70 74 20 63 6f 72 72 65 73 70 6f  concept correspo
39c0: 6e 64 73 20 74 6f 20 61 20 72 6f 62 75 73 74 20  nds to a robust 
39d0: 61 6e 64 20 66 6f 72 6d 61 6c 20 6d 61 74 68 65  and formal mathe
39e0: 6d 61 74 69 63 61 6c 20 64 65 66 69 6e 69 74 69  matical definiti
39f0: 6f 6e 2e 20 4f 6e 20 74 68 65 20 6f 74 68 65 72  on. On the other
3a00: 20 73 69 64 65 20 74 68 65 20 3c 62 3e 63 6f 6e   side the <b>con
3a10: 63 61 76 65 20 68 75 6c 6c 3c 2f 62 3e 20 69 73  cave hull</b> is
3a20: 20 61 20 6d 75 63 68 20 6d 6f 72 65 20 76 61 67   a much more vag
3a30: 75 65 20 61 6e 64 20 75 6e 64 65 74 65 72 6d 69  ue and undetermi
3a40: 6e 65 64 20 6e 6f 74 69 6f 6e 2e 3c 62 72 3e 0d  ned notion.<br>.
3a50: 0a 54 68 65 72 65 20 69 73 20 6f 6e 65 20 61 6e  .There is one an
3a60: 64 20 6f 6e 6c 79 20 6f 6e 65 20 43 6f 6e 76 65  d only one Conve
3a70: 78 48 75 6c 6c 20 66 6f 72 20 61 20 67 69 76 65  xHull for a give
3a80: 6e 20 47 65 6f 6d 65 74 72 79 3b 20 62 75 74 20  n Geometry; but 
3a90: 6d 61 6e 79 20 43 6f 6e 63 61 76 65 48 75 6c 6c  many ConcaveHull
3aa0: 73 20 61 72 65 20 70 6f 73 73 69 62 6c 65 2e 0d  s are possible..
3ab0: 0a 43 68 6f 6f 73 69 6e 67 20 74 68 65 20 6f 6e  .Choosing the on
3ac0: 65 20 6f 72 20 74 68 65 20 6f 74 68 65 72 20 69  e or the other i
3ad0: 73 20 6d 75 63 68 20 6d 6f 72 65 20 61 20 6d 61  s much more a ma
3ae0: 74 74 65 72 20 6f 66 20 70 65 72 73 6f 6e 61 6c  tter of personal
3af0: 20 74 61 73 74 65 20 74 68 61 6e 20 61 20 6d 61   taste than a ma
3b00: 74 68 65 6d 61 74 69 63 61 6c 20 6f 70 65 72 61  thematical opera
3b10: 74 69 6f 6e 20 66 6f 72 6d 61 6c 6c 79 20 64 65  tion formally de
3b20: 66 69 6e 65 64 2e 3c 62 72 3e 0d 0a 43 6f 6d 70  fined.<br>..Comp
3b30: 75 74 69 6e 67 20 61 20 43 6f 6e 63 61 76 65 48  uting a ConcaveH
3b40: 75 6c 6c 20 61 6c 77 61 79 73 20 69 73 20 61 6e  ull always is an
3b50: 20 69 6e 68 65 72 65 6e 74 6c 79 20 61 72 62 69   inherently arbi
3b60: 74 72 61 72 79 20 61 6e 64 20 68 65 75 72 69 73  trary and heuris
3b70: 74 69 63 20 70 72 6f 63 65 73 73 2e 0d 0a 3c 2f  tic process...</
3b80: 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74  td></tr>..<tr><t
3b90: 64 3e 0d 0a 3c 68 34 3e 54 68 65 20 53 70 61 74  d>..<h4>The Spat
3ba0: 69 61 4c 69 74 65 27 73 20 6f 77 6e 20 61 70 70  iaLite's own app
3bb0: 72 6f 61 63 68 20 74 6f 20 43 6f 6e 63 61 76 65  roach to Concave
3bc0: 48 75 6c 6c 3c 2f 68 34 3e 0d 0a 3c 6f 6c 3e 0d  Hull</h4>..<ol>.
3bd0: 0a 3c 6c 69 3e 74 68 65 20 44 65 6c 61 75 6e 61  .<li>the Delauna
3be0: 79 20 54 72 69 61 6e 67 75 6c 61 74 69 6f 6e 20  y Triangulation 
3bf0: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f  corresponding to
3c00: 20 74 68 65 20 69 6e 70 75 74 20 47 65 6f 6d 65   the input Geome
3c10: 74 72 79 20 77 69 6c 6c 20 62 65 20 63 6f 6d 70  try will be comp
3c20: 75 74 65 64 20 66 69 72 73 74 2e 3c 2f 6c 69 3e  uted first.</li>
3c30: 0d 0a 3c 6c 69 3e 74 68 65 6e 20 74 68 65 20 73  ..<li>then the s
3c40: 74 61 74 69 73 74 69 63 61 6c 20 64 69 73 74 72  tatistical distr
3c50: 69 62 75 74 69 6f 6e 20 6f 66 20 61 6c 6c 20 74  ibution of all t
3c60: 72 69 61 6e 67 6c 65 20 65 64 67 65 27 73 20 6c  riangle edge's l
3c70: 65 6e 67 74 68 73 20 77 69 6c 6c 20 62 65 20 65  engths will be e
3c80: 76 61 6c 75 61 74 65 64 2c 20 73 6f 20 74 6f 20  valuated, so to 
3c90: 64 65 74 65 72 6d 69 6e 65 20 3c 62 3e 26 73 69  determine <b>&si
3ca0: 67 6d 61 3b 3c 2f 62 3e 20 28 61 6b 61 20 74 68  gma;</b> (aka th
3cb0: 65 20 3c 69 3e 73 74 61 6e 64 61 72 64 20 64 65  e <i>standard de
3cc0: 76 69 61 74 69 6f 6e 3c 2f 69 3e 29 3c 2f 6c 69  viation</i>)</li
3cd0: 3e 0d 0a 3c 6c 69 3e 61 20 73 65 63 6f 6e 64 20  >..<li>a second 
3ce0: 70 61 73 73 20 77 69 6c 6c 20 6e 6f 77 20 65 78  pass will now ex
3cf0: 61 6d 69 6e 65 20 79 65 74 20 61 67 61 69 6e 20  amine yet again 
3d00: 61 6c 6c 20 44 65 6c 61 75 6e 61 79 27 73 20 74  all Delaunay's t
3d10: 72 69 61 6e 67 6c 65 73 3b 20 61 6e 79 20 74 72  riangles; any tr
3d20: 69 61 6e 67 6c 65 20 70 72 65 73 65 6e 74 69 6e  iangle presentin
3d30: 67 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 65  g at least one e
3d40: 64 67 65 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20  dge longer than 
3d50: 3c 62 3e 26 73 69 67 6d 61 3b 20 2a 20 66 61 63  <b>&sigma; * fac
3d60: 74 6f 72 3c 2f 62 3e 20 77 69 6c 6c 20 62 65 20  tor</b> will be 
3d70: 64 69 73 63 61 72 64 65 64 2e 3c 2f 6c 69 3e 0d  discarded.</li>.
3d80: 0a 3c 6c 69 3e 61 6e 64 20 66 69 6e 61 6c 6c 79  .<li>and finally
3d90: 20 61 6c 6c 20 66 69 6c 74 65 72 65 64 20 74 72   all filtered tr
3da0: 69 61 6e 67 6c 65 73 20 77 69 6c 6c 20 62 65 20  iangles will be 
3db0: 64 69 73 73 6f 6c 76 65 64 20 73 6f 20 74 6f 20  dissolved so to 
3dc0: 66 6f 72 6d 20 74 68 65 20 43 6f 6e 63 61 76 65  form the Concave
3dd0: 48 75 6c 6c 20 74 6f 20 62 65 20 72 65 74 75 72  Hull to be retur
3de0: 6e 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 6f 6c 3e  ned.</li>..</ol>
3df0: 0d 0a 3c 75 3e 50 6c 65 61 73 65 20 6e 6f 74 65  ..<u>Please note
3e00: 3c 2f 75 3e 3a 20 62 79 20 73 65 74 74 69 6e 67  </u>: by setting
3e10: 20 61 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20   an appropriate 
3e20: 76 61 6c 75 65 20 74 6f 20 3c 62 3e 66 61 63 74  value to <b>fact
3e30: 6f 72 3c 2f 62 3e 20 79 6f 75 20 63 61 6e 20 66  or</b> you can f
3e40: 72 65 65 6c 79 20 69 6e 66 6c 75 65 6e 63 65 20  reely influence 
3e50: 68 6f 77 20 6d 75 63 68 20 3c 69 3e 61 67 67 72  how much <i>aggr
3e60: 65 73 73 69 76 65 3c 2f 69 3e 20 74 68 65 20 66  essive</i> the f
3e70: 69 6c 74 65 72 69 6e 67 20 70 61 73 73 20 77 69  iltering pass wi
3e80: 6c 6c 20 62 65 2e 3c 62 72 3e 0d 0a 41 64 6f 70  ll be.<br>..Adop
3e90: 74 69 6e 67 20 61 20 76 65 72 79 20 68 69 67 68  ting a very high
3ea0: 20 3c 62 3e 66 61 63 74 6f 72 3c 2f 62 3e 20 76   <b>factor</b> v
3eb0: 61 6c 75 65 20 70 72 61 63 74 69 63 61 6c 6c 79  alue practically
3ec0: 20 6d 65 61 6e 73 20 61 70 70 6c 79 69 6e 67 20   means applying 
3ed0: 61 20 76 65 72 79 20 62 6c 61 6e 64 20 66 69 6c  a very bland fil
3ee0: 74 65 72 69 6e 67 20 28 76 65 72 79 20 66 65 77  tering (very few
3ef0: 20 74 72 69 61 6e 67 6c 65 73 20 77 69 6c 6c 20   triangles will 
3f00: 62 65 20 64 69 73 63 61 72 64 65 64 2c 20 61 6e  be discarded, an
3f10: 64 20 79 6f 75 27 6c 6c 20 63 6f 6e 73 65 71 75  d you'll consequ
3f20: 65 6e 74 6c 79 20 67 65 74 20 61 20 72 61 74 68  ently get a rath
3f30: 65 72 20 3c 69 3e 63 6f 6e 76 65 78 3c 2f 69 3e  er <i>convex</i>
3f40: 20 73 68 61 70 65 29 2e 0d 0a 4f 6e 20 74 68 65   shape)...On the
3f50: 20 6f 74 68 65 72 20 73 69 64 65 20 61 64 6f 70   other side adop
3f60: 74 69 6e 67 20 61 20 76 65 72 79 20 6c 6f 77 20  ting a very low 
3f70: 3c 62 3e 66 61 63 74 6f 72 3c 2f 62 3e 20 76 61  <b>factor</b> va
3f80: 6c 75 65 73 20 77 69 6c 6c 20 61 70 70 6c 79 20  lues will apply 
3f90: 61 20 76 65 72 79 20 73 74 72 6f 6e 67 20 66 69  a very strong fi
3fa0: 6c 74 65 72 69 6e 67 20 28 6d 61 6e 79 20 74 72  ltering (many tr
3fb0: 69 61 6e 67 6c 65 73 20 77 69 6c 6c 20 62 65 20  iangles will be 
3fc0: 6e 6f 77 20 64 69 73 63 61 72 64 65 64 2c 20 61  now discarded, a
3fd0: 6e 64 20 79 6f 75 27 6c 6c 20 67 65 74 20 61 20  nd you'll get a 
3fe0: 76 65 72 79 20 3c 69 3e 63 6f 6e 63 61 76 65 3c  very <i>concave<
3ff0: 2f 69 3e 20 73 68 61 70 65 29 2e 3c 62 72 3e 3c  /i> shape).<br><
4000: 62 72 3e 0d 0a 3c 75 3e 55 73 65 66 75 6c 20 63  br>..<u>Useful c
4010: 6f 6e 73 74 61 6e 74 73 3c 2f 75 3e 3a 20 61 73  onstants</u>: as
4020: 73 75 6d 69 6e 67 20 61 20 70 65 72 66 65 63 74  suming a perfect
4030: 6c 79 20 6e 6f 72 6d 61 6c 20 64 69 73 74 72 69  ly normal distri
4040: 62 75 74 69 6f 6e 20 6f 66 20 65 64 67 65 20 6c  bution of edge l
4050: 65 6e 67 74 68 73 20 28 61 20 62 79 20 66 61 72  engths (a by far
4060: 20 75 6e 72 65 61 6c 69 73 74 69 63 20 61 73 73   unrealistic ass
4070: 75 6d 70 74 69 6f 6e 20 66 6f 72 20 72 65 61 6c  umption for real
4080: 20 77 6f 72 6c 64 20 64 61 74 61 73 65 74 73 29   world datasets)
4090: 2c 20 3c 62 3e 33 26 73 69 67 6d 61 3b 3c 2f 62  , <b>3&sigma;</b
40a0: 3e 20 77 69 6c 6c 20 69 6d 70 6c 79 20 73 75 70  > will imply sup
40b0: 70 72 65 73 73 69 6e 67 20 61 62 6f 75 74 20 3c  pressing about <
40c0: 62 3e 30 2e 31 25 3c 2f 62 3e 20 74 72 69 61 6e  b>0.1%</b> trian
40d0: 67 6c 65 73 20 28 6f 6e 6c 79 20 74 68 65 20 66  gles (only the f
40e0: 65 77 20 6f 6e 65 73 20 70 72 65 73 65 6e 74 69  ew ones presenti
40f0: 6e 67 20 61 62 6e 6f 72 6d 61 6c 6c 79 20 6c 65  ng abnormally le
4100: 6e 67 74 68 79 20 65 64 67 65 73 29 2c 20 3c 62  ngthy edges), <b
4110: 3e 32 26 73 69 67 6d 61 3b 3c 2f 62 3e 20 63 6f  >2&sigma;</b> co
4120: 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 61 62 6f  rresponds to abo
4130: 75 74 20 3c 62 3e 32 2e 31 25 3c 2f 62 3e 2c 20  ut <b>2.1%</b>, 
4140: 61 6e 64 20 3c 62 3e 31 26 73 69 67 6d 61 3b 3c  and <b>1&sigma;<
4150: 2f 62 3e 20 72 6f 75 67 68 6c 79 20 63 6f 72 72  /b> roughly corr
4160: 65 73 70 6f 6e 64 73 20 74 6f 20 20 3c 62 3e 31  esponds to  <b>1
4170: 35 2e 38 25 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 55  5.8%</b>.<br>..U
4180: 73 75 61 6c 6c 79 20 76 61 6c 75 65 73 20 72 61  sually values ra
4190: 6e 67 69 6e 67 20 62 65 74 77 65 65 6e 20 3c 62  nging between <b
41a0: 3e 33 26 73 69 67 6d 61 3b 3c 2f 62 3e 20 61 6e  >3&sigma;</b> an
41b0: 64 20 3c 62 3e 32 26 73 69 67 6d 61 3b 3c 2f 62  d <b>2&sigma;</b
41c0: 3e 20 61 72 65 20 74 68 65 20 6d 6f 73 74 20 61  > are the most a
41d0: 70 70 72 6f 70 72 69 61 74 65 20 74 6f 20 62 65  ppropriate to be
41e0: 20 75 73 65 64 2e 3c 62 72 3e 3c 62 72 3e 0d 0a   used.<br><br>..
41f0: 54 68 65 20 66 69 67 75 72 65 20 73 68 6f 77 73  The figure shows
4200: 20 77 68 61 74 20 79 6f 75 20 63 61 6e 20 61 63   what you can ac
4210: 74 75 61 6c 6c 79 20 67 65 74 20 62 79 20 61 70  tually get by ap
4220: 70 6c 79 69 6e 67 20 61 20 3c 62 3e 33 26 73 69  plying a <b>3&si
4230: 67 6d 61 3b 3c 2f 62 3e 20 66 69 6c 74 65 72 69  gma;</b> filteri
4240: 6e 67 20 74 6f 20 49 74 61 6c 69 61 6e 20 50 6f  ng to Italian Po
4250: 70 75 6c 61 74 65 64 20 50 6c 61 63 65 73 3b 20  pulated Places; 
4260: 66 6f 72 20 63 6c 61 72 69 74 79 20 61 6c 6c 20  for clarity all 
4270: 49 74 61 6c 69 61 6e 20 52 65 67 69 6f 6e 73 20  Italian Regions 
4280: 61 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 20  are represented 
4290: 69 6e 20 79 65 6c 6c 6f 77 2c 20 61 6e 64 20 74  in yellow, and t
42a0: 68 65 20 43 6f 6e 76 65 78 48 75 6c 6c 20 69 73  he ConvexHull is
42b0: 20 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20   represented in 
42c0: 62 6c 75 65 2e 20 54 68 65 20 43 6f 6e 63 61 76  blue. The Concav
42d0: 65 48 75 6c 6c 20 69 74 73 65 6c 66 20 69 73 20  eHull itself is 
42e0: 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 72  represented in r
42f0: 65 64 2e 0d 0a 3c 2f 74 64 3e 3c 74 64 3e 0d 0a  ed...</td><td>..
4300: 3c 69 6d 67 20 62 6f 72 64 65 72 3d 22 31 22 20  <img border="1" 
4310: 73 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e  src="http://www.
4320: 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61  gaia-gis.it/gaia
4330: 2d 73 69 6e 73 2f 77 72 69 74 65 2d 76 69 65 77  -sins/write-view
4340: 2d 70 69 63 73 2f 63 6f 6e 63 61 76 65 33 2e 70  -pics/concave3.p
4350: 6e 67 22 20 61 6c 74 3d 22 63 6f 6e 63 61 76 65  ng" alt="concave
4360: 68 75 6c 6c 2d 31 22 3e 0d 0a 3c 2f 74 64 3e 3c  hull-1">..</td><
4370: 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a  /tr>..</table>..
4380: 3c 62 72 3e 0d 0a 3c 62 3e 3c 75 3e 50 6c 65 61  <br>..<b><u>Plea
4390: 73 65 20 6e 6f 74 65 20 77 65 6c 6c 3c 2f 75 3e  se note well</u>
43a0: 3c 2f 62 3e 3a 20 50 6f 73 74 47 49 53 20 73 75  </b>: PostGIS su
43b0: 70 70 6f 72 74 73 20 69 74 73 20 6f 77 6e 20 69  pports its own i
43c0: 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66  mplementation of
43d0: 20 53 54 5f 43 6f 6e 63 61 76 65 48 75 6c 6c 28   ST_ConcaveHull(
43e0: 29 2c 20 62 65 69 6e 67 20 62 61 73 65 64 20 6f  ), being based o
43f0: 6e 20 61 20 63 6f 6d 70 6c 65 74 65 6c 79 20 64  n a completely d
4400: 69 66 66 65 72 65 6e 74 20 61 70 70 72 6f 61 63  ifferent approac
4410: 68 2e 20 59 6f 75 20 63 61 6e 20 67 65 74 20 6d  h. You can get m
4420: 6f 72 65 20 64 65 74 61 69 6c 73 20 66 72 6f 6d  ore details from
4430: 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f   <a href="http:/
4440: 2f 77 77 77 2e 62 6f 73 74 6f 6e 67 69 73 2e 63  /www.bostongis.c
4450: 6f 6d 2f 70 6f 73 74 67 69 73 5f 63 6f 6e 63 61  om/postgis_conca
4460: 76 65 68 75 6c 6c 2e 73 6e 69 70 70 65 74 22 3e  vehull.snippet">
4470: 68 65 72 65 3c 2f 61 3e 3c 62 72 3e 0d 0a 50 6c  here</a><br>..Pl
4480: 65 61 73 65 2c 20 64 6f 6e 27 74 20 62 65 20 63  ease, don't be c
4490: 6f 6e 66 75 73 65 64 3a 20 74 68 65 20 53 70 61  onfused: the Spa
44a0: 74 69 61 4c 69 74 65 20 61 6e 64 20 50 6f 73 74  tiaLite and Post
44b0: 47 49 53 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69  GIS implementati
44c0: 6f 6e 73 20 61 72 65 20 63 6f 6d 70 6c 65 74 65  ons are complete
44d0: 6c 79 20 75 6e 72 65 6c 61 74 65 64 2e 20 41 6e  ly unrelated. An
44e0: 79 77 61 79 2c 20 69 74 20 63 6f 75 6c 64 20 62  yway, it could b
44f0: 65 20 69 6e 74 65 72 65 73 74 69 6e 67 20 6e 6f  e interesting no
4500: 74 69 6e 67 20 74 68 61 74 20 74 68 65 20 53 70  ting that the Sp
4510: 61 74 69 61 4c 69 74 65 27 73 20 6f 77 6e 20 69  atiaLite's own i
4520: 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 73 65  mplementation se
4530: 65 6d 73 20 74 6f 20 62 65 20 6d 75 63 68 20 6d  ems to be much m
4540: 6f 72 65 20 65 66 66 69 63 69 65 6e 74 20 61 6e  ore efficient an
4550: 64 20 66 61 73 74 2c 20 61 6e 64 20 63 61 6e 20  d fast, and can 
4560: 62 65 20 72 65 61 6c 69 73 74 69 63 61 6c 6c 79  be realistically
4570: 20 61 70 70 6c 69 65 64 20 65 76 65 6e 20 74 6f   applied even to
4580: 20 76 65 72 79 20 68 75 67 65 20 70 6f 69 6e 74   very huge point
4590: 2d 73 65 74 73 2e 3c 62 72 3e 3c 62 72 3e 0d 0a  -sets.<br><br>..
45a0: 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22  <table bgcolor="
45b0: 23 66 30 66 30 66 30 22 20 63 65 6c 6c 73 70 61  #f0f0f0" cellspa
45c0: 63 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64  cing="4" cellpad
45d0: 64 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c  ding="8">..<tr><
45e0: 74 64 3e 0d 0a 3c 69 3e 70 72 6f 74 6f 74 79 70  td>..<i>prototyp
45f0: 65 3c 2f 69 3e 3a 3c 68 72 3e 0d 0a 53 54 5f 43  e</i>:<hr>..ST_C
4600: 6f 6e 63 61 76 65 48 75 6c 6c 28 20 69 6e 70 75  oncaveHull( inpu
4610: 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f 69  t <i>Geometry</i
4620: 3e 20 29 20 3a 20 63 6f 6e 63 61 76 65 20 3c 69  > ) : concave <i
4630: 3e 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 3c 62 72  >Geometry</i><br
4640: 3e 0d 0a 53 54 5f 43 6f 6e 63 61 76 65 48 75 6c  >..ST_ConcaveHul
4650: 6c 28 20 69 6e 70 75 74 20 3c 69 3e 47 65 6f 6d  l( input <i>Geom
4660: 65 74 72 79 3c 2f 69 3e 2c 20 66 61 63 74 6f 72  etry</i>, factor
4670: 20 3c 69 3e 64 6f 75 62 6c 65 20 70 72 65 63 69   <i>double preci
4680: 73 69 6f 6e 3c 2f 69 3e 20 29 20 3a 20 63 6f 6e  sion</i> ) : con
4690: 63 61 76 65 20 3c 69 3e 47 65 6f 6d 65 74 72 79  cave <i>Geometry
46a0: 3c 2f 69 3e 3c 62 72 3e 0d 0a 53 54 5f 43 6f 6e  </i><br>..ST_Con
46b0: 63 61 76 65 48 75 6c 6c 28 20 69 6e 70 75 74 20  caveHull( input 
46c0: 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 2c  <i>Geometry</i>,
46d0: 20 66 61 63 74 6f 72 20 3c 69 3e 64 6f 75 62 6c   factor <i>doubl
46e0: 65 20 70 72 65 63 69 73 69 6f 6e 3c 2f 69 3e 2c  e precision</i>,
46f0: 20 61 6c 6c 6f 77 5f 68 6f 6c 65 73 20 3c 69 3e   allow_holes <i>
4700: 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20 29 20 3a 20  boolean</i> ) : 
4710: 63 6f 6e 63 61 76 65 20 3c 69 3e 47 65 6f 6d 65  concave <i>Geome
4720: 74 72 79 3c 2f 69 3e 3c 62 72 3e 0d 0a 53 54 5f  try</i><br>..ST_
4730: 43 6f 6e 63 61 76 65 48 75 6c 6c 28 20 69 6e 70  ConcaveHull( inp
4740: 75 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f  ut <i>Geometry</
4750: 69 3e 2c 20 66 61 63 74 6f 72 20 3c 69 3e 64 6f  i>, factor <i>do
4760: 75 62 6c 65 20 70 72 65 63 69 73 69 6f 6e 3c 2f  uble precision</
4770: 69 3e 2c 20 61 6c 6c 6f 77 5f 68 6f 6c 65 73 20  i>, allow_holes 
4780: 3c 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 2c 20  <i>boolean</i>, 
4790: 74 6f 6c 65 72 61 6e 63 65 20 3c 69 3e 64 6f 75  tolerance <i>dou
47a0: 62 6c 65 20 70 72 65 63 69 73 69 6f 6e 3c 2f 69  ble precision</i
47b0: 3e 20 29 20 3a 20 63 6f 6e 63 61 76 65 20 3c 69  > ) : concave <i
47c0: 3e 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 0d 0a 3c  >Geometry</i>..<
47d0: 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65  /td></tr></table
47e0: 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65  >..<ul>..<li>the
47f0: 20 3c 62 3e 69 6e 70 75 74 3c 2f 62 3e 20 47 65   <b>input</b> Ge
4800: 6f 6d 65 74 72 79 20 63 61 6e 20 62 65 20 6f 66  ometry can be of
4810: 20 61 62 73 6f 6c 75 74 65 6c 79 20 61 72 62 69   absolutely arbi
4820: 74 72 61 72 79 20 74 79 70 65 3b 20 61 6c 6c 20  trary type; all 
4830: 4c 69 6e 65 73 74 72 69 6e 67 73 20 61 6e 64 20  Linestrings and 
4840: 2f 20 6f 72 20 50 6f 6c 79 67 6f 77 6e 73 20 77  / or Polygowns w
4850: 69 6c 6c 20 65 76 65 6e 74 75 61 6c 6c 79 20 62  ill eventually b
4860: 65 20 64 69 73 73 6f 6c 76 65 64 20 69 6e 74 6f  e dissolved into
4870: 20 50 6f 69 6e 74 73 20 63 6f 72 72 65 73 70 6f   Points correspo
4880: 6e 64 69 6e 67 20 74 6f 20 76 65 72 74 69 63 65  nding to vertice
4890: 73 2e 3c 62 72 3e 0d 0a 53 6f 20 61 66 74 65 72  s.<br>..So after
48a0: 20 61 6c 6c 20 53 54 5f 43 6f 6e 63 61 76 65 48   all ST_ConcaveH
48b0: 75 6c 6c 28 29 20 28 65 78 61 63 74 6c 79 20 61  ull() (exactly a
48c0: 73 20 53 54 5f 44 65 6c 61 75 6e 61 79 54 72 69  s ST_DelaunayTri
48d0: 61 6e 67 75 6c 61 74 69 6f 6e 29 20 77 69 6c 6c  angulation) will
48e0: 20 61 6c 77 61 79 73 20 70 72 6f 63 65 73 73 20   always process 
48f0: 61 20 4d 75 6c 74 69 50 6f 69 6e 74 2e 3c 2f 6c  a MultiPoint.</l
4900: 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6f 70 74 69  i>..<li>the opti
4910: 6f 6e 61 6c 20 3c 62 3e 66 61 63 74 6f 72 3c 2f  onal <b>factor</
4920: 62 3e 20 69 73 20 69 6e 74 65 6e 64 65 64 20 74  b> is intended t
4930: 6f 20 62 65 20 61 20 3c 62 3e 26 73 69 67 6d 61  o be a <b>&sigma
4940: 3b 3c 2f 62 3e 20 6d 75 6c 74 69 70 6c 69 65 72  ;</b> multiplier
4950: 2c 20 74 68 75 73 20 64 65 74 65 72 6d 69 6e 69  , thus determini
4960: 6e 67 20 74 68 65 20 66 69 6c 74 65 72 69 6e 67  ng the filtering
4970: 20 74 68 72 65 73 68 6f 6c 64 2e 3c 62 72 3e 0d   threshold.<br>.
4980: 0a 42 79 20 64 65 66 61 75 6c 74 20 61 20 3c 62  .By default a <b
4990: 3e 33 26 73 69 67 6d 61 3b 20 66 61 63 74 6f 72  >3&sigma; factor
49a0: 3c 2f 62 3e 20 69 73 20 61 73 73 75 6d 65 64 2e  </b> is assumed.
49b0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6f  </li>..<li>the o
49c0: 70 74 69 6f 6e 61 6c 20 3c 62 3e 61 6c 6c 6f 77  ptional <b>allow
49d0: 5f 68 6f 6c 65 73 3c 2f 62 3e 20 61 72 67 75 6d  _holes</b> argum
49e0: 65 6e 74 20 77 69 6c 6c 20 62 65 20 69 6e 74 65  ent will be inte
49f0: 72 70 72 65 74 65 64 20 61 73 20 66 6f 6c 6c 6f  rpreted as follo
4a00: 77 73 3a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69 66 20  ws:<ul>..<li>if 
4a10: 3c 62 3e 46 41 4c 53 45 3c 2f 62 3e 20 28 3c 69  <b>FALSE</b> (<i
4a20: 3e 64 65 66 61 75 6c 74 20 76 61 6c 75 65 3c 2f  >default value</
4a30: 69 3e 29 20 61 6e 79 20 65 76 65 6e 74 75 61 6c  i>) any eventual
4a40: 20 69 6e 74 65 72 69 6f 72 20 68 6f 6c 65 20 77   interior hole w
4a50: 69 6c 6c 20 62 65 20 73 75 70 70 72 65 73 73 65  ill be suppresse
4a60: 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20  d.</li>..<li>if 
4a70: 3c 62 3e 54 52 55 45 3c 2f 62 3e 20 61 6e 79 20  <b>TRUE</b> any 
4a80: 65 76 65 6e 74 75 61 6c 20 69 6e 74 65 72 69 6f  eventual interio
4a90: 72 20 68 6f 6c 65 73 20 77 69 6c 6c 20 62 65 20  r holes will be 
4aa0: 70 72 65 73 65 72 76 65 64 2e 3c 2f 6c 69 3e 0d  preserved.</li>.
4ab0: 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 20 0d 0a 3c 6c  .</ul></li> ..<l
4ac0: 69 3e 74 68 65 20 6f 70 74 69 6f 6e 61 6c 20 3c  i>the optional <
4ad0: 62 3e 74 6f 6c 65 72 61 6e 63 65 3c 2f 62 3e 20  b>tolerance</b> 
4ae0: 61 72 67 75 6d 65 6e 74 20 69 73 20 69 6e 74 65  argument is inte
4af0: 6e 64 65 64 20 74 6f 20 6e 6f 72 6d 61 6c 69 7a  nded to normaliz
4b00: 65 20 74 68 65 20 69 6e 70 75 74 20 70 6f 69 6e  e the input poin
4b10: 74 2d 73 65 74 2c 20 73 75 70 70 72 65 73 73 69  t-set, suppressi
4b20: 6e 67 20 72 65 70 65 61 74 65 64 20 70 6f 69 6e  ng repeated poin
4b30: 74 73 20 28 73 69 6d 70 6c 79 20 75 73 65 64 20  ts (simply used 
4b40: 77 68 65 6e 20 69 6e 74 65 72 6e 61 6c 6c 79 20  when internally 
4b50: 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 44 65  computing the De
4b60: 6c 61 75 6e 61 79 20 54 72 69 61 6e 67 75 6c 61  launay Triangula
4b70: 74 69 6f 6e 29 2e 0d 0a 42 79 20 64 65 66 61 75  tion)...By defau
4b80: 6c 74 20 61 20 3c 62 3e 30 2e 30 3c 2f 62 3e 20  lt a <b>0.0</b> 
4b90: 74 6f 6c 65 72 61 6e 63 65 20 77 69 6c 6c 20 62  tolerance will b
4ba0: 65 20 61 73 73 75 6d 65 64 2e 3c 2f 6c 69 3e 0d  e assumed.</li>.
4bb0: 0a 3c 2f 75 6c 3e 3c 2f 74 64 3e 3c 2f 74 72 3e  .</ul></td></tr>
4bc0: 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 74 61 62 6c 65  </table>..<table
4bd0: 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 34 22   cellspacing="4"
4be0: 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 34 22   cellpadding="4"
4bf0: 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 74 61  >..<tr><td>..<ta
4c00: 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30  ble bgcolor="#f0
4c10: 66 30 66 30 22 20 63 65 6c 6c 73 70 61 63 69 6e  f0f0" cellspacin
4c20: 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69 6e  g="4" cellpaddin
4c30: 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e  g="8">..<tr><td>
4c40: 0d 0a 3c 62 3e 53 45 4c 45 43 54 20 53 54 5f 43  ..<b>SELECT ST_C
4c50: 6f 6e 63 61 76 65 48 75 6c 6c 28 53 54 5f 43 6f  oncaveHull(ST_Co
4c60: 6c 6c 65 63 74 28 67 65 6f 6d 65 74 72 79 29 2c  llect(geometry),
4c70: 20 32 2e 35 29 3c 62 72 3e 0d 0a 46 52 4f 4d 20   2.5)<br>..FROM 
4c80: 69 74 61 6c 79 5f 70 6f 70 75 6c 61 74 65 64 5f  italy_populated_
4c90: 70 6c 61 63 65 73 3b 3c 2f 62 3e 0d 0a 3c 2f 74  places;</b>..</t
4ca0: 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65  d></tr>..</table
4cb0: 3e 3c 62 72 3e 0d 0a 54 68 69 73 20 53 51 4c 20  ><br>..This SQL 
4cc0: 71 75 65 72 79 20 77 69 6c 6c 20 72 65 74 75 72  query will retur
4cd0: 6e 20 61 20 43 6f 6e 63 61 76 65 48 75 6c 6c 20  n a ConcaveHull 
4ce0: 62 61 73 65 64 20 6f 6e 20 49 74 61 6c 79 27 73  based on Italy's
4cf0: 20 70 6f 70 75 6c 61 74 65 64 20 70 6c 61 63 65   populated place
4d00: 73 20 28 61 62 6f 75 74 20 38 2c 30 30 30 2b 20  s (about 8,000+ 
4d10: 50 6f 69 6e 74 73 29 20 62 79 20 61 70 70 6c 79  Points) by apply
4d20: 69 6e 67 20 61 20 3c 62 3e 32 2e 35 26 73 69 67  ing a <b>2.5&sig
4d30: 6d 61 3b 3c 2f 62 3e 20 66 69 6c 74 65 72 69 6e  ma;</b> filterin
4d40: 67 20 66 61 63 74 6f 72 2e 3c 62 72 3e 3c 62 72  g factor.<br><br
4d50: 3e 0d 0a 54 68 65 20 66 69 67 75 72 65 20 61 6c  >..The figure al
4d60: 73 6f 20 73 68 6f 77 73 20 74 68 65 20 43 6f 6e  so shows the Con
4d70: 63 61 76 65 48 75 6c 6c 20 72 65 74 75 72 6e 65  caveHull returne
4d80: 64 20 62 79 20 74 68 65 20 70 72 65 76 69 6f 75  d by the previou
4d90: 73 20 65 78 61 6d 70 6c 65 20 62 79 20 61 70 70  s example by app
4da0: 6c 79 69 6e 67 20 61 20 3c 62 3e 33 26 73 69 67  lying a <b>3&sig
4db0: 6d 61 3b 3c 2f 62 3e 20 66 61 63 74 6f 72 20 28  ma;</b> factor (
4dc0: 72 65 64 20 62 6f 75 6e 64 61 72 79 29 2c 20 73  red boundary), s
4dd0: 6f 20 74 6f 20 65 76 69 64 65 6e 74 69 61 74 65  o to evidentiate
4de0: 20 74 68 65 20 72 65 6c 61 74 69 76 65 20 64 69   the relative di
4df0: 66 66 65 72 65 6e 63 65 73 2e 20 0d 0a 3c 2f 74  fferences. ..</t
4e00: 64 3e 0d 0a 3c 74 64 3e 3c 69 6d 67 20 62 6f 72  d>..<td><img bor
4e10: 64 65 72 3d 22 31 22 20 73 72 63 3d 22 68 74 74  der="1" src="htt
4e20: 70 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73  p://www.gaia-gis
4e30: 2e 69 74 2f 67 61 69 61 2d 73 69 6e 73 2f 77 72  .it/gaia-sins/wr
4e40: 69 74 65 2d 76 69 65 77 2d 70 69 63 73 2f 63 6f  ite-view-pics/co
4e50: 6e 63 61 76 65 32 35 2e 70 6e 67 22 20 61 6c 74  ncave25.png" alt
4e60: 3d 22 63 6f 6e 63 61 76 65 68 75 6c 6c 2d 32 22  ="concavehull-2"
4e70: 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74  ></td></tr>..</t
4e80: 61 62 6c 65 3e 0d 0a 3c 62 72 3e 3c 68 72 3e 0d  able>..<br><hr>.
4e90: 0a 42 61 63 6b 20 74 6f 20 3c 61 20 68 72 65 66  .Back to <a href
4ea0: 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61  ="https://www.ga
4eb0: 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c  ia-gis.it/fossil
4ec0: 2f 6c 69 62 73 70 61 74 69 61 6c 69 74 65 2f 77  /libspatialite/w
4ed0: 69 6b 69 3f 6e 61 6d 65 3d 73 77 69 74 63 68 69  iki?name=switchi
4ee0: 6e 67 2d 74 6f 2d 34 2e 30 23 74 65 73 73 65 6c  ng-to-4.0#tessel
4ef0: 61 74 69 6f 6e 22 3e 6d 61 69 6e 20 70 61 67 65  ation">main page
4f00: 3c 2f 61 3e 0d 0a 0d 0a 0a 5a 20 31 66 39 32 35  </a>.....Z 1f925
4f10: 36 62 61 66 61 35 31 63 39 39 66 61 33 37 39 36  6bafa51c99fa3796
4f20: 30 37 30 33 62 61 33 62 32 34 33 0a              0703ba3b243.