Hex Artifact Content
Not logged in

Artifact 67d9f0f4e2b4c7aea4e7a92890d9d5bcd05a1ab0:

Wiki page [topo-advanced] by sandro 2015-11-15 11:11:12.
0000: 44 20 32 30 31 35 2d 31 31 2d 31 35 54 31 31 3a  D 2015-11-15T11:
0010: 31 31 3a 31 32 2e 31 34 30 0a 4c 20 74 6f 70 6f  11:12.140.L topo
0020: 2d 61 64 76 61 6e 63 65 64 0a 50 20 61 66 62 64  -advanced.P afbd
0030: 65 34 36 31 34 36 35 64 66 35 31 65 38 61 36 30  e461465df51e8a60
0040: 39 63 31 65 65 36 34 31 31 37 62 36 30 39 66 30  9c1ee64117b609f0
0050: 30 39 62 64 0a 55 20 73 61 6e 64 72 6f 0a 57 20  09bd.U sandro.W 
0060: 38 34 31 30 0a 3c 74 61 62 6c 65 20 63 65 6c 6c  8410.<table cell
0070: 73 70 61 63 69 6e 67 3d 22 31 32 22 20 77 69 64  spacing="12" wid
0080: 74 68 3d 22 31 30 30 25 22 3e 0d 0a 3c 74 72 3e  th="100%">..<tr>
0090: 3c 74 64 20 63 6f 6c 73 70 61 6e 3d 22 32 22 3e  <td colspan="2">
00a0: 0d 0a 3c 74 61 62 6c 65 20 77 69 64 74 68 3d 22  ..<table width="
00b0: 31 30 30 25 22 20 62 67 63 6f 6c 6f 72 3d 22 23  100%" bgcolor="#
00c0: 66 30 66 30 66 38 22 3e 0d 0a 3c 74 72 3e 3c 74  f0f0f8">..<tr><t
00d0: 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22  d align="center"
00e0: 3e 0d 0a 3c 68 31 3e 54 6f 70 6f 6c 6f 67 79 2d  >..<h1>Topology-
00f0: 47 65 6f 6d 65 74 72 79 3a 20 61 6e 20 61 64 76  Geometry: an adv
0100: 61 6e 63 65 64 20 74 75 74 6f 72 69 61 6c 3c 2f  anced tutorial</
0110: 68 31 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 3c  h1>..</td></tr><
0120: 2f 74 61 62 6c 65 3e 0d 0a 3c 74 61 62 6c 65 20  /table>..<table 
0130: 77 69 64 74 68 3d 22 31 30 30 25 22 3e 3c 74 72  width="100%"><tr
0140: 3e 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33  >..<td width="33
0150: 25 22 20 61 6c 69 67 6e 3d 22 6c 65 66 74 22 3e  %" align="left">
0160: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f  <a href="https:/
0170: 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74  /www.gaia-gis.it
0180: 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69  /fossil/libspati
0190: 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d  alite/wiki?name=
01a0: 74 6f 70 6f 2d 69 6e 74 65 72 6d 65 64 69 61 74  topo-intermediat
01b0: 65 22 3e 70 72 65 76 69 6f 75 73 20 70 61 67 65  e">previous page
01c0: 3c 2f 61 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 61  </a></td>..<td a
01d0: 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 3c 61  lign="center"><a
01e0: 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77   href="https://w
01f0: 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66  ww.gaia-gis.it/f
0200: 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c  ossil/libspatial
0210: 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 6d 69  ite/wiki?name=mi
0220: 73 63 2d 64 6f 63 73 22 3e 62 61 63 6b 20 74 6f  sc-docs">back to
0230: 20 69 6e 64 65 78 3c 2f 61 3e 3c 2f 74 64 3e 0d   index</a></td>.
0240: 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33 25 22  .<td width="33%"
0250: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 3c   align="right"><
0260: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f  a href="https://
0270: 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f  www.gaia-gis.it/
0280: 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61  fossil/libspatia
0290: 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 74  lite/wiki?name=t
02a0: 6f 70 6f 2d 61 64 76 61 6e 63 65 64 22 3e 6e 65  opo-advanced">ne
02b0: 78 74 20 70 61 67 65 3c 2f 61 3e 3c 2f 74 64 3e  xt page</a></td>
02c0: 0d 0a 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d  ..</tr></table>.
02d0: 0a 3c 68 33 3e 54 6f 70 6f 4c 61 79 65 72 73 20  .<h3>TopoLayers 
02e0: 61 6e 64 20 54 6f 70 6f 46 65 61 74 75 72 65 73  and TopoFeatures
02f0: 3c 2f 68 33 3e 0d 0a 49 6e 20 74 68 65 20 70 72  </h3>..In the pr
0300: 65 76 69 6f 75 73 20 74 75 74 6f 72 69 61 6c 20  evious tutorial 
0310: 77 65 27 76 65 20 65 78 61 6d 69 6e 65 64 20 61  we've examined a
0320: 20 66 69 72 73 74 20 63 6f 75 70 6c 65 20 6f 66   first couple of
0330: 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e 73 20 69   SQL functions i
0340: 6e 74 65 6e 64 65 64 20 74 6f 20 65 78 70 6f 72  ntended to expor
0350: 74 20 61 20 47 65 6f 54 61 62 6c 65 20 6f 75 74  t a GeoTable out
0360: 20 66 72 6f 6d 20 61 6e 20 65 78 69 73 74 69 6e   from an existin
0370: 67 20 54 6f 70 6f 6c 6f 67 79 3a 20 3c 62 3e 54  g Topology: <b>T
0380: 6f 70 6f 47 65 6f 5f 54 6f 47 65 6f 54 61 62 6c  opoGeo_ToGeoTabl
0390: 65 28 29 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 54  e()</b> and <b>T
03a0: 6f 70 6f 47 65 6f 5f 54 6f 47 65 6f 54 61 62 6c  opoGeo_ToGeoTabl
03b0: 65 47 65 6e 65 72 61 6c 69 7a 65 28 29 3c 2f 62  eGeneralize()</b
03c0: 3e 2e 3c 62 72 3e 0d 0a 41 6e 79 77 61 79 20 53  >.<br>..Anyway S
03d0: 70 61 74 69 61 4c 69 74 65 20 73 75 70 70 6f 72  patiaLite suppor
03e0: 74 73 20 61 6e 20 6d 6f 72 65 20 73 6f 70 68 69  ts an more sophi
03f0: 73 74 69 63 61 74 65 64 20 28 61 6e 64 20 63 6f  sticated (and co
0400: 6d 70 6c 65 78 29 20 61 70 70 72 6f 61 63 68 20  mplex) approach 
0410: 62 61 73 65 64 20 6f 6e 20 3c 62 3e 54 6f 70 6f  based on <b>Topo
0420: 4c 61 79 65 72 73 3c 2f 62 3e 20 61 6e 64 20 3c  Layers</b> and <
0430: 62 3e 54 6f 70 6f 46 65 61 74 75 72 65 73 3c 2f  b>TopoFeatures</
0440: 62 3e 20 73 70 65 63 69 66 69 63 61 6c 6c 79 20  b> specifically 
0450: 69 6e 74 65 6e 64 65 64 20 74 6f 20 73 75 70 70  intended to supp
0460: 6f 72 74 20 61 20 76 65 72 79 20 66 6c 65 78 69  ort a very flexi
0470: 62 6c 65 20 6d 65 63 68 61 6e 69 73 6d 20 66 6f  ble mechanism fo
0480: 72 20 65 78 70 6f 72 74 69 6e 67 20 61 20 66 75  r exporting a fu
0490: 6c 6c 20 73 65 74 20 6f 66 20 47 65 6f 54 61 62  ll set of GeoTab
04a0: 6c 65 28 73 29 20 64 69 72 65 63 74 6c 79 20 64  le(s) directly d
04b0: 65 72 69 76 69 6e 67 20 66 72 6f 6d 20 61 20 54  eriving from a T
04c0: 6f 70 6f 6c 6f 67 79 2e 0d 0a 3c 68 34 3e 61 20  opology...<h4>a 
04d0: 63 6f 6e 63 65 70 74 75 61 6c 20 72 65 66 65 72  conceptual refer
04e0: 65 6e 63 65 20 66 72 61 6d 65 77 6f 72 6b 3c 2f  ence framework</
04f0: 68 34 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 61  h4>..<ul>..<li>a
0500: 6e 20 49 53 4f 20 54 6f 70 6f 6c 6f 67 79 20 69  n ISO Topology i
0510: 73 20 6a 75 73 74 20 69 6e 74 65 6e 64 65 64 20  s just intended 
0520: 74 6f 20 73 75 70 70 6f 72 74 20 61 20 63 6f 6e  to support a con
0530: 73 69 73 74 65 6e 74 20 73 65 74 20 6f 66 20 3c  sistent set of <
0540: 62 3e 4e 6f 64 65 73 3c 2f 62 3e 2c 20 3c 62 3e  b>Nodes</b>, <b>
0550: 45 64 67 65 73 3c 2f 62 3e 20 61 6e 64 20 3c 62  Edges</b> and <b
0560: 3e 46 61 63 65 73 3c 2f 62 3e 20 70 72 69 6d 69  >Faces</b> primi
0570: 74 69 76 65 73 20 66 75 6c 6c 79 20 63 6f 76 65  tives fully cove
0580: 72 69 6e 67 20 74 68 65 20 70 6c 61 6e 65 2e 0d  ring the plane..
0590: 0a 54 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74  .Topology primit
05a0: 69 76 65 73 20 63 6f 72 72 65 73 70 6f 6e 64 20  ives correspond 
05b0: 74 6f 20 70 75 72 65 20 67 65 6f 6d 65 74 72 69  to pure geometri
05c0: 65 73 2c 20 61 6e 64 20 63 61 6e 20 6e 65 76 65  es, and can neve
05d0: 72 20 62 65 20 64 69 72 65 63 74 6c 79 20 20 61  r be directly  a
05e0: 73 73 6f 63 69 61 74 65 64 20 74 6f 20 61 20 63  ssociated to a c
05f0: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 73 65 74  orresponding set
0600: 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20   of information 
0610: 61 74 74 72 69 62 75 74 65 73 2e 0d 0a 42 6f 74  attributes...Bot
0620: 68 20 4e 6f 64 65 20 61 6e 64 20 45 64 67 65 20  h Node and Edge 
0630: 70 72 69 6d 69 74 69 76 65 73 20 64 69 72 65 63  primitives direc
0640: 74 6c 79 20 63 6f 72 72 65 73 70 6f 6e 64 20 74  tly correspond t
0650: 6f 20 61 20 3c 75 3e 3c 69 3e 72 65 61 6c 20 67  o a <u><i>real g
0660: 65 6f 6d 65 74 72 79 3c 2f 69 3e 3c 2f 75 3e 2c  eometry</i></u>,
0670: 20 62 75 74 20 46 61 63 65 20 70 72 69 6d 69 74   but Face primit
0680: 69 76 65 73 20 73 69 6d 70 6c 79 20 63 6f 72 72  ives simply corr
0690: 65 73 70 6f 6e 64 20 74 6f 20 61 20 3c 75 3e 3c  espond to a <u><
06a0: 69 3e 76 69 72 74 75 61 6c 20 67 65 6f 6d 65 74  i>virtual geomet
06b0: 72 79 3c 2f 69 3e 3c 2f 75 3e 20 74 68 75 73 20  ry</i></u> thus 
06c0: 6e 65 63 65 73 73 61 72 69 6c 79 20 72 65 71 75  necessarily requ
06d0: 69 72 69 6e 67 20 74 6f 20 62 65 20 64 79 6e 61  iring to be dyna
06e0: 6d 69 63 61 6c 6c 79 20 72 65 63 6f 6e 74 72 75  mically recontru
06f0: 63 74 65 64 20 65 76 65 72 79 20 74 69 6d 65 20  cted every time 
0700: 74 68 61 74 20 74 68 65 79 20 61 72 65 20 72 65  that they are re
0710: 66 65 72 65 6e 63 65 64 20 28 61 6e 64 20 74 68  ferenced (and th
0720: 69 73 20 63 6f 75 6c 64 20 65 61 73 69 6c 79 20  is could easily 
0730: 62 65 63 6f 6d 65 20 61 20 72 65 61 6c 20 62 6f  become a real bo
0740: 74 74 6c 65 6e 65 63 6b 29 2e 3c 2f 6c 69 3e 0d  ttleneck).</li>.
0750: 0a 3c 6c 69 3e 6f 6e 20 74 68 65 20 6f 74 68 65  .<li>on the othe
0760: 72 20 68 61 6e 64 20 61 20 47 65 6f 54 61 62 6c  r hand a GeoTabl
0770: 65 20 28 61 6b 61 20 3c 75 3e 3c 69 3e 6c 61 79  e (aka <u><i>lay
0780: 65 72 3c 2f 69 3e 3c 2f 75 3e 2c 20 61 73 20 69  er</i></u>, as i
0790: 6e 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 47 49 53  n the common GIS
07a0: 20 70 61 72 6c 61 6e 63 65 29 20 69 73 20 61 6c   parlance) is al
07b0: 77 61 79 73 20 62 61 73 65 64 20 6f 6e 20 6d 61  ways based on ma
07c0: 6e 79 20 64 69 73 74 69 6e 63 74 20 66 65 61 74  ny distinct feat
07d0: 75 72 65 73 2c 20 61 6e 64 20 66 6f 72 20 65 61  ures, and for ea
07e0: 63 68 20 66 65 61 74 75 72 65 20 61 20 47 65 6f  ch feature a Geo
07f0: 6d 65 74 72 79 20 61 6e 64 20 61 6e 20 61 73 73  metry and an ass
0800: 6f 63 69 61 74 65 64 20 73 65 74 20 6f 66 20 69  ociated set of i
0810: 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 74 74 72 69  nformation attri
0820: 62 75 74 65 73 20 61 72 65 20 65 78 70 65 63 74  butes are expect
0830: 65 64 20 74 6f 20 62 65 20 64 65 63 6c 61 72 65  ed to be declare
0840: 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65  d.</li>..<li>the
0850: 72 65 20 69 73 20 66 75 72 74 68 65 72 20 64 69  re is further di
0860: 66 66 65 72 65 6e 63 65 20 74 6f 20 62 65 20 74  fference to be t
0870: 61 6b 65 6e 20 69 6e 20 70 72 6f 70 65 72 20 61  aken in proper a
0880: 63 63 6f 75 6e 74 3a 20 54 6f 70 6f 6c 6f 67 79  ccount: Topology
0890: 20 70 72 69 6d 69 74 69 76 65 73 20 6e 65 63 65   primitives nece
08a0: 73 73 61 72 69 6c 79 20 61 72 65 20 65 6c 65 6d  ssarily are elem
08b0: 65 6e 74 61 72 79 2e 20 46 65 61 74 75 72 65 20  entary. Feature 
08c0: 47 65 6f 6d 65 74 72 69 65 73 20 63 61 6e 20 75  Geometries can u
08d0: 73 75 61 6c 6c 79 20 72 65 70 72 65 73 65 6e 74  sually represent
08e0: 20 73 6f 6d 65 20 63 6f 6d 70 6c 65 78 20 74 79   some complex ty
08f0: 70 65 3a 20 4d 55 4c 54 49 50 4f 49 4e 54 2c 20  pe: MULTIPOINT, 
0900: 4d 55 4c 54 49 4c 49 4e 45 53 54 52 49 4e 47 2c  MULTILINESTRING,
0910: 20 4d 55 4c 54 49 50 4f 4c 59 47 4f 4e 20 61 6e   MULTIPOLYGON an
0920: 64 2c 20 6d 61 79 20 62 65 2c 20 47 45 4f 4d 45  d, may be, GEOME
0930: 54 52 59 43 4f 4c 4c 45 43 54 49 4f 4e 2e 20 53  TRYCOLLECTION. S
0940: 6f 20 69 74 20 73 68 6f 75 6c 64 20 62 65 20 61  o it should be a
0950: 62 73 6f 6c 75 74 65 6c 79 20 63 6c 65 61 72 20  bsolutely clear 
0960: 74 68 61 74 20 61 20 46 65 61 74 75 72 65 20 47  that a Feature G
0970: 65 6f 6d 65 74 72 79 20 64 6f 65 73 20 6e 6f 74  eometry does not
0980: 20 6e 65 63 65 73 73 61 72 69 6c 79 20 63 6f 72   necessarily cor
0990: 72 65 73 70 6f 6e 64 73 20 74 6f 20 61 20 73 69  responds to a si
09a0: 6e 67 6c 65 20 54 6f 70 6f 6c 6f 67 79 20 70 72  ngle Topology pr
09b0: 69 6d 69 74 69 76 65 20 3b 20 61 20 46 65 61 74  imitive ; a Feat
09c0: 75 72 65 20 47 65 6f 6d 65 74 72 79 20 63 6f 75  ure Geometry cou
09d0: 6c 64 20 65 61 73 69 6c 79 20 62 65 20 64 65 72  ld easily be der
09e0: 69 76 65 64 20 66 72 6f 6d 20 61 67 67 72 65 67  ived from aggreg
09f0: 61 74 69 6e 67 20 6d 61 6e 79 20 64 69 66 66 65  ating many diffe
0a00: 72 65 6e 74 20 54 6f 70 6f 6c 6f 67 79 20 70 72  rent Topology pr
0a10: 69 6d 69 74 65 73 2e 3c 2f 6c 69 3e 20 0d 0a 3c  imites.</li> ..<
0a20: 6c 69 3e 74 68 61 74 27 73 20 6e 6f 74 20 61 6c  li>that's not al
0a30: 6c 3a 20 6d 61 6e 79 20 64 69 66 66 65 72 65 6e  l: many differen
0a40: 74 20 47 65 6f 54 61 62 6c 65 73 20 63 6f 75 6c  t GeoTables coul
0a50: 64 20 65 76 65 6e 61 74 75 61 6c 6c 79 20 62 65  d evenatually be
0a60: 20 64 65 72 69 76 65 64 20 66 72 6f 6d 20 61 20   derived from a 
0a70: 73 69 6e 67 6c 65 20 54 6f 70 6f 6c 6f 67 79 3b  single Topology;
0a80: 20 61 6e 64 20 74 68 65 20 73 61 6d 65 20 54 6f   and the same To
0a90: 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 76 65  pology primitive
0aa0: 20 63 6f 75 6c 64 20 70 6c 61 79 20 61 20 76 65   could play a ve
0ab0: 72 79 20 64 69 66 66 65 72 65 6e 74 20 72 6f 6c  ry different rol
0ac0: 65 20 69 6e 20 65 76 65 72 79 6f 6e 65 20 6f 66  e in everyone of
0ad0: 20 74 68 65 73 65 20 47 65 6f 54 61 62 6c 65 73   these GeoTables
0ae0: 2e 3c 62 72 3e 0d 0a 4a 75 73 74 20 61 20 62 61  .<br>..Just a ba
0af0: 73 69 63 61 6c 6c 79 20 73 69 6d 70 6c 65 20 65  sically simple e
0b00: 78 61 6d 70 6c 65 3a 20 69 6d 61 67 69 6e 65 20  xample: imagine 
0b10: 61 20 54 6f 70 6f 6c 6f 67 79 20 63 6f 72 72 65  a Topology corre
0b20: 73 70 6f 6e 64 69 6e 67 20 74 6f 20 73 6f 6d 65  sponding to some
0b30: 20 63 61 64 61 73 74 72 61 6c 20 6d 61 70 2e 20   cadastral map. 
0b40: 57 65 27 6c 6c 20 73 75 72 65 6c 79 20 68 61 76  We'll surely hav
0b50: 65 20 6d 61 6e 79 20 70 6f 74 65 6e 74 69 61 6c  e many potential
0b60: 20 6c 61 79 65 72 73 3a 20 62 75 69 6c 64 69 6e   layers: buildin
0b70: 67 73 2c 20 61 67 72 69 63 75 6c 74 75 72 61 6c  gs, agricultural
0b80: 20 6c 61 6e 64 2c 20 70 6f 70 75 6c 61 74 65 64   land, populated
0b90: 20 70 6c 61 63 65 73 2c 20 61 64 6d 69 6e 69 73   places, adminis
0ba0: 74 72 61 74 69 76 65 20 62 6f 75 6e 64 61 72 69  trative boundari
0bb0: 65 73 2c 20 72 6f 61 64 73 2c 20 70 6f 6e 64 73  es, roads, ponds
0bc0: 2c 20 72 69 76 65 72 73 2c 20 66 65 6e 63 65 73  , rivers, fences
0bd0: 20 61 6e 64 20 73 6f 20 6f 6e 2e 3c 62 72 3e 0d   and so on.<br>.
0be0: 0a 49 6e 20 73 75 63 68 20 61 20 63 6f 6e 74 65  .In such a conte
0bf0: 78 74 20 61 20 66 65 6e 63 65 20 63 6f 75 6c 64  xt a fence could
0c00: 20 65 61 73 69 6c 79 20 63 6f 72 72 65 73 70 6f   easily correspo
0c10: 6e 64 20 74 6f 20 61 20 46 65 61 74 75 72 65 20  nd to a Feature 
0c20: 77 69 74 68 69 6e 20 74 68 65 20 22 3c 69 3e 3c  within the "<i><
0c30: 62 3e 66 65 6e 63 65 73 3c 2f 62 3e 3c 2f 69 3e  b>fences</b></i>
0c40: 22 20 6c 61 79 65 72 2c 20 63 6f 75 6c 64 20 70  " layer, could p
0c50: 72 6f 62 61 62 6c 79 20 64 65 6c 69 6d 69 74 20  robably delimit 
0c60: 74 77 6f 20 61 64 6a 61 63 65 6e 74 20 61 67 72  two adjacent agr
0c70: 69 63 75 6c 74 75 72 61 6c 20 61 72 65 61 73 20  icultural areas 
0c80: 61 6e 64 20 63 6f 75 6c 64 20 65 76 65 6e 74 75  and could eventu
0c90: 61 6c 6c 79 20 62 65 20 70 61 72 74 20 6f 66 20  ally be part of 
0ca0: 73 6f 6d 65 20 61 64 6d 69 6e 69 73 74 72 61 74  some administrat
0cb0: 69 76 65 20 62 6f 75 6e 64 61 72 79 2e 3c 2f 6c  ive boundary.</l
0cc0: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 54 6f 70 6f 4c  i>..<li><b>TopoL
0cd0: 61 79 65 72 73 3c 2f 62 3e 20 61 6e 64 20 3c 62  ayers</b> and <b
0ce0: 3e 54 6f 70 6f 46 65 61 74 75 72 65 73 3c 2f 62  >TopoFeatures</b
0cf0: 3e 20 72 65 70 72 65 73 65 6e 74 20 61 20 63 6f  > represent a co
0d00: 6d 70 6c 65 78 20 61 6e 64 20 66 6c 65 78 69 62  mplex and flexib
0d10: 6c 65 20 73 74 72 75 63 74 75 72 65 20 69 6e 74  le structure int
0d20: 65 6e 64 65 64 20 74 6f 20 65 73 74 61 62 6c 69  ended to establi
0d30: 73 68 20 70 65 72 6d 61 6e 65 6e 74 20 65 78 70  sh permanent exp
0d40: 6c 69 63 69 74 20 63 6f 72 72 65 73 70 6f 6e 64  licit correspond
0d50: 65 6e 63 65 73 20 62 65 74 77 65 65 6e 20 54 6f  ences between To
0d60: 70 6f 6c 6f 67 79 20 50 72 69 6d 69 74 69 76 65  pology Primitive
0d70: 73 20 61 6e 64 20 47 65 6f 54 61 62 6c 65 20 46  s and GeoTable F
0d80: 65 61 74 75 72 65 73 2e 0d 0a 3c 75 6c 3e 0d 0a  eatures...<ul>..
0d90: 3c 6c 69 3e 65 61 63 68 20 3c 62 3e 54 6f 70 6f  <li>each <b>Topo
0da0: 4c 61 79 65 72 3c 2f 62 3e 20 69 73 20 75 6e 69  Layer</b> is uni
0db0: 71 75 65 6c 79 20 69 64 65 6e 74 69 66 69 65 64  quely identified
0dc0: 20 62 79 20 69 74 73 20 3c 62 3e 6e 61 6d 65 3c   by its <b>name<
0dd0: 2f 62 3e 20 61 6e 64 20 64 69 72 65 63 74 6c 79  /b> and directly
0de0: 20 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f 20   corresponds to 
0df0: 61 20 73 69 6e 67 6c 65 20 47 65 6f 54 61 62 6c  a single GeoTabl
0e00: 65 20 74 6f 20 62 65 20 65 78 70 6f 72 74 65 64  e to be exported
0e10: 20 66 72 6f 6d 20 74 68 65 20 54 6f 70 6f 6c 6f   from the Topolo
0e20: 67 79 3c 62 72 3e 0d 0a 41 6e 20 61 72 62 69 74  gy<br>..An arbit
0e30: 72 61 72 79 20 6e 75 6d 62 65 72 20 6f 66 20 54  rary number of T
0e40: 6f 70 6f 4c 61 79 65 72 73 20 63 61 6e 20 62 65  opoLayers can be
0e50: 20 63 72 65 61 74 65 64 20 6f 6e 20 74 68 65 20   created on the 
0e60: 73 61 6d 65 20 54 6f 70 6f 6c 6f 67 79 2c 20 61  same Topology, a
0e70: 6e 64 20 65 61 63 68 20 6f 6e 65 20 6f 66 20 74  nd each one of t
0e80: 68 65 6d 20 77 69 6c 6c 20 61 63 74 20 61 73 20  hem will act as 
0e90: 61 20 73 65 70 61 72 61 74 65 20 63 6f 6e 74 61  a separate conta
0ea0: 69 6e 65 72 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  iner.</li>..<li>
0eb0: 65 61 63 68 20 3c 62 3e 54 6f 70 6f 46 65 61 74  each <b>TopoFeat
0ec0: 75 72 65 3c 2f 62 3e 20 69 73 20 75 6e 69 71 75  ure</b> is uniqu
0ed0: 65 6c 79 20 69 64 65 6e 74 69 66 69 65 64 20 62  ely identified b
0ee0: 79 20 69 74 73 20 3c 62 3e 66 69 64 3c 2f 62 3e  y its <b>fid</b>
0ef0: 20 28 3c 69 3e 66 65 61 74 75 72 65 2d 69 64 3c   (<i>feature-id<
0f00: 2f 69 3e 29 20 61 6e 64 20 63 6f 72 72 65 73 70  /i>) and corresp
0f10: 6f 6e 64 73 20 74 6f 20 61 20 73 69 6e 67 6c 65  onds to a single
0f20: 20 46 65 61 74 75 72 65 20 63 6f 6e 74 61 69 6e   Feature contain
0f30: 69 6e 67 20 61 6e 20 69 6e 64 69 76 69 64 75 61  ing an individua
0f40: 6c 20 73 65 74 20 6f 66 20 69 6e 66 6f 72 6d 61  l set of informa
0f50: 74 69 6f 6e 20 61 74 74 72 69 62 75 74 65 73 2e  tion attributes.
0f60: 3c 62 72 3e 0d 0a 54 68 65 20 47 65 6f 6d 65 74  <br>..The Geomet
0f70: 72 79 20 66 6f 72 20 65 61 63 68 20 54 6f 70 6f  ry for each Topo
0f80: 46 65 61 74 75 72 65 20 69 73 20 61 6c 77 61 79  Feature is alway
0f90: 73 20 69 6e 64 69 72 65 63 74 6c 79 20 64 65 66  s indirectly def
0fa0: 69 6e 65 64 20 62 79 20 73 70 65 63 69 66 79 69  ined by specifyi
0fb0: 6e 67 20 61 20 6c 69 73 74 20 6f 66 20 54 6f 70  ng a list of Top
0fc0: 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 76 65 73  ology primitives
0fd0: 20 69 6e 64 69 76 69 64 75 61 6c 6c 79 20 72 65   individually re
0fe0: 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65 69  ferenced by thei
0ff0: 72 20 49 44 73 2e 3c 62 72 3e 0d 0a 53 75 63 68  r IDs.<br>..Such
1000: 20 61 20 67 65 6f 6d 65 74 72 79 20 6f 62 76 69   a geometry obvi
1010: 6f 75 73 6c 79 20 69 73 20 61 20 3c 75 3e 3c 69  ously is a <u><i
1020: 3e 76 69 72 74 75 61 6c 3c 2f 69 3e 3c 2f 75 3e  >virtual</i></u>
1030: 20 6f 6e 65 2c 20 61 6e 64 20 77 69 6c 6c 20 62   one, and will b
1040: 65 20 61 63 74 75 61 6c 6c 79 20 6d 61 74 65 72  e actually mater
1050: 69 61 6c 69 7a 65 64 20 28 62 79 20 61 67 67 72  ialized (by aggr
1060: 65 67 61 74 69 6e 67 20 61 6c 6c 20 72 65 66 65  egating all refe
1070: 72 65 6e 63 65 64 20 54 6f 70 6f 6c 6f 67 79 20  renced Topology 
1080: 70 72 69 6d 69 74 69 76 65 73 29 20 6f 6e 6c 79  primitives) only
1090: 20 77 68 65 6e 20 65 78 70 6f 72 74 69 6e 67 20   when exporting 
10a0: 74 68 65 20 64 65 73 74 69 6e 61 74 69 6f 6e 20  the destination 
10b0: 47 65 6f 54 61 62 6c 65 2e 3c 2f 6c 69 3e 0d 0a  GeoTable.</li>..
10c0: 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  </ul></li>..<li>
10d0: 54 68 65 20 54 6f 70 6f 4c 61 79 65 72 73 20 2f  The TopoLayers /
10e0: 20 54 6f 70 6f 46 65 61 74 75 72 65 73 20 73 74   TopoFeatures st
10f0: 72 75 63 74 75 72 65 20 69 73 20 70 72 61 63 74  ructure is pract
1100: 69 63 61 6c 6c 79 20 69 6d 70 6c 65 6d 65 6e 74  ically implement
1110: 65 64 20 61 73 20 61 20 73 65 74 20 6f 66 20 73  ed as a set of s
1120: 65 76 65 72 61 6c 20 63 6c 6f 73 65 6c 79 20 72  everal closely r
1130: 65 6c 61 74 65 64 20 44 42 2d 74 61 62 6c 65 73  elated DB-tables
1140: 20 29 77 65 27 6c 6c 20 65 78 61 6d 69 6e 65 20   )we'll examine 
1150: 6c 61 74 65 72 20 74 68 65 69 72 20 72 65 73 70  later their resp
1160: 65 63 74 69 76 65 20 6c 61 79 6f 75 74 73 20 69  ective layouts i
1170: 6e 20 66 75 6c 6c 20 64 65 74 61 69 6c 29 3a 0d  n full detail):.
1180: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 3c 3c  .<ul>..<li><b><<
1190: 69 3e 74 6f 70 6f 2d 70 72 65 66 69 78 3c 2f 69  i>topo-prefix</i
11a0: 3e 3e 5f 74 6f 70 6f 6c 61 79 65 72 73 3c 2f 62  >>_topolayers</b
11b0: 3e 3a 20 74 68 69 73 20 66 69 72 73 74 20 74 61  >: this first ta
11c0: 62 6c 65 20 73 69 6d 70 6c 79 20 69 73 20 61 20  ble simply is a 
11d0: 63 61 74 61 6c 6f 67 20 6f 66 20 61 6c 6c 20 54  catalog of all T
11e0: 6f 70 6f 4c 61 79 65 72 73 20 73 75 70 70 6f 72  opoLayers suppor
11f0: 74 69 6e 67 20 74 68 65 20 73 61 6d 65 20 54 6f  ting the same To
1200: 70 6f 6c 6f 67 79 2e 3c 62 72 3e 0d 0a 45 61 63  pology.<br>..Eac
1210: 68 20 54 6f 70 6f 4c 61 79 65 72 20 69 73 20 69  h TopoLayer is i
1220: 64 65 6e 74 69 66 69 65 64 20 62 79 20 69 74 73  dentified by its
1230: 20 3c 62 3e 6e 61 6d 65 3c 2f 62 3e 20 61 6e 64   <b>name</b> and
1240: 20 62 79 20 69 74 73 20 3c 62 3e 49 44 3c 2f 62   by its <b>ID</b
1250: 3e 3b 20 62 6f 74 68 20 69 64 65 6e 74 69 66 69  >; both identifi
1260: 65 72 73 20 61 72 65 20 67 72 61 6e 74 65 64 20  ers are granted 
1270: 74 6f 20 62 65 20 3c 69 3e 3c 75 3e 75 6e 69 71  to be <i><u>uniq
1280: 75 65 3c 2f 75 3e 3c 2f 69 3e 2e 3c 2f 6c 69 3e  ue</u></i>.</li>
1290: 0d 0a 3c 6c 69 3e 3c 62 3e 3c 3c 69 3e 74 6f 70  ..<li><b><<i>top
12a0: 6f 2d 70 72 65 66 69 78 3c 2f 69 3e 3e 5f 74 6f  o-prefix</i>>_to
12b0: 70 6f 66 65 61 74 75 72 65 73 3c 2f 62 3e 3a 20  pofeatures</b>: 
12c0: 74 68 69 73 20 73 65 63 6f 6e 64 20 74 61 62 6c  this second tabl
12d0: 65 20 69 73 20 69 6e 74 65 6e 64 65 64 20 74 6f  e is intended to
12e0: 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20 73 74 6f   permanently sto
12f0: 72 65 20 61 6c 6c 20 63 72 6f 73 73 2d 72 65 66  re all cross-ref
1300: 65 72 65 6e 63 65 73 20 65 78 69 73 74 69 6e 67  erences existing
1310: 20 62 65 74 77 65 65 6e 20 54 6f 70 6f 6c 6f 67   between Topolog
1320: 79 20 70 72 69 6d 69 74 69 76 65 73 20 61 6e 64  y primitives and
1330: 20 54 6f 70 6f 46 65 61 74 75 72 65 73 2e 3c 2f   TopoFeatures.</
1340: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 3c 3c 69 3e  li>..<li><b><<i>
1350: 74 6f 70 6f 2d 70 72 65 66 69 78 3c 2f 69 3e 3e  topo-prefix</i>>
1360: 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 3c 3c  _topofeatures_<<
1370: 69 3e 74 6f 70 6f 6c 61 79 65 72 2d 69 64 3c 2f  i>topolayer-id</
1380: 69 3e 3e 3c 2f 62 3e 3a 20 66 6f 72 20 65 61 63  i>></b>: for eac
1390: 68 20 73 69 6e 67 6c 65 20 54 6f 70 6f 4c 61 79  h single TopoLay
13a0: 65 72 20 61 20 73 65 70 61 72 61 74 65 20 74 61  er a separate ta
13b0: 62 6c 65 20 69 73 20 72 65 71 75 69 72 65 64 2e  ble is required.
13c0: 20 54 68 65 20 61 63 74 75 61 6c 20 63 6f 72 72   The actual corr
13d0: 65 73 70 6f 6e 64 65 6e 63 65 20 69 73 20 65 73  espondence is es
13e0: 74 61 62 6c 69 73 68 65 64 20 76 69 61 20 74 68  tablished via th
13f0: 65 20 3c 62 3e 54 6f 70 6f 4c 61 79 65 72 2d 49  e <b>TopoLayer-I
1400: 44 3c 2f 62 3e 20 73 75 66 66 69 78 2e 3c 62 72  D</b> suffix.<br
1410: 3e 0d 0a 41 6c 6c 20 74 68 65 73 65 20 74 61 62  >..All these tab
1420: 6c 65 73 20 61 72 65 20 69 6e 74 65 6e 64 65 64  les are intended
1430: 20 74 6f 20 70 65 72 6d 61 6e 65 6e 74 6c 79 20   to permanently 
1440: 73 74 6f 72 65 20 74 68 65 20 69 6e 66 6f 72 6d  store the inform
1450: 61 74 69 6f 6e 20 61 74 74 72 69 62 75 74 65 73  ation attributes
1460: 20 66 6f 72 20 65 61 63 68 20 54 6f 70 6f 46 65   for each TopoFe
1470: 61 74 75 72 65 20 69 6e 20 74 68 65 20 73 61 6d  ature in the sam
1480: 65 20 54 6f 70 6f 4c 61 79 65 72 2e 0d 0a 44 69  e TopoLayer...Di
1490: 66 66 65 72 65 6e 74 20 54 6f 70 6f 4c 61 79 65  fferent TopoLaye
14a0: 72 73 20 77 69 6c 6c 20 6f 62 76 69 6f 73 75 6c  rs will obviosul
14b0: 79 20 73 75 70 70 6f 72 74 20 61 20 64 69 66 66  y support a diff
14c0: 65 72 65 6e 74 20 73 65 74 20 6f 66 20 69 6e 66  erent set of inf
14d0: 6f 72 6d 61 74 69 6f 6e 20 61 74 74 72 69 62 75  ormation attribu
14e0: 74 65 73 20 74 68 75 73 20 72 65 71 75 69 72 69  tes thus requiri
14f0: 6e 67 20 61 6e 20 69 6e 64 69 76 69 64 75 61 6c  ng an individual
1500: 20 74 61 62 6c 65 20 6c 61 79 6f 75 74 2e 3c 62   table layout.<b
1510: 72 3e 0d 0a 41 6e 79 77 61 79 20 61 6c 6c 20 74  r>..Anyway all t
1520: 68 65 73 65 20 74 61 62 6c 65 73 20 61 72 65 20  hese tables are 
1530: 61 6c 77 61 79 73 20 65 78 70 65 63 74 65 64 20  always expected 
1540: 74 6f 20 64 65 63 6c 61 72 65 20 61 20 3c 62 3e  to declare a <b>
1550: 50 72 69 6d 61 72 79 20 4b 65 79 3c 2f 62 3e 20  Primary Key</b> 
1560: 6f 66 20 74 68 65 20 3c 62 3e 49 4e 54 45 47 45  of the <b>INTEGE
1570: 52 3c 2f 62 3e 20 74 79 70 65 20 6e 61 6d 65 64  R</b> type named
1580: 20 3c 62 3e 66 69 64 3c 2f 62 3e 20 61 6e 64 20   <b>fid</b> and 
1590: 69 6e 74 65 6e 64 65 64 20 74 6f 20 62 65 20 61  intended to be a
15a0: 6e 20 75 6e 69 71 75 65 20 69 64 65 6e 74 69 66  n unique identif
15b0: 69 65 72 20 66 6f 72 20 65 61 63 68 20 54 6f 70  ier for each Top
15c0: 6f 46 65 61 74 75 72 65 2e 3c 2f 6c 69 3e 0d 0a  oFeature.</li>..
15d0: 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  </ul></li>..<li>
15e0: 53 65 76 65 72 61 6c 20 53 51 4c 20 66 75 6e 63  Several SQL func
15f0: 74 69 6f 6e 73 20 61 72 65 20 73 70 65 63 69 66  tions are specif
1600: 69 63 61 6c 6c 79 20 69 6e 74 65 6e 64 65 64 20  ically intended 
1610: 74 6f 20 73 75 70 70 6f 72 74 20 70 72 6f 63 65  to support proce
1620: 73 73 69 6e 67 20 6f 70 65 72 61 74 69 6f 6e 73  ssing operations
1630: 20 62 61 73 65 64 20 6f 6e 20 54 6f 70 6f 4c 61   based on TopoLa
1640: 79 65 72 73 20 61 6e 64 20 54 6f 70 6f 46 65 61  yers and TopoFea
1650: 74 75 65 73 3b 20 77 65 27 6c 6c 20 65 78 61 6d  tues; we'll exam
1660: 69 6e 65 20 6c 61 74 65 72 20 61 6c 6c 20 74 68  ine later all th
1670: 65 6d 20 69 6e 20 66 75 6c 6c 20 64 65 74 61 69  em in full detai
1680: 6c 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62  l.</li>..</ul><b
1690: 72 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68  r><br>..<hr>..<h
16a0: 32 3e 61 20 71 75 69 63 6b 20 70 72 61 63 74 69  2>a quick practi
16b0: 63 61 6c 20 65 78 65 72 63 69 73 65 3c 2f 68 32  cal exercise</h2
16c0: 3e 0d 0a 50 72 65 72 65 71 75 69 73 69 74 65 73  >..Prerequisites
16d0: 3a 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e 64 6f 77  :..<ol>..<li>dow
16e0: 6e 6c 6f 61 64 20 74 68 65 20 73 61 6d 70 6c 65  nload the sample
16f0: 20 44 42 2d 66 69 6c 65 20 66 72 6f 6d 20 3c 61   DB-file from <a
1700: 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77   href="https://w
1710: 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 67  ww.gaia-gis.it/g
1720: 61 69 61 2d 73 69 6e 73 2f 74 6f 70 6f 73 61 6d  aia-sins/toposam
1730: 70 6c 65 73 2f 74 75 73 63 61 6e 79 2d 63 65 6e  ples/tuscany-cen
1740: 73 75 73 2d 32 30 31 31 2e 37 7a 22 3e 68 65 72  sus-2011.7z">her
1750: 65 3c 2f 61 3e 3c 62 72 3e 0d 0a 49 74 20 63 6f  e</a><br>..It co
1760: 6e 74 61 69 6e 73 20 43 65 6e 73 75 73 20 64 61  ntains Census da
1770: 74 61 20 28 32 30 31 31 29 20 6b 69 6e 64 6c 79  ta (2011) kindly
1780: 20 72 65 6c 65 61 73 65 64 20 62 79 20 49 53 54   released by IST
1790: 41 54 20 75 6e 64 65 72 20 3c 62 3e 43 43 2d 42  AT under <b>CC-B
17a0: 59 3c 2f 62 3e 20 6c 69 63 65 6e 73 65 20 74 65  Y</b> license te
17b0: 72 6d 73 2e 3c 62 72 3e 0d 0a 54 68 65 20 6f 72  rms.<br>..The or
17c0: 69 67 69 6e 61 6c 20 64 61 74 61 73 65 74 73 20  iginal datasets 
17d0: 68 61 76 65 20 62 65 65 6e 20 73 6c 69 67 68 74  have been slight
17e0: 6c 79 20 72 65 61 72 72 61 6e 67 65 64 20 69 6e  ly rearranged in
17f0: 20 61 20 6d 6f 72 65 20 63 6f 6e 76 65 6e 69 65   a more convenie
1800: 6e 74 20 66 6f 72 6d 2e 0d 0a 41 6c 6c 20 67 65  nt form...All ge
1810: 6f 6d 65 74 72 69 65 73 20 61 72 65 20 69 6e 20  ometries are in 
1820: 74 68 65 20 3c 62 3e 53 52 49 44 20 33 32 36 33  the <b>SRID 3263
1830: 32 3c 2f 62 3e 20 28 3c 69 3e 57 47 53 20 38 34  2</b> (<i>WGS 84
1840: 20 2f 20 55 54 4d 20 7a 6f 6e 65 20 33 32 4e 3c   / UTM zone 32N<
1850: 2f 69 3e 29 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69  /i>):..<ul>..<li
1860: 3e 3c 62 3e 63 65 6e 73 75 73 5f 32 30 31 31 3c  ><b>census_2011<
1870: 2f 62 3e 3a 20 61 6c 6c 20 43 65 6e 73 75 73 20  /b>: all Census 
1880: 41 72 65 61 73 20 28 32 30 31 31 29 20 63 6f 76  Areas (2011) cov
1890: 65 72 69 6e 67 20 54 75 73 63 61 6e 79 2e 3c 62  ering Tuscany.<b
18a0: 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3a 3c 2f 75 3e  r>..<u>Note:</u>
18b0: 20 73 65 76 65 72 61 6c 20 43 65 6e 73 75 73 20   several Census 
18c0: 41 72 65 61 73 20 61 72 65 20 63 6f 6d 70 6c 65  Areas are comple
18d0: 74 65 6c 79 20 75 6e 69 6e 68 61 62 69 74 65 64  tely uninhabited
18e0: 20 28 6c 61 6b 65 73 2c 20 6d 61 72 73 68 6c 61   (lakes, marshla
18f0: 6e 64 73 2c 20 68 69 67 68 20 6d 6f 75 6e 74 61  nds, high mounta
1900: 69 6e 73 20 61 6e 64 20 61 6c 69 6b 65 29 2e 3c  ins and alike).<
1910: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 70 70 6c  /li>..<li><b>ppl
1920: 5f 32 30 31 31 3c 2f 62 3e 3a 20 50 6f 70 75 6c  _2011</b>: Popul
1930: 61 74 65 64 20 50 6c 61 63 65 73 20 28 64 65 66  ated Places (def
1940: 69 6e 65 64 20 61 73 20 61 6e 20 61 67 67 72 65  ined as an aggre
1950: 67 61 74 69 6f 6e 20 6f 66 20 43 65 6e 73 75 73  gation of Census
1960: 20 41 72 65 61 73 29 2e 3c 62 72 3e 0d 0a 3c 75   Areas).<br>..<u
1970: 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 6e 6f 74 20 61  >Note</u>: not a
1980: 6c 6c 20 43 65 6e 73 75 73 20 41 72 65 61 73 20  ll Census Areas 
1990: 62 65 6c 6f 6e 67 20 74 6f 20 61 20 50 6f 70 75  belong to a Popu
19a0: 6c 61 74 65 64 20 50 6c 61 63 65 3a 20 74 68 65  lated Place: the
19b0: 72 65 20 61 72 65 20 6d 61 6e 79 20 73 65 6c 66  re are many self
19c0: 2d 73 74 61 6e 64 69 6e 67 20 64 69 73 70 65 72  -standing disper
19d0: 73 65 64 20 72 75 72 61 6c 20 61 72 65 61 73 2e  sed rural areas.
19e0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 6f  </li>..<li><b>co
19f0: 6d 5f 32 30 31 31 3c 2f 62 3e 3a 20 54 75 73 63  m_2011</b>: Tusc
1a00: 61 6e 79 20 4d 75 6e 69 63 69 70 61 6c 69 74 69  any Municipaliti
1a10: 65 73 20 2f 20 4c 6f 63 61 6c 20 43 6f 75 6e 63  es / Local Counc
1a20: 69 6c 73 20 32 30 31 31 20 28 64 65 66 69 6e 65  ils 2011 (define
1a30: 64 20 61 73 20 61 6e 20 61 67 67 72 65 67 61 74  d as an aggregat
1a40: 69 6f 6e 73 20 6f 66 20 43 65 6e 73 75 73 20 41  ions of Census A
1a50: 72 65 61 73 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  reas).</li>..<li
1a60: 3e 3c 62 3e 63 6f 6d 5f 32 30 31 34 5f 31 35 3c  ><b>com_2014_15<
1a70: 2f 62 3e 3a 20 66 65 77 20 6e 65 77 20 4d 75 6e  /b>: few new Mun
1a80: 69 63 69 70 61 6c 69 74 69 65 73 20 63 72 65 61  icipalities crea
1a90: 74 65 64 20 64 75 72 69 6e 67 20 79 65 61 72 73  ted during years
1aa0: 20 32 30 31 34 2f 31 35 20 62 79 20 6d 65 72 67   2014/15 by merg
1ab0: 69 6e 67 20 70 72 65 2d 65 78 69 73 74 69 6e 67  ing pre-existing
1ac0: 20 73 6d 61 6c 6c 65 72 20 4d 75 6e 69 63 69 70   smaller Municip
1ad0: 61 6c 69 74 69 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c  alities.</li>..<
1ae0: 6c 69 3e 3c 62 3e 70 72 6f 76 5f 32 30 31 31 3c  li><b>prov_2011<
1af0: 2f 62 3e 3a 20 54 75 73 63 61 6e 79 20 50 72 6f  /b>: Tuscany Pro
1b00: 76 69 6e 63 65 73 20 2f 20 43 6f 75 6e 74 69 65  vinces / Countie
1b10: 73 20 28 64 65 66 69 6e 65 64 20 61 73 20 61 6e  s (defined as an
1b20: 20 61 67 67 72 65 67 61 74 69 6f 6e 20 6f 66 20   aggregation of 
1b30: 4d 75 6e 69 63 69 70 61 6c 69 74 69 65 73 29 2e  Municipalities).
1b40: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 72 65  </li>..<li><b>re
1b50: 67 5f 32 30 31 31 3c 2f 62 3e 3a 20 54 75 73 63  g_2011</b>: Tusc
1b60: 61 6e 79 20 52 65 67 69 6f 6e 20 28 64 65 66 69  any Region (defi
1b70: 6e 65 64 20 61 73 20 61 6e 20 61 67 67 72 65 67  ned as an aggreg
1b80: 61 74 69 6f 6e 20 6f 66 20 50 72 6f 76 69 6e 63  ation of Provinc
1b90: 65 73 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 6a  es).</li>..<li>j
1ba0: 75 73 74 20 3c 62 3e 63 65 6e 73 75 73 5f 32 30  ust <b>census_20
1bb0: 31 31 3c 2f 62 3e 20 61 6c 6f 6e 65 20 73 75 70  11</b> alone sup
1bc0: 70 6f 72 74 73 20 67 65 6f 6d 65 74 72 69 65 73  ports geometries
1bd0: 3b 20 61 6e 79 20 6f 74 68 65 72 20 61 64 6d 69  ; any other admi
1be0: 6e 69 73 74 72 61 74 69 76 65 20 6c 65 76 65 6c  nistrative level
1bf0: 20 69 73 20 73 69 6d 70 6c 79 20 64 65 66 69 6e   is simply defin
1c00: 65 64 20 62 79 20 72 65 6c 61 74 69 6f 6e 61 6c  ed by relational
1c10: 20 63 6f 64 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f   codes.</li>..</
1c20: 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 75 6e  ul></li>..<li>un
1c30: 63 6f 6d 70 72 65 73 73 20 74 68 65 20 64 6f 77  compress the dow
1c40: 6e 6c 6f 61 64 65 64 20 64 62 2d 66 69 6c 65 20  nloaded db-file 
1c50: 28 3c 62 3e 3c 69 3e 74 75 73 63 61 6e 79 2d 63  (<b><i>tuscany-c
1c60: 65 6e 73 75 73 2d 32 30 31 31 2e 73 71 6c 69 74  ensus-2011.sqlit
1c70: 65 3c 2f 69 3e 3c 2f 62 3e 29 2e 3c 2f 6c 69 3e  e</i></b>).</li>
1c80: 0d 0a 3c 6c 69 3e 6e 6f 77 20 79 6f 75 20 63 61  ..<li>now you ca
1c90: 6e 20 66 69 6e 61 6c 6c 79 20 73 74 61 72 74 20  n finally start 
1ca0: 61 20 53 70 61 74 69 61 4c 69 74 65 20 73 65 73  a SpatiaLite ses
1cb0: 73 69 6f 6e 20 75 73 69 6e 67 20 79 6f 75 72 20  sion using your 
1cc0: 70 72 65 66 65 72 72 65 64 20 53 70 61 74 69 61  preferred Spatia
1cd0: 4c 69 74 65 20 66 72 6f 6e 74 20 65 6e 64 20 74  Lite front end t
1ce0: 6f 6f 6c 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  ool:..<ul>..<li>
1cf0: 3c 75 3e 41 74 74 65 6e 74 69 6f 6e 3c 2f 75 3e  <u>Attention</u>
1d00: 3a 20 79 6f 75 20 6d 75 73 74 20 6e 6f 74 20 64  : you must not d
1d10: 69 72 65 63 74 6c 79 20 63 6f 6e 6e 65 63 74 20  irectly connect 
1d20: 74 6f 20 3c 62 3e 3c 69 3e 74 75 73 63 61 6e 79  to <b><i>tuscany
1d30: 2d 63 65 6e 73 75 73 2d 32 30 31 31 2e 73 71 6c  -census-2011.sql
1d40: 69 74 65 3c 2f 69 3e 3c 2f 62 3e 3b 20 79 6f 75  ite</i></b>; you
1d50: 20 61 72 65 20 65 78 70 65 63 74 65 64 20 69 6e   are expected in
1d60: 73 74 65 61 64 20 74 6f 20 63 6f 6e 6e 65 63 74  stead to connect
1d70: 20 61 20 6e 65 77 20 28 65 6d 70 74 79 29 20 44   a new (empty) D
1d80: 42 2d 66 69 6c 65 20 6e 61 6d 65 64 20 3c 62 3e  B-file named <b>
1d90: 74 75 73 63 61 6e 79 2d 74 6f 70 6f 2d 32 30 31  tuscany-topo-201
1da0: 31 2e 73 71 6c 69 74 65 3c 2f 62 3e 3c 2f 6c 69  1.sqlite</b></li
1db0: 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c  >..</ul></li>..<
1dc0: 2f 6f 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e  /ol>..<verbatim>
1dd0: 0d 0a 53 45 4c 45 43 54 20 43 72 65 61 74 65 54  ..SELECT CreateT
1de0: 6f 70 6f 6c 6f 67 79 28 27 63 65 6e 73 75 73 32  opology('census2
1df0: 30 31 31 27 2c 20 33 32 36 33 32 2c 20 30 2c 20  011', 32632, 0, 
1e00: 30 29 3b 0d 0a 31 0d 0a 0d 0a 41 54 54 41 43 48  0);..1....ATTACH
1e10: 20 44 41 54 41 42 41 53 45 20 22 2e 2f 74 75 73   DATABASE "./tus
1e20: 63 61 6e 79 2d 63 65 6e 73 75 73 2d 32 30 31 31  cany-census-2011
1e30: 2e 73 71 6c 69 74 65 22 20 41 53 20 69 73 74 61  .sqlite" AS ista
1e40: 74 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 54 6f 70  t;....SELECT Top
1e50: 6f 47 65 6f 5f 46 72 6f 6d 47 65 6f 54 61 62 6c  oGeo_FromGeoTabl
1e60: 65 28 27 63 65 6e 73 75 73 32 30 31 31 27 2c 20  e('census2011', 
1e70: 27 69 73 74 61 74 27 2c 20 27 63 65 6e 73 75 73  'istat', 'census
1e80: 5f 32 30 31 31 27 2c 20 4e 55 4c 4c 2c 20 30 2c  _2011', NULL, 0,
1e90: 20 35 31 32 2c 20 2d 31 29 3b 0d 0a 31 0d 0a 0d   512, -1);..1...
1ea0: 0a 53 45 4c 45 43 54 20 53 54 5f 56 61 6c 69 64  .SELECT ST_Valid
1eb0: 61 74 65 54 6f 70 6f 47 65 6f 28 27 63 65 6e 73  ateTopoGeo('cens
1ec0: 75 73 32 30 31 31 27 29 3b 0d 0a 4e 55 4c 4c 0d  us2011');..NULL.
1ed0: 0a 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d  ...SELECT * FROM
1ee0: 20 54 45 4d 50 2e 63 65 6e 73 75 73 32 30 31 31   TEMP.census2011
1ef0: 5f 76 61 6c 69 64 61 74 65 5f 74 6f 70 6f 67 65  _validate_topoge
1f00: 6f 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 54 6f 70  o;....SELECT Top
1f10: 6f 47 65 6f 5f 43 72 65 61 74 65 54 6f 70 6f 4c  oGeo_CreateTopoL
1f20: 61 79 65 72 28 27 63 65 6e 73 75 73 32 30 31 31  ayer('census2011
1f30: 27 2c 20 27 69 73 74 61 74 27 2c 20 27 63 65 6e  ', 'istat', 'cen
1f40: 73 75 73 5f 32 30 31 31 27 2c 20 4e 55 4c 4c 2c  sus_2011', NULL,
1f50: 20 27 63 65 6e 73 75 73 5f 61 72 65 61 73 27 29   'census_areas')
1f60: 3b 0d 0a 31 0d 0a 0d 0a 44 45 54 41 43 48 20 44  ;..1....DETACH D
1f70: 41 54 41 42 41 53 45 20 69 73 74 61 74 3b 0d 0a  ATABASE istat;..
1f80: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 0d 0a 3c  </verbatim>....<
1f90: 62 72 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20  br><br>..<table 
1fa0: 77 69 64 74 68 3d 22 31 30 30 25 22 3e 3c 74 72  width="100%"><tr
1fb0: 3e 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33  >..<td width="33
1fc0: 25 22 20 61 6c 69 67 6e 3d 22 6c 65 66 74 22 3e  %" align="left">
1fd0: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f  <a href="https:/
1fe0: 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74  /www.gaia-gis.it
1ff0: 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69  /fossil/libspati
2000: 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d  alite/wiki?name=
2010: 74 6f 70 6f 2d 69 6e 74 65 72 6d 65 64 69 61 74  topo-intermediat
2020: 65 22 3e 70 72 65 76 69 6f 75 73 20 70 61 67 65  e">previous page
2030: 3c 2f 61 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 61  </a></td>..<td a
2040: 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 3c 61  lign="center"><a
2050: 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77   href="https://w
2060: 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66  ww.gaia-gis.it/f
2070: 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c  ossil/libspatial
2080: 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 6d 69  ite/wiki?name=mi
2090: 73 63 2d 64 6f 63 73 22 3e 62 61 63 6b 20 74 6f  sc-docs">back to
20a0: 20 69 6e 64 65 78 3c 2f 61 3e 3c 2f 74 64 3e 0d   index</a></td>.
20b0: 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33 25 22  .<td width="33%"
20c0: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 3c   align="right"><
20d0: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f  a href="https://
20e0: 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f  www.gaia-gis.it/
20f0: 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61  fossil/libspatia
2100: 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 74  lite/wiki?name=t
2110: 6f 70 6f 2d 61 64 76 61 6e 63 65 64 22 3e 6e 65  opo-advanced">ne
2120: 78 74 20 70 61 67 65 3c 2f 61 3e 3c 2f 74 64 3e  xt page</a></td>
2130: 0d 0a 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0a  ..</tr></table>.
2140: 5a 20 64 65 33 33 64 66 38 33 34 61 64 30 30 30  Z de33df834ad000
2150: 31 34 64 64 37 32 35 61 35 34 32 37 63 61 64 39  14dd725a5427cad9
2160: 30 34 0a                                         04.