Artifact
341896cf8c8983cf781a56ce2036ebfd7dab0676:
Wiki page
[tesselations-4.0] by
sandro
2012-08-29 22:23:14.
0000: 44 20 32 30 31 32 2d 30 38 2d 32 39 54 32 32 3a D 2012-08-29T22:
0010: 32 33 3a 31 34 2e 34 36 33 0a 4c 20 74 65 73 73 23:14.463.L tess
0020: 65 6c 61 74 69 6f 6e 73 2d 34 2e 30 0a 50 20 35 elations-4.0.P 5
0030: 32 33 33 64 37 66 64 61 63 61 34 33 30 38 32 35 233d7fdaca430825
0040: 66 31 61 33 63 64 38 33 62 63 32 63 34 38 39 64 f1a3cd83bc2c489d
0050: 33 37 62 36 38 39 30 0a 55 20 73 61 6e 64 72 6f 37b6890.U sandro
0060: 0a 57 20 31 35 30 36 35 0a 78 3c 68 32 3e 54 65 .W 15065.x<h2>Te
0070: 73 73 65 6c 61 74 69 6f 6e 2d 72 65 6c 61 74 65 sselation-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 6e 64 65 6e 74 69 based on indenti
0260: 63 61 6c 20 3c 69 3e 63 65 6c 6c 73 3c 2f 69 3e cal <i>cells</i>
0270: 2c 20 61 6c 6c 20 6f 66 20 65 78 61 63 74 6c 79 , all of exactly
0280: 20 74 68 65 20 73 61 6d 65 20 73 68 61 70 65 20 the same shape
0290: 61 6e 64 20 73 69 7a 65 2e 0d 0a 49 6e 20 74 68 and size...In th
02a0: 69 73 20 63 61 73 65 20 77 65 27 6c 6c 20 68 61 is case we'll ha
02b0: 76 65 20 61 20 3c 69 3e 72 65 67 75 6c 61 72 20 ve a <i>regular
02c0: 74 65 73 73 65 6c 6c 61 74 69 6f 6e 3c 2f 69 3e tessellation</i>
02d0: 2e 3c 62 72 3e 0d 0a 4a 75 73 74 20 61 20 71 75 .<br>..Just a qu
02e0: 69 63 6b 20 72 65 63 61 6c 6c 20 6f 66 20 65 6c ick recall of el
02f0: 65 6d 65 6e 74 61 72 79 20 67 65 6f 6d 65 74 72 ementary geometr
0300: 79 3b 20 74 68 65 72 65 20 61 72 65 20 73 69 6d y; there are sim
0310: 70 6c 79 20 3c 62 3e 33 3c 2f 62 3e 20 72 65 67 ply <b>3</b> reg
0320: 75 6c 61 72 20 70 6f 6c 79 67 6f 6e 61 6c 20 73 ular polygonal s
0330: 68 61 70 65 73 20 77 65 20 63 61 6e 20 75 73 65 hapes we can use
0340: 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 67 65 74 in order to get
0350: 20 61 20 72 65 67 75 6c 61 72 20 74 65 73 73 65 a regular tesse
0360: 6c 6c 61 74 69 6f 6e 3a 20 74 68 65 20 3c 62 3e llation: the <b>
0370: 65 71 75 69 6c 61 74 65 72 61 6c 20 74 72 69 61 equilateral tria
0380: 6e 67 6c 65 3c 2f 62 3e 2c 20 74 68 65 20 3c 62 ngle</b>, the <b
0390: 3e 73 71 75 61 72 65 3c 2f 62 3e 20 61 6e 64 20 >square</b> and
03a0: 74 68 65 20 3c 62 3e 72 65 67 75 6c 61 72 20 68 the <b>regular h
03b0: 65 78 61 67 6f 6e 3c 2f 62 3e 2e 3c 62 72 3e 3c exagon</b>.<br><
03c0: 62 72 3e 0d 0a 4f 6e 20 74 68 65 20 6f 74 68 65 br>..On the othe
03d0: 72 20 77 61 79 20 6d 61 6e 79 20 74 65 73 73 65 r way many tesse
03e0: 6c 6c 61 74 69 6f 6e 73 20 61 72 65 6e 27 74 20 llations aren't
03f0: 72 65 67 75 6c 61 72 20 61 74 20 61 6c 6c 2c 20 regular at all,
0400: 62 65 63 61 75 73 65 20 65 61 63 68 20 73 69 6e because each sin
0410: 67 6c 65 20 63 65 6c 6c 20 68 61 73 20 61 6e 20 gle cell has an
0420: 69 6e 64 69 76 69 64 75 61 6c 20 73 69 7a 65 20 individual size
0430: 61 6e 64 20 73 68 61 70 65 20 6f 66 20 69 74 73 and shape of its
0440: 20 6f 77 6e 2e 3c 62 72 3e 0d 0a 49 74 27 73 20 own.<br>..It's
0450: 72 65 61 6c 6c 79 20 69 6e 74 65 72 65 73 74 69 really interesti
0460: 6e 67 20 74 6f 20 6e 6f 74 65 20 74 68 61 74 20 ng to note that
0470: 6d 61 6e 79 20 3c 69 3e 6e 61 74 75 72 61 6c 20 many <i>natural
0480: 73 68 61 70 65 73 3c 2f 69 3e 20 63 6c 6f 73 65 shapes</i> close
0490: 6c 79 20 72 65 73 65 6d 62 6c 65 20 61 20 74 65 ly resemble a te
04a0: 73 73 65 6c 6c 61 74 69 6f 6e 3a 20 67 6f 69 6e ssellation: goin
04b0: 67 20 66 72 6f 6d 20 62 69 6f 6c 6f 67 79 20 74 g from biology t
04c0: 6f 20 63 72 69 73 74 61 6c 6c 6f 67 72 61 70 68 o cristallograph
04d0: 79 20 73 69 6e 63 65 20 67 65 6f 6c 6f 67 79 20 y since geology
04e0: 61 6e 64 20 6c 61 6e 64 73 63 61 70 65 73 20 69 and landscapes i
04f0: 74 27 73 20 6e 6f 74 20 61 74 20 61 6c 6c 20 64 t's not at all d
0500: 69 66 66 69 63 75 6c 74 20 74 6f 20 69 64 65 6e ifficult to iden
0510: 74 69 66 79 20 6d 61 6e 79 20 6e 61 74 75 72 61 tify many natura
0520: 6c 20 74 65 73 73 65 6c 6c 61 74 69 6f 6e 20 65 l tessellation e
0530: 78 61 6d 70 6c 65 73 20 3c 69 3e 6f 6e 20 74 68 xamples <i>on th
0540: 65 20 77 69 6c 64 3c 2f 69 3e 2e 0d 0a 53 6f 20 e wild</i>...So
0550: 69 74 27 73 20 6e 6f 74 20 61 74 20 61 6c 6c 20 it's not at all
0560: 73 75 72 70 72 69 73 69 6e 67 20 74 6f 20 64 69 surprising to di
0570: 73 63 6f 76 65 72 20 74 68 61 74 20 74 65 73 73 scover that tess
0580: 65 6c 6c 61 74 69 6f 6e 73 20 61 72 65 20 6f 66 ellations are of
0590: 74 65 6e 20 75 73 65 66 75 6c 20 69 6e 20 67 65 ten useful in ge
05a0: 6f 67 72 61 70 68 79 20 61 73 20 77 65 6c 6c 2e ography as well.
05b0: 0d 0a 3c 68 33 3e 53 65 74 74 69 6e 67 20 75 70 ..<h3>Setting up
05c0: 20 61 20 74 65 73 74 62 65 64 20 44 42 3c 2f 68 a testbed DB</h
05d0: 33 3e 0d 0a 49 6e 20 74 68 69 73 20 73 68 6f 72 3>..In this shor
05e0: 74 20 74 75 74 6f 72 69 61 6c 20 77 65 27 6c 6c t tutorial we'll
05f0: 20 75 73 65 20 61 20 76 65 72 79 20 73 69 6d 70 use a very simp
0600: 6c 65 20 53 70 61 74 69 61 4c 69 74 65 20 44 42 le SpatiaLite DB
0610: 2c 20 6a 75 73 74 20 63 6f 6e 74 61 69 6e 69 6e , just containin
0620: 67 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 g the following
0630: 47 65 6f 6d 65 74 72 79 20 74 61 62 6c 65 73 3a Geometry tables:
0640: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 41 64 6d 69 6e 69 <ul>..<li>Admini
0650: 73 74 72 61 74 69 76 65 20 62 6f 75 6e 64 61 72 strative boundar
0660: 69 65 73 20 66 6f 72 20 49 74 61 6c 79 20 72 65 ies for Italy re
0670: 67 69 6f 6e 73 3a 20 79 6f 75 20 63 61 6e 20 3c gions: you can <
0680: 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 a href="http://w
0690: 77 77 2e 69 73 74 61 74 2e 69 74 2f 69 74 2f 66 ww.istat.it/it/f
06a0: 69 6c 65 73 2f 32 30 31 31 2f 30 34 2f 72 65 67 iles/2011/04/reg
06b0: 32 30 31 31 2e 7a 69 70 22 3e 64 6f 77 6e 6c 6f 2011.zip">downlo
06c0: 61 64 3c 2f 61 3e 20 74 68 69 73 20 64 61 74 61 ad</a> this data
06d0: 73 65 74 20 66 72 6f 6d 20 49 53 54 41 54 20 28 set from ISTAT (
06e0: 72 65 6c 65 61 73 65 64 20 6f 6e 20 43 43 2d 42 released on CC-B
06f0: 59 20 6c 69 63 65 6e 73 65 20 74 65 72 6d 73 29 Y license terms)
0700: 2e 3c 62 72 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e .<br></li>..<li>
0710: 4d 61 69 6e 20 49 74 61 6c 69 61 6e 20 70 6f 70 Main Italian pop
0720: 75 6c 61 74 65 64 20 70 6c 61 63 65 73 20 28 6e ulated places (n
0730: 61 6d 65 6c 79 2c 20 4c 6f 63 61 6c 20 43 6f 75 amely, Local Cou
0740: 6e 63 69 6c 73 29 3a 20 79 6f 75 20 63 61 6e 20 ncils): you can
0750: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f <a href="http://
0760: 64 6f 77 6e 6c 6f 61 64 2e 67 65 6f 6e 61 6d 65 download.geoname
0770: 73 2e 6f 72 67 2f 65 78 70 6f 72 74 2f 64 75 6d s.org/export/dum
0780: 70 2f 61 6c 6c 43 6f 75 6e 74 72 69 65 73 2e 7a p/allCountries.z
0790: 69 70 22 3e 64 6f 77 6e 6c 6f 61 64 3c 2f 61 3e ip">download</a>
07a0: 20 74 68 69 73 20 64 61 74 61 73 65 74 20 66 72 this dataset fr
07b0: 6f 6d 20 47 65 6f 4e 61 6d 65 73 20 28 72 65 6c om GeoNames (rel
07c0: 65 61 73 65 64 20 6f 6e 20 43 43 2d 42 59 20 6c eased on CC-BY l
07d0: 69 63 65 6e 73 65 20 74 65 72 6d 73 29 2e 3c 62 icense terms).<b
07e0: 72 3e 0d 0a 50 6c 65 61 73 65 20 6e 6f 74 65 3a r>..Please note:
07f0: 20 74 68 69 73 20 6f 6e 65 20 69 73 20 61 20 77 this one is a w
0800: 6f 72 6c 64 77 69 64 65 20 64 61 74 61 73 65 74 orldwide dataset
0810: 3b 20 69 74 61 6c 69 61 6e 20 70 6f 70 75 6c 61 ; italian popula
0820: 74 65 64 20 70 6c 61 63 65 73 20 68 61 76 65 20 ted places have
0830: 74 68 65 6e 20 62 65 65 6e 20 65 78 74 72 61 63 then been extrac
0840: 74 65 64 20 69 6d 70 6f 73 69 6e 67 20 74 68 65 ted imposing the
0850: 20 53 51 4c 20 63 6c 61 75 73 65 3c 62 72 3e 0d SQL clause<br>.
0860: 0a 3c 62 3e 57 48 45 52 45 20 63 6f 75 6e 74 79 .<b>WHERE county
0870: 5f 63 6f 64 65 20 3d 20 27 49 54 27 20 41 4e 44 _code = 'IT' AND
0880: 20 70 6f 70 75 6c 61 74 69 6f 6e 20 3e 20 30 3c population > 0<
0890: 2f 62 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c /b></li>..</ul><
08a0: 62 72 3e 0d 0a 4a 75 73 74 20 74 6f 20 6b 65 65 br>..Just to kee
08b0: 70 20 61 6e 79 20 65 78 61 6d 70 6c 65 20 61 73 p any example as
08c0: 20 73 69 6d 70 6c 65 20 61 73 20 70 6f 73 73 69 simple as possi
08d0: 62 6c 65 2c 20 62 6f 74 68 20 64 61 74 61 73 65 ble, both datase
08e0: 74 73 20 68 61 76 65 20 62 65 65 6e 20 72 65 66 ts have been ref
08f0: 65 72 65 6e 63 65 64 20 69 6e 74 6f 20 74 68 65 erenced into the
0900: 20 3c 62 3e 53 52 49 44 3d 32 33 30 33 32 20 2d <b>SRID=23032 -
0910: 20 45 44 35 30 20 2f 20 55 4d 54 33 32 20 7a 6f ED50 / UMT32 zo
0920: 6e 65 20 4e 3c 2f 62 3e 0d 0a 3c 62 72 3e 3c 62 ne 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 20 67 72 69 64 2e 3c 2f 6c 69 3e 0d 0a 3c rn grid.</li>..<
0c20: 6c 69 3e 74 68 65 20 3c 62 3e 73 69 7a 65 3c 2f li>the <b>size</
0c30: 62 3e 20 61 72 67 75 6d 65 6e 74 20 69 64 65 6e b> argument iden
0c40: 74 69 66 69 65 73 20 74 68 65 20 65 64 67 65 20 tifies the edge
0c50: 6c 65 6e 67 74 68 20 6f 66 20 74 68 65 20 67 72 length of the gr
0c60: 69 64 20 63 65 6c 6c 2e 3c 2f 6c 69 3e 0d 0a 3c id cell.</li>..<
0c70: 6c 69 3e 74 68 65 20 66 61 63 75 6c 74 61 74 69 li>the facultati
0c80: 76 65 20 3c 62 3e 65 64 67 65 73 5f 6f 6e 6c 79 ve <b>edges_only
0c90: 3c 2f 62 3e 20 61 72 67 75 6d 65 6e 74 20 77 69 </b> argument wi
0ca0: 6c 6c 20 62 65 20 69 6e 74 65 72 70 72 65 74 65 ll be interprete
0cb0: 64 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 3c 75 6c d as follows:<ul
0cc0: 3e 0d 0a 3c 6c 69 3e 69 66 20 3c 62 3e 46 41 4c >..<li>if <b>FAL
0cd0: 53 45 3c 2f 62 3e 20 28 3c 69 3e 64 65 66 61 75 SE</b> (<i>defau
0ce0: 6c 74 20 76 61 6c 75 65 3c 2f 69 3e 29 20 61 20 lt value</i>) a
0cf0: 4d 75 6c 74 69 50 6f 6c 79 67 6f 6e 20 77 69 6c MultiPolygon wil
0d00: 6c 20 62 65 20 72 65 74 75 72 6e 65 64 2e 3c 2f l be returned.</
0d10: 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 3c 62 3e 54 li>..<li>if <b>T
0d20: 52 55 45 3c 2f 62 3e 20 61 20 4d 75 6c 74 69 4c RUE</b> a MultiL
0d30: 69 6e 65 73 74 72 69 6e 67 20 77 69 6c 6c 20 62 inestring will b
0d40: 65 20 72 65 74 75 72 6e 65 64 20 28 73 69 6d 70 e returned (simp
0d50: 6c 79 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 ly representing
0d60: 74 68 65 20 63 65 6c 6c 73 20 65 64 67 65 73 29 the cells edges)
0d70: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c .</li>..</ul></l
0d80: 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 66 61 63 75 i>..<li>the facu
0d90: 6c 74 61 74 69 76 65 20 3c 62 3e 6f 72 69 67 69 ltative <b>origi
0da0: 6e 3c 2f 62 3e 20 47 65 6f 6d 65 74 72 79 20 69 n</b> Geometry i
0db0: 73 20 61 6c 77 61 79 73 20 61 73 73 75 6d 65 64 s always assumed
0dc0: 20 74 6f 20 62 65 20 61 20 50 6f 69 6e 74 2c 20 to be a Point,
0dd0: 61 6e 64 20 77 69 6c 6c 20 69 64 65 6e 74 69 66 and will identif
0de0: 79 20 74 68 65 20 67 72 69 64 27 73 20 6f 72 69 y the grid's ori
0df0: 67 69 6e 2e 3c 62 72 3e 0d 0a 42 79 20 64 65 66 gin.<br>..By def
0e00: 61 75 6c 74 20 61 20 3c 62 3e 28 30 2c 20 30 29 ault a <b>(0, 0)
0e10: 3c 2f 62 3e 20 6f 72 69 67 69 6e 20 77 69 6c 6c </b> origin will
0e20: 20 62 65 20 61 73 73 75 6d 65 64 2e 3c 2f 6c 69 be assumed.</li
0e30: 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 74 64 3e 3c 2f 74 >..</ul></td></t
0e40: 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 68 r>..<tr><td>..<h
0e50: 34 3e 75 73 69 6e 67 20 53 71 75 61 72 65 20 63 4>using Square c
0e60: 65 6c 6c 73 3c 2f 68 34 3e 0d 0a 3c 74 61 62 6c ells</h4>..<tabl
0e70: 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 e bgcolor="#f0f0
0e80: 66 30 22 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d f0" cellspacing=
0e90: 22 34 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d "4" cellpadding=
0ea0: 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a "8">..<tr><td>..
0eb0: 3c 62 3e 53 45 4c 45 43 54 20 53 54 5f 53 71 75 <b>SELECT ST_Squ
0ec0: 61 72 65 47 72 69 64 28 67 65 6f 6d 65 74 72 79 areGrid(geometry
0ed0: 2c 20 31 30 30 30 30 29 3c 62 72 3e 0d 0a 46 52 , 10000)<br>..FR
0ee0: 4f 4d 20 72 65 67 69 6f 6e 73 3c 62 72 3e 57 48 OM regions<br>WH
0ef0: 45 52 45 20 63 6f 64 5f 72 65 67 20 3d 20 39 3b ERE cod_reg = 9;
0f00: 3c 2f 62 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e </b>..</td></tr>
0f10: 0d 0a 3c 2f 74 61 62 6c 65 3e 3c 62 72 3e 0d 0a ..</table><br>..
0f20: 54 68 69 73 20 53 51 4c 20 71 75 65 72 79 20 77 This SQL query w
0f30: 69 6c 6c 20 72 65 74 75 72 6e 20 61 20 72 65 67 ill return a reg
0f40: 75 6c 61 72 20 67 72 69 64 20 28 73 71 75 61 72 ular grid (squar
0f50: 65 20 63 65 6c 6c 73 29 20 63 6f 76 65 72 69 6e e cells) coverin
0f60: 67 20 54 75 73 63 61 6e 79 20 28 3c 62 3e 63 6f g Tuscany (<b>co
0f70: 64 5f 72 65 67 3d 39 3c 2f 62 3e 29 2e 3c 62 72 d_reg=9</b>).<br
0f80: 3e 0d 0a 45 61 63 68 20 67 72 69 64 27 73 20 63 >..Each grid's c
0f90: 65 6c 6c 20 77 69 6c 6c 20 68 61 76 65 20 61 6e ell will have an
0fa0: 20 65 64 67 65 20 6c 65 6e 67 74 68 20 6f 66 20 edge length of
0fb0: 65 78 61 63 74 6c 79 20 3c 62 3e 31 30 20 4b 6d exactly <b>10 Km
0fc0: 3c 2f 62 3e 0d 0a 3c 2f 74 64 3e 0d 0a 3c 74 64 </b>..</td>..<td
0fd0: 3e 3c 69 6d 67 20 62 6f 72 64 65 72 3d 22 31 22 ><img border="1"
0fe0: 20 73 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77 src="http://www
0ff0: 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 .gaia-gis.it/gai
1000: 61 2d 73 69 6e 73 2f 77 72 69 74 65 2d 76 69 65 a-sins/write-vie
1010: 77 2d 70 69 63 73 2f 73 71 75 61 72 65 2d 67 72 w-pics/square-gr
1020: 69 64 2e 70 6e 67 22 20 61 6c 74 3d 22 73 71 75 id.png" alt="squ
1030: 61 72 65 20 67 72 69 64 22 3e 3c 2f 74 64 3e 3c are grid"></td><
1040: 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a /tr>..<tr><td>..
1050: 3c 68 34 3e 75 73 69 6e 67 20 54 72 69 61 6e 67 <h4>using Triang
1060: 75 6c 61 72 20 63 65 6c 6c 73 3c 2f 68 34 3e 0d ular cells</h4>.
1070: 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d .<table bgcolor=
1080: 22 23 66 30 66 30 66 30 22 20 63 65 6c 6c 73 70 "#f0f0f0" cellsp
1090: 61 63 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 acing="4" cellpa
10a0: 64 64 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e dding="8">..<tr>
10b0: 3c 74 64 3e 0d 0a 3c 62 3e 53 45 4c 45 43 54 20 <td>..<b>SELECT
10c0: 53 54 5f 54 72 69 61 6e 67 75 6c 61 72 47 72 69 ST_TriangularGri
10d0: 64 28 67 65 6f 6d 65 74 72 79 2c 20 31 30 30 30 d(geometry, 1000
10e0: 30 29 3c 62 72 3e 0d 0a 46 52 4f 4d 20 72 65 67 0)<br>..FROM reg
10f0: 69 6f 6e 73 3c 62 72 3e 57 48 45 52 45 20 63 6f ions<br>WHERE co
1100: 64 5f 72 65 67 20 3d 20 39 3b 3c 2f 62 3e 0d 0a d_reg = 9;</b>..
1110: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 </td></tr>..</ta
1120: 62 6c 65 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 3e 3c ble></td>..<td><
1130: 69 6d 67 20 62 6f 72 64 65 72 3d 22 31 22 20 73 img border="1" s
1140: 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 67 rc="http://www.g
1150: 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d aia-gis.it/gaia-
1160: 73 69 6e 73 2f 77 72 69 74 65 2d 76 69 65 77 2d sins/write-view-
1170: 70 69 63 73 2f 74 72 69 2d 67 72 69 64 2e 70 6e pics/tri-grid.pn
1180: 67 22 20 61 6c 74 3d 22 74 72 69 61 6e 67 75 6c g" alt="triangul
1190: 61 72 20 67 72 69 64 22 3e 3c 2f 74 64 3e 3c 2f ar grid"></td></
11a0: 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c tr>..<tr><td>..<
11b0: 68 34 3e 75 73 69 6e 67 20 48 65 78 61 67 6f 6e h4>using Hexagon
11c0: 61 6c 20 63 65 6c 6c 73 3c 2f 68 34 3e 0d 0a 3c al cells</h4>..<
11d0: 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 table bgcolor="#
11e0: 66 30 66 30 66 30 22 20 63 65 6c 6c 73 70 61 63 f0f0f0" cellspac
11f0: 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 ing="4" cellpadd
1200: 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74 ing="8">..<tr><t
1210: 64 3e 0d 0a 3c 62 3e 53 45 4c 45 43 54 20 53 54 d>..<b>SELECT ST
1220: 5f 48 65 78 61 67 6f 6e 61 6c 47 72 69 64 28 67 _HexagonalGrid(g
1230: 65 6f 6d 65 74 72 79 2c 20 31 30 30 30 30 29 3c eometry, 10000)<
1240: 62 72 3e 0d 0a 46 52 4f 4d 20 72 65 67 69 6f 6e br>..FROM region
1250: 73 3c 62 72 3e 57 48 45 52 45 20 63 6f 64 5f 72 s<br>WHERE cod_r
1260: 65 67 20 3d 20 39 3b 3c 2f 62 3e 0d 0a 3c 2f 74 eg = 9;</b>..</t
1270: 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 d></tr>..</table
1280: 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 3e 3c 69 6d 67 ></td>..<td><img
1290: 20 62 6f 72 64 65 72 3d 22 31 22 20 73 72 63 3d border="1" src=
12a0: 22 68 74 74 70 3a 2f 2f 77 77 77 2e 67 61 69 61 "http://www.gaia
12b0: 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d 73 69 6e -gis.it/gaia-sin
12c0: 73 2f 77 72 69 74 65 2d 76 69 65 77 2d 70 69 63 s/write-view-pic
12d0: 73 2f 68 65 78 2d 67 72 69 64 2e 70 6e 67 22 20 s/hex-grid.png"
12e0: 61 6c 74 3d 22 68 65 78 61 67 6f 6e 61 6c 20 67 alt="hexagonal g
12f0: 72 69 64 22 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d rid"></td></tr>.
1300: 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 3c .</table>..<br><
1310: 68 72 3e 0d 0a 3c 68 33 3e 44 65 6c 61 75 6e 61 hr>..<h3>Delauna
1320: 79 20 54 72 69 61 6e 67 75 6c 61 74 69 6f 6e 73 y Triangulations
1330: 3c 2f 68 33 3e 0d 0a 54 72 69 61 6e 67 75 6c 61 </h3>..Triangula
1340: 74 69 6f 6e 73 20 73 69 6d 70 6c 79 20 72 65 70 tions simply rep
1350: 72 65 73 65 6e 74 20 61 20 73 70 65 63 69 61 6c resent a special
1360: 20 63 61 73 65 20 6f 66 20 74 65 73 73 65 6c 6c case of tessell
1370: 61 74 69 6f 6e 73 3a 20 69 6e 20 74 68 69 73 20 ations: in this
1380: 63 61 73 65 20 61 6c 6c 20 63 65 6c 6c 73 20 61 case all cells a
1390: 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 62 re represented b
13a0: 79 20 67 65 6e 65 72 69 63 20 3c 62 3e 74 72 69 y generic <b>tri
13b0: 61 6e 67 6c 65 73 3c 2f 62 3e 2c 20 6e 6f 74 20 angles</b>, not
13c0: 6e 65 63 65 73 73 61 72 69 6c 79 20 6f 66 20 74 necessarily of t
13d0: 68 65 20 65 71 75 69 6c 61 74 65 72 61 6c 20 6b he equilateral k
13e0: 69 6e 64 2e 3c 62 72 3e 0d 0a 41 20 3c 62 3e 44 ind.<br>..A <b>D
13f0: 65 6c 61 75 6e 61 79 20 54 72 69 61 6e 67 75 6c elaunay Triangul
1400: 61 74 69 6f 6e 3c 2f 62 3e 20 69 73 20 76 65 72 ation</b> is ver
1410: 79 20 70 65 63 75 6c 69 61 72 2c 20 69 6d 70 6f y peculiar, impo
1420: 73 69 6e 67 20 61 20 73 70 65 63 69 66 69 63 20 sing a specific
1430: 63 6f 6e 73 74 72 61 69 6e 74 2e 3c 62 72 3e 0d constraint.<br>.
1440: 0a 41 6c 6c 20 74 72 69 61 6e 67 6c 65 73 20 69 .All triangles i
1450: 6e 20 61 20 44 65 6c 61 75 6e 61 79 20 74 72 69 n a Delaunay tri
1460: 61 6e 67 75 6c 61 74 69 6f 6e 20 6d 75 73 74 20 angulation must
1470: 73 61 74 69 73 66 79 20 74 68 65 20 3c 75 3e 3c satisfy the <u><
1480: 69 3e 65 6d 70 74 79 20 63 69 72 63 6c 65 3c 2f i>empty circle</
1490: 69 3e 3c 2f 75 3e 20 70 72 6f 70 65 72 74 79 3a i></u> property:
14a0: 20 69 2e 65 2e 20 66 6f 72 20 65 61 63 68 20 65 i.e. for each e
14b0: 64 67 65 20 77 65 20 63 61 6e 20 66 69 6e 64 20 dge we can find
14c0: 61 20 63 69 72 63 6c 65 20 63 6f 6e 74 61 69 6e a circle contain
14d0: 69 6e 67 20 74 68 65 20 65 64 67 65 27 73 20 65 ing the edge's e
14e0: 6e 64 70 6f 69 6e 74 73 20 62 75 74 20 6e 6f 74 ndpoints but not
14f0: 20 63 6f 6e 74 61 69 6e 69 6e 67 20 61 6e 79 20 containing any
1500: 6f 74 68 65 72 20 70 6f 69 6e 74 73 2e 0d 0a 3c other points...<
1510: 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 65 a href="http://e
1520: 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72 67 2f n.wikipedia.org/
1530: 77 69 6b 69 2f 44 65 6c 61 75 6e 61 79 5f 74 72 wiki/Delaunay_tr
1540: 69 61 6e 67 75 6c 61 74 69 6f 6e 22 3e 72 65 61 iangulation">rea
1550: 64 20 6d 6f 72 65 3c 2f 61 3e 3c 62 72 3e 3c 62 d more</a><br><b
1560: 72 3e 0d 0a 43 6f 6d 70 75 74 69 6e 67 20 61 20 r>..Computing a
1570: 44 65 6c 61 75 6e 61 79 20 54 72 69 61 6e 67 75 Delaunay Triangu
1580: 6c 61 74 69 6f 6e 20 72 65 70 72 65 73 65 6e 74 lation represent
1590: 69 6e 67 20 6d 61 6e 79 20 70 6f 69 6e 74 73 20 ing many points
15a0: 69 73 20 61 20 76 65 72 79 20 63 6f 6d 70 6c 65 is a very comple
15b0: 78 20 6f 70 65 61 74 69 6f 6e 2c 20 61 6e 64 20 x opeation, and
15c0: 6f 6e 65 20 70 6f 73 73 69 62 69 6c 79 20 69 6d one possibily im
15d0: 70 6f 73 69 6e 67 20 61 20 68 75 67 65 20 63 6f posing a huge co
15e0: 6d 70 75 74 61 74 69 6f 6e 61 6c 20 6c 6f 61 64 mputational load
15f0: 20 61 6e 64 20 6d 61 79 20 62 65 20 72 65 71 75 and may be requ
1600: 69 72 69 6e 67 20 61 20 6c 6f 6e 67 20 74 69 6d iring a long tim
1610: 65 2e 0d 0a 48 61 70 70 69 6c 79 20 65 6e 6f 75 e...Happily enou
1620: 67 68 20 6d 61 6e 79 20 68 69 67 68 6c 79 20 65 gh many highly e
1630: 66 66 69 63 69 65 6e 74 20 61 6c 67 68 6f 72 69 fficient alghori
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 61 6c 61 75 6e 61 for the Dalauna
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 66 </li>..<li>the f
1af0: 61 63 75 6c 74 61 74 69 76 65 20 3c 62 3e 65 64 acultative <b>ed
1b00: 67 65 73 5f 6f 6e 6c 79 3c 2f 62 3e 20 61 72 67 ges_only</b> arg
1b10: 75 6d 65 6e 74 20 77 69 6c 6c 20 62 65 20 69 6e ument will be in
1b20: 74 65 72 70 72 65 74 65 64 20 61 73 20 66 6f 6c terpreted as fol
1b30: 6c 6f 77 73 3a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69 lows:<ul>..<li>i
1b40: 66 20 3c 62 3e 46 41 4c 53 45 3c 2f 62 3e 20 28 f <b>FALSE</b> (
1b50: 3c 69 3e 64 65 66 61 75 6c 74 20 76 61 6c 75 65 <i>default value
1b60: 3c 2f 69 3e 29 20 61 20 4d 75 6c 74 69 50 6f 6c </i>) a MultiPol
1b70: 79 67 6f 6e 20 77 69 6c 6c 20 62 65 20 72 65 74 ygon will be ret
1b80: 75 72 6e 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 urned.</li>..<li
1b90: 3e 69 66 20 3c 62 3e 54 52 55 45 3c 2f 62 3e 20 >if <b>TRUE</b>
1ba0: 61 20 4d 75 6c 74 69 4c 69 6e 65 73 74 72 69 6e a MultiLinestrin
1bb0: 67 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72 6e g will be return
1bc0: 65 64 20 28 73 69 6d 70 6c 79 20 72 65 70 72 65 ed (simply repre
1bd0: 73 65 6e 74 69 6e 67 20 74 68 65 20 74 72 69 61 senting the tria
1be0: 6e 67 6c 65 73 20 65 64 67 65 73 29 2e 3c 2f 6c ngles edges).</l
1bf0: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a i>..</ul></li>..
1c00: 3c 6c 69 3e 74 68 65 20 66 61 63 75 6c 74 61 74 <li>the facultat
1c10: 69 76 65 20 3c 62 3e 74 6f 6c 65 72 61 6e 63 65 ive <b>tolerance
1c20: 3c 2f 62 3e 20 61 72 67 75 6d 65 6e 74 20 69 73 </b> argument is
1c30: 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 6e 6f 72 intended to nor
1c40: 6d 61 6c 69 7a 65 20 74 68 65 20 69 6e 70 75 74 malize the input
1c50: 20 70 6f 69 6e 74 2d 73 65 74 2c 20 73 75 70 70 point-set, supp
1c60: 72 65 73 73 69 6e 67 20 72 65 70 65 61 74 65 64 ressing repeated
1c70: 20 28 6f 72 20 74 6f 6f 20 6d 75 63 68 20 63 6c (or too much cl
1c80: 6f 73 65 29 20 70 6f 69 6e 74 73 2e 3c 62 72 3e ose) points.<br>
1c90: 0d 0a 42 79 20 64 65 66 61 75 6c 74 20 61 20 3c ..By default a <
1ca0: 62 3e 30 2e 30 3c 2f 62 3e 20 74 6f 6c 65 72 61 b>0.0</b> tolera
1cb0: 6e 63 65 20 77 69 6c 6c 20 62 65 20 61 73 73 75 nce will be assu
1cc0: 6d 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e med.</li>..</ul>
1cd0: 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c </td></tr></tabl
1ce0: 65 3e 0d 0a 3c 74 61 62 6c 65 20 63 65 6c 6c 73 e>..<table cells
1cf0: 70 61 63 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 pacing="4" cellp
1d00: 61 64 64 69 6e 67 3d 22 34 22 3e 0d 0a 3c 74 72 adding="4">..<tr
1d10: 3e 3c 74 64 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 ><td>..<table bg
1d20: 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 30 22 20 color="#f0f0f0"
1d30: 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 34 22 20 cellspacing="4"
1d40: 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 38 22 3e cellpadding="8">
1d50: 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 53 ..<tr><td>..<b>S
1d60: 45 4c 45 43 54 20 53 54 5f 44 65 6c 61 75 6e 61 ELECT ST_Delauna
1d70: 79 54 72 69 61 6e 67 75 6c 61 74 69 6f 6e 28 53 yTriangulation(S
1d80: 54 5f 43 6f 6c 6c 65 63 74 28 67 65 6f 6d 65 74 T_Collect(geomet
1d90: 72 79 29 29 3c 62 72 3e 0d 0a 46 52 4f 4d 20 69 ry))<br>..FROM i
1da0: 74 61 6c 79 5f 70 6f 70 75 6c 61 74 65 64 5f 70 taly_populated_p
1db0: 6c 61 63 65 73 3b 3c 2f 62 3e 0d 0a 3c 2f 74 64 laces;</b>..</td
1dc0: 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e ></tr>..</table>
1dd0: 3c 62 72 3e 0d 0a 54 68 69 73 20 53 51 4c 20 71 <br>..This SQL q
1de0: 75 65 72 79 20 77 69 6c 6c 20 72 65 74 75 72 6e uery will return
1df0: 20 61 20 44 65 6c 61 75 6e 61 79 20 54 72 69 61 a Delaunay Tria
1e00: 6e 67 75 6c 61 74 69 6f 6e 20 62 61 73 65 64 20 ngulation based
1e10: 6f 6e 20 49 74 61 6c 79 27 73 20 70 6f 70 75 6c on Italy's popul
1e20: 61 74 65 64 20 70 6c 61 63 65 73 20 28 61 62 6f ated places (abo
1e30: 75 74 20 38 2c 30 30 30 2b 20 50 6f 69 6e 74 73 ut 8,000+ Points
1e40: 29 2e 3c 62 72 3e 0d 0a 54 68 65 20 76 69 73 75 ).<br>..The visu
1e50: 61 6c 20 65 78 61 6d 70 6c 65 20 73 69 6d 70 6c al example simpl
1e60: 79 20 63 6f 76 65 72 73 20 54 75 73 63 61 6e 79 y covers Tuscany
1e70: 2c 20 73 6f 20 74 68 65 20 65 6e 73 75 72 65 20 , so the ensure
1e80: 61 6e 20 65 61 73 79 20 72 65 61 64 69 62 69 6c an easy readibil
1e90: 69 74 79 2e 20 0d 0a 3c 2f 74 64 3e 0d 0a 3c 74 ity. ..</td>..<t
1ea0: 64 3e 3c 69 6d 67 20 62 6f 72 64 65 72 3d 22 31 d><img border="1
1eb0: 22 20 73 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 " src="http://ww
1ec0: 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 w.gaia-gis.it/ga
1ed0: 69 61 2d 73 69 6e 73 2f 77 72 69 74 65 2d 76 69 ia-sins/write-vi
1ee0: 65 77 2d 70 69 63 73 2f 64 65 6c 61 75 6e 61 79 ew-pics/delaunay
1ef0: 2e 70 6e 67 22 20 61 6c 74 3d 22 64 65 6c 61 75 .png" alt="delau
1f00: 6e 61 79 20 74 72 69 61 6e 67 75 6c 61 74 69 6f nay triangulatio
1f10: 6e 22 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c n"></td></tr>..<
1f20: 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 3c 68 72 /table>..<br><hr
1f30: 3e 0d 0a 3c 68 33 3e 56 6f 72 6f 6e 6f 6a 20 44 >..<h3>Voronoj D
1f40: 69 61 67 72 61 6d 73 3c 2f 68 33 3e 0d 0a 3c 74 iagrams</h3>..<t
1f50: 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 6e 67 able cellspacing
1f60: 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 ="4" cellpadding
1f70: 3d 22 34 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 3c ="4">..<tr><td><
1f80: 69 6d 67 20 62 6f 72 64 65 72 3d 22 31 22 20 73 img border="1" s
1f90: 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 67 rc="http://www.g
1fa0: 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d aia-gis.it/gaia-
1fb0: 73 69 6e 73 2f 77 72 69 74 65 2d 76 69 65 77 2d sins/write-view-
1fc0: 70 69 63 73 2f 76 6f 72 6f 6e 6f 6a 2d 31 2e 70 pics/voronoj-1.p
1fd0: 6e 67 22 20 61 6c 74 3d 22 76 6f 72 6f 6e 6f 6a ng" alt="voronoj
1fe0: 2d 64 65 6c 61 75 6e 61 79 20 72 65 6c 61 74 69 -delaunay relati
1ff0: 6f 6e 73 68 69 70 22 3e 0d 0a 3c 2f 74 64 3e 3c onship">..</td><
2000: 74 64 3e 0d 0a 54 68 65 20 3c 62 3e 56 6f 72 6f td>..The <b>Voro
2010: 6e 6f 6a 20 44 69 61 67 72 61 6d 3c 2f 62 3e 20 noj Diagram</b>
2020: 73 69 6d 70 6c 79 20 69 73 20 74 68 65 20 3c 69 simply is the <i
2030: 3e 3c 75 3e 64 75 61 6c 20 67 72 61 70 68 3c 2f ><u>dual graph</
2040: 75 3e 3c 2f 69 3e 20 6f 66 20 74 68 65 20 3c 62 u></i> of the <b
2050: 3e 44 65 6c 61 75 6e 61 79 20 54 72 69 61 6e 67 >Delaunay Triang
2060: 75 6c 61 74 69 6f 6e 3c 2f 62 3e 2e 0d 0a 41 20 ulation</b>...A
2070: 56 6f 72 6f 6e 6f 6a 20 44 69 61 67 72 61 6d 20 Voronoj Diagram
2080: 73 74 69 6c 6c 20 69 73 20 61 20 74 65 73 73 65 still is a tesse
2090: 6c 6c 61 74 69 6f 6e 2c 20 61 6e 64 20 63 65 6c llation, and cel
20a0: 6c 73 20 69 6e 20 61 20 56 6f 72 6f 6e 6f 6a 20 ls in a Voronoj
20b0: 63 61 6e 20 68 61 76 65 20 61 6e 79 20 61 72 62 can have any arb
20c0: 69 74 72 61 72 79 20 70 6f 6c 79 67 6f 6e 61 6c itrary polygonal
20d0: 20 28 69 72 72 65 67 75 6c 61 72 29 20 73 68 61 (irregular) sha
20e0: 70 65 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68 69 pe.<br><br>..Thi
20f0: 73 20 66 69 67 75 72 65 20 63 6c 65 61 72 6c 79 s figure clearly
2100: 20 73 68 6f 77 73 20 74 68 65 20 72 65 6c 61 74 shows the relat
2110: 69 6f 6e 20 6a 6f 69 6e 69 6e 67 20 74 68 65 20 ion joining the
2120: 44 65 6c 61 75 6e 61 79 20 54 72 69 61 6e 67 75 Delaunay Triangu
2130: 6c 61 74 69 6f 6e 20 61 6e 64 20 74 68 65 20 63 lation and the c
2140: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 56 6f 72 orresponding Vor
2150: 6f 6e 6f 6a 20 44 69 61 67 72 61 6d 2e 3c 62 72 onoj Diagram.<br
2160: 3e 3c 62 72 3e 0d 0a 45 61 63 68 20 73 69 6e 67 ><br>..Each sing
2170: 6c 65 20 56 6f 72 6f 6e 6f 6a 27 73 20 63 65 6c le Voronoj's cel
2180: 6c 20 69 73 20 6f 62 74 61 69 6e 65 64 20 62 79 l is obtained by
2190: 20 63 6f 6e 6e 65 63 74 69 6e 67 20 61 6c 6c 20 connecting all
21a0: 74 68 65 20 3c 69 3e 63 69 72 63 75 6d 63 65 6e the <i>circumcen
21b0: 74 65 72 73 3c 2f 69 3e 20 6f 66 20 61 64 6a 61 ters</i> of adja
21c0: 63 65 6e 74 20 44 65 6c 61 75 6e 61 79 27 73 20 cent Delaunay's
21d0: 74 72 69 61 6e 67 6c 65 73 3b 20 63 6f 6e 73 65 triangles; conse
21e0: 71 75 65 6e 74 6c 79 20 65 61 63 68 20 56 6f 72 quently each Vor
21f0: 6f 6e 6f 6a 20 63 65 6c 6c 20 73 75 72 65 6c 79 onoj cell surely
2200: 20 63 6f 6e 74 61 69 6e 73 20 6f 6e 65 20 28 61 contains one (a
2210: 6e 64 20 6f 6e 6c 79 20 6f 6e 65 29 20 44 65 6c nd only one) Del
2220: 61 75 6e 61 79 27 73 20 6e 6f 64 65 2e 3c 62 72 aunay's node.<br
2230: 3e 3c 62 72 3e 0d 0a 54 68 65 20 63 65 6c 6c 20 ><br>..The cell
2240: 69 6e 20 74 68 65 20 56 6f 72 6f 6e 6f 6a 20 44 in the Voronoj D
2250: 69 61 67 72 61 6d 20 70 72 65 73 65 6e 74 73 20 iagram presents
2260: 61 6e 20 69 6e 74 65 72 65 73 74 69 6e 67 20 70 an interesting p
2270: 72 6f 70 65 72 74 79 3a 20 61 6c 6c 20 70 6f 69 roperty: all poi
2280: 6e 74 73 20 66 61 6c 6c 69 6e 67 20 77 69 74 68 nts falling with
2290: 69 6e 20 74 68 65 20 73 61 6d 65 20 63 65 6c 6c in the same cell
22a0: 20 61 72 65 20 65 6e 73 75 72 65 64 20 74 6f 20 are ensured to
22b0: 62 65 20 6e 65 61 72 65 73 74 20 74 6f 20 74 68 be nearest to th
22c0: 65 20 44 65 6c 61 75 6e 61 79 27 73 20 6e 6f 64 e Delaunay's nod
22d0: 65 20 70 6c 61 63 65 64 20 6f 6e 20 74 68 65 20 e placed on the
22e0: 63 65 6c 6c 20 69 74 73 65 6c 66 20 74 68 61 6e cell itself than
22f0: 20 74 6f 20 61 6e 79 20 6f 74 68 65 72 20 44 65 to any other De
2300: 6c 61 75 6e 61 79 27 73 20 6e 6f 64 65 20 70 6c launay's node pl
2310: 61 63 65 64 20 69 6e 20 61 20 64 69 66 66 65 72 aced in a differ
2320: 65 6e 74 20 63 65 6c 6c 2e 3c 62 72 3e 0d 0a 53 ent cell.<br>..S
2330: 6f 20 74 68 65 20 56 6f 72 6f 6e 6f 6a 20 44 69 o the Voronoj Di
2340: 61 67 72 61 6d 20 69 73 20 61 20 76 65 72 79 20 agram is a very
2350: 65 66 66 65 63 74 69 76 65 20 63 6f 6e 63 65 70 effective concep
2360: 74 75 61 6c 20 74 6f 6f 6c 20 61 6c 6c 6f 77 69 tual tool allowi
2370: 6e 67 20 74 6f 20 64 69 76 69 64 65 20 61 6e 20 ng to divide an
2380: 61 72 62 69 74 72 61 72 79 20 73 70 61 63 65 20 arbitrary space
2390: 72 65 67 69 6f 6e 20 69 6e 20 6d 61 6e 79 20 3c region in many <
23a0: 69 3e 72 61 74 69 6f 6e 61 6c 3c 2f 69 3e 20 63 i>rational</i> c
23b0: 65 6c 6c 73 2c 20 61 6e 64 20 69 73 20 74 68 75 ells, and is thu
23c0: 73 20 77 69 64 65 6c 79 20 75 73 75 65 64 20 6f s widely usued o
23d0: 6e 20 6d 61 6e 79 20 61 70 70 6c 69 63 61 74 69 n many applicati
23e0: 76 65 20 66 69 65 6c 64 73 2e 3c 62 72 3e 0d 0a ve fields.<br>..
23f0: 54 68 69 73 20 69 6e 63 6c 75 64 69 6e 67 20 47 This including G
2400: 65 6f 67 72 61 70 68 79 2c 20 6f 62 76 69 6f 75 eography, obviou
2410: 73 6c 79 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 61 sly.<br><br>..<a
2420: 20 68 72 65 66 3d 22 68 74 74 70 3a 2f 2f 65 6e href="http://en
2430: 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72 67 2f 77 .wikipedia.org/w
2440: 69 6b 69 2f 56 6f 72 6f 6e 6f 69 5f 74 65 73 73 iki/Voronoi_tess
2450: 65 6c 6c 61 74 69 6f 6e 22 3e 72 65 61 64 20 6d ellation">read m
2460: 6f 72 65 3c 2f 61 3e 0d 0a 3c 62 72 3e 3c 2f 74 ore</a>..<br></t
2470: 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d d></tr></table>.
2480: 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f .<a href="http:/
2490: 2f 74 72 61 63 2e 6f 73 67 65 6f 2e 6f 72 67 2f /trac.osgeo.org/
24a0: 67 65 6f 73 2f 22 3e 47 45 4f 53 20 33 2e 34 2e geos/">GEOS 3.4.
24b0: 30 3c 2f 61 3e 20 77 69 6c 6c 20 6e 6f 74 20 73 0</a> will not s
24c0: 75 70 70 6f 72 74 20 56 6f 72 6f 6e 6f 6a 3b 20 upport Voronoj;
24d0: 73 6f 20 74 68 65 20 53 70 61 74 69 61 4c 69 74 so the SpatiaLit
24e0: 65 20 6f 77 6e 20 73 75 70 70 6f 72 74 20 69 73 e own support is
24f0: 20 62 61 73 65 64 20 6f 6e 20 61 6e 20 6f 72 69 based on an ori
2500: 67 69 6e 61 6c 20 69 6d 70 6c 65 6d 65 6e 74 61 ginal implementa
2510: 74 69 6f 6e 20 28 62 61 73 65 64 20 69 6e 20 74 tion (based in t
2520: 75 72 6e 20 6f 6e 20 74 68 65 20 44 65 6c 61 75 urn on the Delau
2530: 6e 61 79 20 73 75 70 70 6f 72 74 20 6d 61 64 65 nay support made
2540: 20 61 76 61 69 6c 61 62 6c 65 20 62 79 20 47 45 available by GE
2550: 4f 53 29 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 74 OS).<br><br>..<t
2560: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 able bgcolor="#f
2570: 30 66 30 66 30 22 20 63 65 6c 6c 73 70 61 63 69 0f0f0" cellspaci
2580: 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69 ng="4" cellpaddi
2590: 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74 64 ng="8">..<tr><td
25a0: 3e 0d 0a 3c 69 3e 70 72 6f 74 6f 74 79 70 65 3c >..<i>prototype<
25b0: 2f 69 3e 3a 3c 68 72 3e 0d 0a 53 54 5f 56 6f 72 /i>:<hr>..ST_Vor
25c0: 6f 6e 6f 6a 44 69 61 67 72 61 6d 28 20 69 6e 70 onojDiagram( inp
25d0: 75 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f ut <i>Geometry</
25e0: 69 3e 20 29 20 3a 20 76 6f 72 6f 6e 6f 6a 20 3c i> ) : voronoj <
25f0: 69 3e 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 3c 62 i>Geometry</i><b
2600: 72 3e 0d 0a 53 54 5f 56 6f 72 6f 6e 6f 6a 44 69 r>..ST_VoronojDi
2610: 61 67 72 61 6d 28 20 69 6e 70 75 74 20 3c 69 3e agram( input <i>
2620: 47 65 6f 6d 65 74 72 79 3c 2f 69 3e 2c 20 65 64 Geometry</i>, ed
2630: 67 65 73 5f 6f 6e 6c 79 20 3c 69 3e 62 6f 6f 6c ges_only <i>bool
2640: 65 61 6e 3c 2f 69 3e 20 29 20 3a 20 76 6f 72 6f ean</i> ) : voro
2650: 6e 6f 6a 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c noj <i>Geometry<
2660: 2f 69 3e 3c 62 72 3e 0d 0a 53 54 5f 56 6f 72 6f /i><br>..ST_Voro
2670: 6e 6f 6a 44 69 61 67 72 61 6d 6e 28 20 69 6e 70 nojDiagramn( inp
2680: 75 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f ut <i>Geometry</
2690: 69 3e 2c 20 65 64 67 65 73 5f 6f 6e 6c 79 20 3c i>, edges_only <
26a0: 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 2c 20 65 i>boolean</i>, e
26b0: 78 74 72 61 5f 66 72 61 6d 65 5f 73 69 7a 65 20 xtra_frame_size
26c0: 3c 69 3e 64 6f 75 62 6c 65 20 70 72 65 63 69 73 <i>double precis
26d0: 69 6f 6e 3c 2f 69 3e 20 29 20 3a 20 76 6f 72 6f ion</i> ) : voro
26e0: 6e 6f 6a 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c noj <i>Geometry<
26f0: 2f 69 3e 3c 62 72 3e 0d 0a 53 54 5f 56 6f 72 6f /i><br>..ST_Voro
2700: 6e 6f 6a 44 69 61 67 72 61 6d 6e 28 20 69 6e 70 nojDiagramn( inp
2710: 75 74 20 3c 69 3e 47 65 6f 6d 65 74 72 79 3c 2f ut <i>Geometry</
2720: 69 3e 2c 20 65 64 67 65 73 5f 6f 6e 6c 79 20 3c i>, edges_only <
2730: 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 2c 20 65 i>boolean</i>, e
2740: 78 74 72 61 5f 66 72 61 6d 65 5f 73 69 7a 65 20 xtra_frame_size
2750: 3c 69 3e 64 6f 75 62 6c 65 20 70 72 65 63 69 73 <i>double precis
2760: 69 6f 6e 3c 2f 69 3e 2c 20 74 6f 6c 65 72 61 6e ion</i>, toleran
2770: 63 65 20 3c 69 3e 64 6f 75 62 6c 65 20 70 72 65 ce <i>double pre
2780: 63 69 73 69 6f 6e 3c 2f 69 3e 20 29 20 3a 20 76 cision</i> ) : v
2790: 6f 72 6f 6e 6f 6a 20 3c 69 3e 47 65 6f 6d 65 74 oronoj <i>Geomet
27a0: 72 79 3c 2f 69 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 ry</i>..</td></t
27b0: 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 75 6c 3e r></table>..<ul>
27c0: 0d 0a 3c 6c 69 3e 74 68 65 20 3c 62 3e 69 6e 70 ..<li>the <b>inp
27d0: 75 74 3c 2f 62 3e 20 47 65 6f 6d 65 74 72 79 20 ut</b> Geometry
27e0: 63 61 6e 20 62 65 20 6f 66 20 61 62 73 6f 6c 75 can be of absolu
27f0: 74 65 6c 79 20 61 72 62 69 74 72 61 72 79 20 74 tely arbitrary t
2800: 79 70 65 3b 20 61 6c 6c 20 4c 69 6e 65 73 74 72 ype; all Linestr
2810: 69 6e 67 73 20 61 6e 64 20 2f 20 6f 72 20 50 6f ings and / or Po
2820: 6c 79 67 6f 77 6e 73 20 77 69 6c 6c 20 65 76 65 lygowns will eve
2830: 6e 74 75 61 6c 6c 79 20 62 65 20 64 69 73 73 6f ntually be disso
2840: 6c 76 65 64 20 69 6e 74 6f 20 50 6f 69 6e 74 73 lved into Points
2850: 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 corresponding t
2860: 6f 20 76 65 72 74 69 63 65 73 2e 3c 62 72 3e 0d o vertices.<br>.
2870: 0a 53 6f 20 61 66 74 65 72 20 61 6c 6c 20 53 54 .So after all ST
2880: 5f 56 6f 72 6f 6e 6f 6a 44 69 61 67 72 61 6d 28 _VoronojDiagram(
2890: 29 20 28 65 78 61 63 74 6c 79 20 61 73 20 53 54 ) (exactly as ST
28a0: 5f 44 65 6c 61 75 6e 61 79 54 72 69 61 6e 67 75 _DelaunayTriangu
28b0: 6c 61 74 69 6f 6e 29 20 77 69 6c 6c 20 61 6c 77 lation) will alw
28c0: 61 79 73 20 70 72 6f 63 65 73 73 20 61 20 4d 75 ays process a Mu
28d0: 6c 74 69 50 6f 69 6e 74 2e 3c 2f 6c 69 3e 0d 0a ltiPoint.</li>..
28e0: 3c 6c 69 3e 74 68 65 20 66 61 63 75 6c 74 61 74 <li>the facultat
28f0: 69 76 65 20 3c 62 3e 65 64 67 65 73 5f 6f 6e 6c ive <b>edges_onl
2900: 79 3c 2f 62 3e 20 61 72 67 75 6d 65 6e 74 20 77 y</b> argument w
2910: 69 6c 6c 20 62 65 20 69 6e 74 65 72 70 72 65 74 ill be interpret
2920: 65 64 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 3c 75 ed as follows:<u
2930: 6c 3e 0d 0a 3c 6c 69 3e 69 66 20 3c 62 3e 46 41 l>..<li>if <b>FA
2940: 4c 53 45 3c 2f 62 3e 20 28 3c 69 3e 64 65 66 61 LSE</b> (<i>defa
2950: 75 6c 74 20 76 61 6c 75 65 3c 2f 69 3e 29 20 61 ult value</i>) a
2960: 20 4d 75 6c 74 69 50 6f 6c 79 67 6f 6e 20 77 69 MultiPolygon wi
2970: 6c 6c 20 62 65 20 72 65 74 75 72 6e 65 64 2e 3c ll be returned.<
2980: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 3c 62 3e /li>..<li>if <b>
2990: 54 52 55 45 3c 2f 62 3e 20 61 20 4d 75 6c 74 69 TRUE</b> a Multi
29a0: 4c 69 6e 65 73 74 72 69 6e 67 20 77 69 6c 6c 20 Linestring will
29b0: 62 65 20 72 65 74 75 72 6e 65 64 20 28 73 69 6d be returned (sim
29c0: 70 6c 79 20 72 65 70 72 65 73 65 6e 74 69 6e 67 ply representing
29d0: 20 74 68 65 20 74 72 69 61 6e 67 6c 65 73 20 65 the triangles e
29e0: 64 67 65 73 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 dges).</li>..</u
29f0: 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 l></li>..<li>the
2a00: 20 66 61 63 75 6c 74 61 74 69 76 65 20 3c 62 3e facultative <b>
2a10: 65 78 74 72 61 5f 66 72 61 6d 65 5f 73 69 7a 65 extra_frame_size
2a20: 3c 2f 62 3e 20 78 78 78 78 78 78 0d 0a 3c 6c 69 </b> xxxxxx..<li
2a30: 3e 74 68 65 20 66 61 63 75 6c 74 61 74 69 76 65 >the facultative
2a40: 20 3c 62 3e 74 6f 6c 65 72 61 6e 63 65 3c 2f 62 <b>tolerance</b
2a50: 3e 20 61 72 67 75 6d 65 6e 74 20 69 73 20 69 6e > argument is in
2a60: 74 65 6e 64 65 64 20 74 6f 20 6e 6f 72 6d 61 6c tended to normal
2a70: 69 7a 65 20 74 68 65 20 69 6e 70 75 74 20 70 6f ize the input po
2a80: 69 6e 74 2d 73 65 74 2c 20 73 75 70 70 72 65 73 int-set, suppres
2a90: 73 69 6e 67 20 72 65 70 65 61 74 65 64 20 70 6f sing repeated po
2aa0: 69 6e 74 73 20 28 73 69 6d 70 6c 79 20 75 73 65 ints (simply use
2ab0: 64 20 77 68 65 6e 20 69 6e 74 65 72 6e 61 6c 6c d when internall
2ac0: 79 20 63 6f 6d 70 75 74 69 6e 67 20 74 68 65 20 y computing the
2ad0: 44 65 6c 61 75 6e 61 79 20 54 72 69 61 6e 67 75 Delaunay Triangu
2ae0: 6c 61 74 69 6f 6e 29 2e 3c 62 72 3e 0d 0a 42 79 lation).<br>..By
2af0: 20 64 65 66 61 75 6c 74 20 61 20 3c 62 3e 30 2e default a <b>0.
2b00: 30 3c 2f 62 3e 20 74 6f 6c 65 72 61 6e 63 65 20 0</b> tolerance
2b10: 77 69 6c 6c 20 62 65 20 61 73 73 75 6d 65 64 2e will be assumed.
2b20: 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 74 64 </li>..</ul></td
2b30: 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a ></tr></table>..
2b40: 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 <table cellspaci
2b50: 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69 ng="4" cellpaddi
2b60: 6e 67 3d 22 34 22 3e 0d 0a 3c 74 72 3e 3c 74 64 ng="4">..<tr><td
2b70: 3e 0d 0a 3c 74 61 62 6c 65 20 62 67 63 6f 6c 6f >..<table bgcolo
2b80: 72 3d 22 23 66 30 66 30 66 30 22 20 63 65 6c 6c r="#f0f0f0" cell
2b90: 73 70 61 63 69 6e 67 3d 22 34 22 20 63 65 6c 6c spacing="4" cell
2ba0: 70 61 64 64 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74 padding="8">..<t
2bb0: 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 53 45 4c 45 43 r><td>..<b>SELEC
2bc0: 54 20 53 54 5f 56 6f 72 6f 6e 6f 6a 44 69 61 67 T ST_VoronojDiag
2bd0: 72 61 6d 28 53 54 5f 43 6f 6c 6c 65 63 74 28 67 ram(ST_Collect(g
2be0: 65 6f 6d 65 74 72 79 29 29 3c 62 72 3e 0d 0a 46 eometry))<br>..F
2bf0: 52 4f 4d 20 69 74 61 6c 79 5f 70 6f 70 75 6c 61 ROM italy_popula
2c00: 74 65 64 5f 70 6c 61 63 65 73 3b 3c 2f 62 3e 0d ted_places;</b>.
2c10: 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 .</td></tr>..</t
2c20: 61 62 6c 65 3e 3c 62 72 3e 0d 0a 54 68 69 73 20 able><br>..This
2c30: 53 51 4c 20 71 75 65 72 79 20 77 69 6c 6c 20 72 SQL query will r
2c40: 65 74 75 72 6e 20 61 20 56 6f 72 6f 6e 6f 6a 20 eturn a Voronoj
2c50: 44 69 61 67 72 61 6d 20 62 61 73 65 64 20 6f 6e Diagram based on
2c60: 20 49 74 61 6c 79 27 73 20 70 6f 70 75 6c 61 74 Italy's populat
2c70: 65 64 20 70 6c 61 63 65 73 20 28 61 62 6f 75 74 ed places (about
2c80: 20 38 2c 30 30 30 2b 20 50 6f 69 6e 74 73 29 2e 8,000+ Points).
2c90: 3c 62 72 3e 0d 0a 54 68 65 20 76 69 73 75 61 6c <br>..The visual
2ca0: 20 65 78 61 6d 70 6c 65 20 73 69 6d 70 6c 79 20 example simply
2cb0: 63 6f 76 65 72 73 20 54 75 73 63 61 6e 79 2c 20 covers Tuscany,
2cc0: 73 6f 20 74 68 65 20 65 6e 73 75 72 65 20 61 6e so the ensure an
2cd0: 20 65 61 73 79 20 72 65 61 64 69 62 69 6c 69 74 easy readibilit
2ce0: 79 2e 3c 62 72 3e 0d 0a 41 6c 6c 20 3c 69 3e 70 y.<br>..All <i>p
2cf0: 6f 70 75 6c 61 74 65 64 20 70 6c 61 63 65 73 3c opulated places<
2d00: 2f 69 3e 20 28 61 6b 61 20 63 65 6c 6c 20 3c 69 /i> (aka cell <i
2d10: 3e 73 65 65 64 73 3c 2f 69 3e 29 20 61 72 65 20 >seeds</i>) are
2d20: 65 78 70 6c 69 63 69 74 6c 79 20 72 65 70 72 65 explicitly repre
2d30: 73 65 6e 74 65 64 2e 20 0d 0a 3c 2f 74 64 3e 0d sented. ..</td>.
2d40: 0a 3c 74 64 3e 3c 69 6d 67 20 62 6f 72 64 65 72 .<td><img border
2d50: 3d 22 31 22 20 73 72 63 3d 22 68 74 74 70 3a 2f ="1" src="http:/
2d60: 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 /www.gaia-gis.it
2d70: 2f 67 61 69 61 2d 73 69 6e 73 2f 77 72 69 74 65 /gaia-sins/write
2d80: 2d 76 69 65 77 2d 70 69 63 73 2f 76 6f 72 6f 6e -view-pics/voron
2d90: 6f 6a 2d 32 2e 70 6e 67 22 20 61 6c 74 3d 22 76 oj-2.png" alt="v
2da0: 6f 72 6f 6e 6f 6a 20 64 69 61 67 72 61 6d 22 3e oronoj diagram">
2db0: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 </td></tr>..</ta
2dc0: 62 6c 65 3e 0d 0a 3c 62 72 3e 3c 68 72 3e 0d 0a ble>..<br><hr>..
2dd0: 3c 68 33 3e 44 65 6c 61 75 6e 61 79 20 54 72 69 <h3>Delaunay Tri
2de0: 61 6e 67 75 6c 61 74 69 6f 6e 2c 20 43 6f 6e 76 angulation, Conv
2df0: 65 78 20 48 75 6c 6c 20 61 6e 64 20 43 6f 6e 63 ex Hull and Conc
2e00: 61 76 65 20 48 75 6c 6c 3c 2f 68 33 3e 0d 0a 3c ave Hull</h3>..<
2e10: 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 6e table cellspacin
2e20: 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69 6e g="4" cellpaddin
2e30: 67 3d 22 34 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e g="4">..<tr><td>
2e40: 3c 69 6d 67 20 62 6f 72 64 65 72 3d 22 31 22 20 <img border="1"
2e50: 73 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e src="http://www.
2e60: 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 gaia-gis.it/gaia
2e70: 2d 73 69 6e 73 2f 77 72 69 74 65 2d 76 69 65 77 -sins/write-view
2e80: 2d 70 69 63 73 2f 63 6f 6e 76 65 78 2e 70 6e 67 -pics/convex.png
2e90: 22 20 61 6c 74 3d 22 64 65 6c 61 75 6e 61 79 2d " alt="delaunay-
2ea0: 63 6f 6e 76 65 78 68 75 6c 6c 20 72 65 6c 61 74 convexhull relat
2eb0: 69 6f 6e 73 68 69 70 22 3e 0d 0a 3c 2f 74 64 3e ionship">..</td>
2ec0: 3c 74 64 3e 0d 0a 41 6e 20 69 6e 74 72 65 73 74 <td>..An intrest
2ed0: 69 6e 67 20 70 6f 69 6e 74 20 61 62 73 6f 6c 75 ing point absolu
2ee0: 74 65 6c 79 20 77 6f 72 74 68 20 74 6f 20 62 65 tely worth to be
2ef0: 20 65 78 70 6c 69 63 69 74 6c 79 20 6e 6f 74 65 explicitly note
2f00: 64 3a 20 74 68 65 20 62 6f 75 6e 64 61 72 79 20 d: the boundary
2f10: 6f 66 20 61 6e 79 20 3c 62 3e 44 65 6c 61 75 6e of any <b>Delaun
2f20: 61 79 20 54 72 69 61 6e 67 75 6c 61 74 69 6f 6e ay Triangulation
2f30: 3c 2f 62 3e 20 65 78 61 63 74 6c 79 20 63 6f 72 </b> exactly cor
2f40: 72 65 73 70 6f 6e 64 73 20 74 6f 20 74 68 65 20 responds to the
2f50: 3c 62 3e 43 6f 6e 76 65 78 20 48 75 6c 6c 3c 2f <b>Convex Hull</
2f60: 62 3e 20 66 6f 72 20 74 68 65 20 73 61 6d 65 20 b> for the same
2f70: 69 6e 70 75 74 20 47 65 6f 6d 65 74 72 79 2e 0d input Geometry..
2f80: 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a 2f .<a href="http:/
2f90: 2f 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72 /en.wikipedia.or
2fa0: 67 2f 77 69 6b 69 2f 43 6f 6e 76 65 78 5f 68 75 g/wiki/Convex_hu
2fb0: 6c 6c 22 3e 72 65 61 64 20 6d 6f 72 65 3c 2f 61 ll">read more</a
2fc0: 3e 3c 62 72 3e 3c 62 72 3e 0d 0a 41 6e 64 20 74 ><br><br>..And t
2fd0: 68 69 73 20 69 6e 20 74 75 72 6e 20 6f 70 65 6e his in turn open
2fe0: 73 20 74 68 65 20 77 61 79 20 74 6f 20 61 20 66 s the way to a f
2ff0: 75 72 74 68 65 72 20 63 6f 6e 73 69 64 65 72 61 urther considera
3000: 74 69 6f 6e 3a 20 77 65 20 63 6f 75 6c 64 20 70 tion: we could p
3010: 75 72 70 6f 73 65 6c 79 20 73 69 6d 70 6c 69 66 urposely simplif
3020: 79 20 61 20 44 65 6c 61 75 6e 61 79 20 54 72 69 y a Delaunay Tri
3030: 61 6e 67 75 6c 61 74 69 6f 6e 20 73 6f 20 74 6f angulation so to
3040: 20 67 65 74 20 61 20 3c 62 3e 63 6f 6e 63 61 76 get a <b>concav
3050: 65 20 68 75 6c 6c 3c 2f 62 3e 2e 3c 62 72 3e 0d e hull</b>.<br>.
3060: 0a 59 6f 75 20 63 61 6e 20 67 65 74 20 6d 6f 72 .You can get mor
3070: 65 20 65 78 74 65 6e 73 69 76 65 20 69 6e 66 6f e extensive info
3080: 72 6d 61 74 69 6f 6e 73 20 61 62 6f 75 74 20 74 rmations about t
3090: 68 69 73 20 61 70 70 72 6f 61 63 68 20 66 72 6f his approach fro
30a0: 6d 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a m <a href="http:
30b0: 2f 2f 67 72 61 73 73 2e 6f 73 67 65 6f 2e 6f 72 //grass.osgeo.or
30c0: 67 2f 77 69 6b 69 2f 43 72 65 61 74 65 5f 63 6f g/wiki/Create_co
30d0: 6e 63 61 76 65 5f 68 75 6c 6c 22 3e 68 65 72 65 ncave_hull">here
30e0: 3c 2f 61 3e 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 75 </a><br><br>..<u
30f0: 3e 50 6c 65 61 73 65 20 6e 6f 74 65 20 77 65 6c >Please note wel
3100: 6c 3c 2f 75 3e 3a 20 74 68 65 20 3c 62 3e 63 6f l</u>: the <b>co
3110: 6e 76 65 78 20 68 75 6c 6c 3c 2f 62 3e 20 63 6f nvex hull</b> co
3120: 6e 63 65 70 74 20 63 6f 72 72 65 73 70 6f 6e 64 ncept correspond
3130: 73 20 74 6f 20 61 20 72 6f 62 75 73 74 20 61 6e s to a robust an
3140: 64 20 66 6f 72 6d 61 6c 20 6d 61 74 68 65 6d 61 d formal mathema
3150: 74 69 63 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e tical definition
3160: 2e 20 4f 6e 20 74 68 65 20 6f 74 68 65 72 20 73 . On the other s
3170: 69 64 65 20 74 68 65 20 3c 62 3e 63 6f 6e 63 61 ide the <b>conca
3180: 76 65 20 68 75 6c 6c 3c 2f 62 3e 20 69 73 20 61 ve hull</b> is a
3190: 20 6d 75 63 68 20 6d 6f 72 65 20 76 61 67 75 65 much more vague
31a0: 20 61 6e 64 20 69 6e 64 65 74 65 72 6d 69 6e 65 and indetermine
31b0: 64 20 6e 6f 74 69 6f 6e 2e 3c 62 72 3e 0d 0a 54 d notion.<br>..T
31c0: 68 65 72 65 20 69 73 20 6f 6e 65 20 61 6e 64 20 here is one and
31d0: 6f 6e 6c 79 20 6f 6e 65 20 43 6f 6e 76 65 78 48 only one ConvexH
31e0: 75 6c 6c 20 66 6f 72 20 61 20 67 69 76 65 6e 20 ull for a given
31f0: 47 65 6f 6d 65 74 72 79 3b 20 62 75 74 20 6d 61 Geometry; but ma
3200: 6e 79 20 43 6f 6e 63 61 76 65 48 75 6c 6c 73 20 ny ConcaveHulls
3210: 61 72 65 20 70 6f 73 73 69 62 6c 65 2e 0d 0a 43 are possible...C
3220: 68 6f 6f 73 69 6e 67 20 74 68 65 20 6f 6e 65 20 hoosing the one
3230: 6f 72 20 74 68 65 20 6f 74 68 65 72 20 69 73 20 or the other is
3240: 6d 75 63 68 20 6d 6f 72 65 20 61 20 6d 61 74 74 much more a matt
3250: 65 72 20 6f 66 20 70 65 72 73 6f 6e 61 6c 20 74 er of personal t
3260: 61 73 74 65 20 74 68 61 6e 20 61 20 6d 61 74 68 aste than a math
3270: 65 6d 61 74 69 63 61 6c 20 6f 70 65 72 61 74 69 ematical operati
3280: 6f 6e 20 66 6f 72 6d 61 6c 6c 79 20 64 65 66 69 on formally defi
3290: 6e 65 64 2e 3c 62 72 3e 0d 0a 43 6f 6d 70 75 74 ned.<br>..Comput
32a0: 69 6e 67 20 61 20 43 6f 6e 63 61 76 65 48 75 6c ing a ConcaveHul
32b0: 6c 20 61 6c 77 61 79 73 20 69 73 20 61 6e 20 69 l always is an i
32c0: 6e 68 65 72 65 6e 74 6c 79 20 61 72 62 69 74 72 nherently arbitr
32d0: 61 72 79 20 61 6e 64 20 68 65 75 72 69 73 74 69 ary and heuristi
32e0: 63 20 70 72 6f 63 65 73 73 2e 0d 0a 3c 2f 74 64 c process...</td
32f0: 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e ></tr>..<tr><td>
3300: 0d 0a 3c 68 34 3e 54 68 65 20 53 70 61 74 69 61 ..<h4>The Spatia
3310: 4c 69 74 65 27 73 20 6f 77 6e 20 61 70 70 72 6f Lite's own appro
3320: 61 63 68 20 74 6f 20 43 6f 6e 63 61 76 65 48 75 ach to ConcaveHu
3330: 6c 6c 3c 2f 68 34 3e 0d 0a 3c 6f 6c 3e 0d 0a 3c ll</h4>..<ol>..<
3340: 6c 69 3e 74 68 65 20 44 65 6c 61 75 6e 61 79 20 li>the Delaunay
3350: 54 72 69 61 6e 67 75 6c 61 74 69 6f 6e 20 63 6f Triangulation co
3360: 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 74 rresponding to t
3370: 68 65 20 69 6e 70 75 74 20 47 65 6f 6d 65 74 72 he input Geometr
3380: 79 20 77 69 6c 6c 20 62 65 20 63 6f 6d 70 75 74 y will be comput
3390: 65 64 20 66 69 72 73 74 2e 3c 2f 6c 69 3e 0d 0a ed first.</li>..
33a0: 3c 6c 69 3e 74 68 65 6e 20 74 68 65 20 73 74 61 <li>then the sta
33b0: 74 69 73 74 69 63 61 6c 20 64 69 73 74 72 69 62 tistical distrib
33c0: 75 74 69 6f 6e 20 6f 66 20 61 6c 6c 20 74 72 69 ution of all tri
33d0: 61 6e 67 6c 65 20 65 64 67 65 27 73 20 6c 65 6e angle edge's len
33e0: 67 74 68 73 20 77 69 6c 6c 20 62 65 20 65 76 61 gths will be eva
33f0: 6c 75 61 74 65 64 2c 20 73 6f 20 74 6f 20 64 65 luated, so to de
3400: 74 65 72 6d 69 6e 65 20 3c 62 3e 26 73 69 67 6d termine <b>&sigm
3410: 61 3b 3c 2f 62 3e 20 28 61 6b 61 20 74 68 65 20 a;</b> (aka the
3420: 3c 69 3e 73 74 61 6e 64 61 72 64 20 64 65 76 69 <i>standard devi
3430: 61 74 69 6f 6e 3c 2f 69 3e 29 3c 2f 6c 69 3e 0d ation</i>)</li>.
3440: 0a 3c 6c 69 3e 61 20 73 65 63 6f 6e 64 20 70 61 .<li>a second pa
3450: 73 73 20 77 69 6c 6c 20 6e 6f 77 20 65 78 61 6d ss will now exam
3460: 69 6e 65 20 79 65 74 20 61 67 61 69 6e 20 61 6c ine yet again al
3470: 6c 20 44 65 6c 61 75 6e 61 79 27 73 20 74 72 69 l Delaunay's tri
3480: 61 6e 67 6c 65 73 3b 20 61 6e 79 20 74 72 69 61 angles; any tria
3490: 6e 67 6c 65 20 70 72 65 73 65 6e 74 69 6e 67 20 ngle presenting
34a0: 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 65 64 67 at least one edg
34b0: 65 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 3c 62 e longer than <b
34c0: 3e 26 73 69 67 6d 61 3b 20 2a 20 66 61 63 74 6f >σ * facto
34d0: 72 3c 2f 62 3e 20 77 69 6c 6c 20 62 65 20 64 69 r</b> will be di
34e0: 73 63 61 72 64 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c scarded.</li>..<
34f0: 6c 69 3e 61 6e 64 20 66 69 6e 61 6c 6c 79 20 61 li>and finally a
3500: 6c 6c 20 66 69 6c 74 65 72 65 64 20 74 72 69 61 ll filtered tria
3510: 6e 67 6c 65 73 20 77 69 6c 6c 20 62 65 20 64 69 ngles will be di
3520: 73 73 6f 6c 76 65 64 20 73 6f 20 74 6f 20 66 6f ssolved so to fo
3530: 72 6d 20 74 68 65 20 43 6f 6e 63 61 76 65 48 75 rm the ConcaveHu
3540: 6c 6c 20 74 6f 20 62 65 20 72 65 74 75 72 6e 65 ll to be returne
3550: 64 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 6f 6c 3e 0d 0a d.</li>..</ol>..
3560: 3c 75 3e 50 6c 65 61 73 65 20 6e 6f 74 65 3c 2f <u>Please note</
3570: 75 3e 3a 20 62 79 20 73 65 74 74 69 6e 67 20 61 u>: by setting a
3580: 6e 20 61 70 70 72 6f 70 72 69 61 74 65 20 76 61 n appropriate va
3590: 6c 75 65 20 74 6f 20 3c 62 3e 66 61 63 74 6f 72 lue to <b>factor
35a0: 3c 2f 62 3e 20 79 6f 75 20 63 61 6e 20 66 72 65 </b> you can fre
35b0: 65 6c 79 20 69 6e 66 6c 75 65 6e 63 65 20 68 6f ely influence ho
35c0: 77 20 6d 75 63 68 20 3c 69 3e 61 67 67 72 65 73 w much <i>aggres
35d0: 73 69 76 65 3c 2f 69 3e 20 74 68 65 20 66 69 6c sive</i> the fil
35e0: 74 65 72 69 6e 67 20 70 61 73 73 20 77 69 6c 6c tering pass will
35f0: 20 62 65 2e 3c 62 72 3e 0d 0a 41 64 6f 70 74 69 be.<br>..Adopti
3600: 6e 67 20 61 20 76 65 72 79 20 68 69 67 68 20 3c ng a very high <
3610: 62 3e 66 61 63 74 6f 72 3c 2f 62 3e 20 76 61 6c b>factor</b> val
3620: 75 65 20 70 72 61 63 74 69 63 61 6c 6c 79 20 6d ue practically m
3630: 65 61 6e 73 20 61 70 70 6c 79 69 6e 67 20 61 20 eans applying a
3640: 76 65 72 79 20 62 6c 61 6e 64 20 66 69 6c 74 65 very bland filte
3650: 72 69 6e 67 20 28 76 65 72 79 20 66 65 77 20 74 ring (very few t
3660: 72 69 61 6e 67 6c 65 73 20 77 69 6c 6c 20 62 65 riangles will be
3670: 20 64 69 73 63 61 72 64 65 64 2c 20 61 6e 64 20 discarded, and
3680: 79 6f 75 27 6c 6c 20 63 6f 6e 73 65 6e 71 75 65 you'll consenque
3690: 6e 74 6c 79 20 67 65 74 20 61 20 72 61 74 68 65 ntly get a rathe
36a0: 72 20 3c 69 3e 63 6f 6e 76 65 78 3c 2f 69 3e 20 r <i>convex</i>
36b0: 73 68 61 70 65 29 2e 0d 0a 4f 6e 20 74 68 65 20 shape)...On the
36c0: 6f 74 68 65 72 20 73 69 64 65 20 61 64 6f 70 74 other side adopt
36d0: 69 6e 67 20 61 20 76 65 72 79 20 6c 6f 77 20 3c ing a very low <
36e0: 62 3e 66 61 63 74 6f 72 3c 2f 62 3e 20 76 61 6c b>factor</b> val
36f0: 75 65 73 20 77 69 6c 6c 20 61 70 70 6c 79 20 61 ues will apply a
3700: 20 76 65 72 79 20 73 74 72 6f 6e 67 20 66 69 6c very strong fil
3710: 74 65 72 69 6e 67 20 28 6d 61 6e 79 20 74 72 69 tering (many tri
3720: 61 6e 67 6c 65 73 20 77 69 6c 6c 20 62 65 20 6e angles will be n
3730: 6f 77 20 64 69 73 63 61 72 64 65 64 2c 20 61 6e ow discarded, an
3740: 64 20 79 6f 75 27 6c 6c 20 67 65 74 20 61 20 76 d you'll get a v
3750: 65 72 79 20 3c 69 3e 63 6f 6e 63 61 76 65 3c 2f ery <i>concave</
3760: 69 3e 20 73 68 61 70 65 29 2e 3c 62 72 3e 3c 62 i> shape).<br><b
3770: 72 3e 0d 0a 3c 75 3e 55 73 65 66 75 6c 20 63 6f r>..<u>Useful co
3780: 6e 73 74 61 6e 74 73 3c 2f 75 3e 3a 20 61 73 73 nstants</u>: ass
3790: 75 6d 69 6e 67 20 61 20 70 65 72 66 65 63 74 6c uming a perfectl
37a0: 79 20 6e 6f 72 6d 61 6c 20 64 69 73 74 72 69 62 y normal distrib
37b0: 75 74 69 6f 6e 20 6f 66 20 65 64 67 65 20 6c 65 ution of edge le
37c0: 6e 67 74 68 73 20 28 61 20 62 79 20 66 61 72 20 ngths (a by far
37d0: 75 6e 72 65 61 6c 69 73 74 69 63 20 61 73 73 75 unrealistic assu
37e0: 6d 70 74 69 6f 6e 20 66 6f 72 20 72 65 61 6c 20 mption for real
37f0: 77 6f 72 6c 64 20 64 61 74 61 73 65 74 73 29 2c world datasets),
3800: 20 3c 62 3e 33 26 73 69 67 6d 61 3b 3c 2f 62 3e <b>3σ</b>
3810: 20 77 69 6c 6c 20 69 6d 70 6c 79 20 73 75 70 70 will imply supp
3820: 72 65 73 73 69 6e 67 20 61 62 6f 75 74 20 3c 62 ressing about <b
3830: 3e 30 2e 31 25 3c 2f 62 3e 20 74 72 69 61 6e 67 >0.1%</b> triang
3840: 6c 65 73 20 28 6f 6e 6c 79 20 74 68 65 20 66 65 les (only the fe
3850: 77 20 6f 6e 65 73 20 70 72 65 73 65 6e 74 69 6e w ones presentin
3860: 67 20 61 62 6e 6f 72 6d 61 6c 6c 79 20 6c 65 6e g abnormally len
3870: 67 74 68 79 20 65 64 67 65 73 29 2c 20 3c 62 3e gthy edges), <b>
3880: 32 26 73 69 67 6d 61 3b 3c 2f 62 3e 20 63 6f 72 2σ</b> cor
3890: 72 65 73 70 6f 6e 64 73 20 74 6f 20 61 62 6f 75 responds to abou
38a0: 74 20 3c 62 3e 32 2e 31 25 3c 2f 62 3e 2c 20 61 t <b>2.1%</b>, a
38b0: 6e 64 20 3c 62 3e 31 26 73 69 67 6d 61 3b 3c 2f nd <b>1σ</
38c0: 62 3e 20 72 6f 75 67 68 6c 79 20 63 6f 72 72 65 b> roughly corre
38d0: 73 70 6f 6e 64 73 20 74 6f 20 20 3c 62 3e 31 35 sponds to <b>15
38e0: 2e 38 25 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 55 73 .8%</b>.<br>..Us
38f0: 75 61 6c 6c 79 20 76 61 6c 75 65 73 20 72 61 6e ually values ran
3900: 67 69 6e 67 20 62 65 74 77 65 65 6e 20 3c 62 3e ging between <b>
3910: 33 26 73 69 67 6d 61 3b 3c 2f 62 3e 20 61 6e 64 3σ</b> and
3920: 20 3c 62 3e 32 26 73 69 67 6d 61 3b 3c 2f 62 3e <b>2σ</b>
3930: 20 61 72 65 20 74 68 65 20 6d 6f 73 74 20 61 70 are the most ap
3940: 70 72 6f 70 72 69 61 74 65 20 74 6f 20 62 65 20 propriate to be
3950: 75 73 65 64 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 used.<br><br>..T
3960: 68 65 20 66 69 67 75 72 65 20 73 68 6f 77 73 20 he figure shows
3970: 77 68 61 74 20 79 6f 75 20 63 61 6e 20 61 63 74 what you can act
3980: 75 61 6c 6c 79 20 67 65 74 20 62 79 20 61 70 70 ually get by app
3990: 6c 79 69 6e 67 20 61 20 3c 62 3e 33 26 73 69 67 lying a <b>3&sig
39a0: 6d 61 3b 3c 2f 62 3e 20 66 69 6c 74 65 72 69 6e ma;</b> filterin
39b0: 67 20 74 6f 20 49 74 61 6c 69 61 6e 20 50 6f 70 g to Italian Pop
39c0: 75 6c 61 74 65 64 20 50 6c 61 63 65 73 3b 20 66 ulated Places; f
39d0: 6f 72 20 63 6c 61 72 69 74 79 20 61 6c 6c 20 49 or clarity all I
39e0: 74 61 6c 69 61 6e 20 52 65 67 69 6f 6e 73 20 61 talian Regions a
39f0: 72 65 20 72 65 70 72 65 73 65 6e 74 65 64 20 69 re represented i
3a00: 6e 20 79 65 6c 6c 6f 77 2c 20 61 6e 64 20 74 68 n yellow, and th
3a10: 65 20 43 6f 6e 76 65 78 48 75 6c 6c 20 69 73 20 e ConvexHull is
3a20: 72 65 70 72 65 73 65 6e 74 65 64 20 69 6e 20 62 represented in b
3a30: 6c 75 65 2e 0d 0a 3c 2f 74 64 3e 3c 74 64 3e 0d lue...</td><td>.
3a40: 0a 3c 69 6d 67 20 62 6f 72 64 65 72 3d 22 31 22 .<img border="1"
3a50: 20 73 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77 src="http://www
3a60: 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 .gaia-gis.it/gai
3a70: 61 2d 73 69 6e 73 2f 77 72 69 74 65 2d 76 69 65 a-sins/write-vie
3a80: 77 2d 70 69 63 73 2f 63 6f 6e 63 61 76 65 33 2e w-pics/concave3.
3a90: 70 6e 67 22 20 61 6c 74 3d 22 63 6f 6e 63 61 76 png" alt="concav
3aa0: 65 68 75 6c 6c 2d 31 22 3e 0d 0a 3c 2f 74 64 3e ehull-1">..</td>
3ab0: 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d </tr>..</table>.
3ac0: 0a 3c 62 72 3e 3c 68 72 3e 0d 0a 42 61 63 6b 20 .<br><hr>..Back
3ad0: 74 6f 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 to <a href="http
3ae0: 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 s://www.gaia-gis
3af0: 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 .it/fossil/libsp
3b00: 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 atialite/wiki?na
3b10: 6d 65 3d 73 77 69 74 63 68 69 6e 67 2d 74 6f 2d me=switching-to-
3b20: 34 2e 30 23 74 65 73 73 65 6c 61 74 69 6f 6e 22 4.0#tesselation"
3b30: 3e 6d 61 69 6e 20 70 61 67 65 3c 2f 61 3e 0d 0a >main page</a>..
3b40: 0d 0a 0a 5a 20 38 63 39 33 34 32 39 62 37 62 62 ...Z 8c93429b7bb
3b50: 30 62 37 39 65 38 35 34 31 64 63 39 37 62 61 36 0b79e8541dc97ba6
3b60: 37 30 64 64 63 0a 70ddc.