Hex Artifact Content
Not logged in

Artifact 5b8e2b8b2fe8ddff23a841a95233b84ed3911ec8:

Wiki page [topo-advanced] by sandro 2021-01-13 16:42:47.
0000: 44 20 32 30 32 31 2d 30 31 2d 31 33 54 31 36 3a  D 2021-01-13T16:
0010: 34 32 3a 34 37 2e 37 31 32 0a 4c 20 74 6f 70 6f  42:47.712.L topo
0020: 2d 61 64 76 61 6e 63 65 64 0a 50 20 38 39 62 65  -advanced.P 89be
0030: 65 32 31 39 36 38 30 62 32 31 61 63 36 34 66 36  e219680b21ac64f6
0040: 39 34 32 63 31 61 33 37 39 66 39 38 32 65 64 30  942c1a379f982ed0
0050: 61 32 33 65 0a 55 20 73 61 6e 64 72 6f 0a 57 20  a23e.U sandro.W 
0060: 33 33 34 33 31 0a 3c 74 61 62 6c 65 20 63 65 6c  33431.<table cel
0070: 6c 73 70 61 63 69 6e 67 3d 22 31 32 22 20 77 69  lspacing="12" wi
0080: 64 74 68 3d 22 31 30 30 25 22 3e 0d 0a 3c 74 72  dth="100%">..<tr
0090: 3e 3c 74 64 20 63 6f 6c 73 70 61 6e 3d 22 32 22  ><td colspan="2"
00a0: 3e 0d 0a 3c 74 61 62 6c 65 20 77 69 64 74 68 3d  >..<table width=
00b0: 22 31 30 30 25 22 20 62 67 63 6f 6c 6f 72 3d 22  "100%" bgcolor="
00c0: 23 66 30 66 30 66 38 22 3e 0d 0a 3c 74 72 3e 3c  #f0f0f8">..<tr><
00d0: 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72  td align="center
00e0: 22 3e 0d 0a 3c 68 31 3e 54 6f 70 6f 6c 6f 67 79  ">..<h1>Topology
00f0: 2d 47 65 6f 6d 65 74 72 79 3a 20 61 6e 20 61 64  -Geometry: an ad
0100: 76 61 6e 63 65 64 20 74 75 74 6f 72 69 61 6c 3c  vanced tutorial<
0110: 2f 68 31 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e  /h1>..</td></tr>
0120: 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 74 61 62 6c 65  </table>..<table
0130: 20 77 69 64 74 68 3d 22 31 30 30 25 22 3e 3c 74   width="100%"><t
0140: 72 3e 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22 33  r>..<td width="3
0150: 33 25 22 20 61 6c 69 67 6e 3d 22 6c 65 66 74 22  3%" align="left"
0160: 3e 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a  ><a href="https:
0170: 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69  //www.gaia-gis.i
0180: 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74  t/fossil/libspat
0190: 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65  ialite/wiki?name
01a0: 3d 74 6f 70 6f 2d 69 6e 74 65 72 6d 65 64 69 61  =topo-intermedia
01b0: 74 65 22 3e 70 72 65 76 69 6f 75 73 20 70 61 67  te">previous pag
01c0: 65 3c 2f 61 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20  e</a></td>..<td 
01d0: 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 3c  align="center"><
01e0: 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f  a href="https://
01f0: 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f  www.gaia-gis.it/
0200: 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61  fossil/libspatia
0210: 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 49  lite/wiki?name=I
0220: 53 4f 2b 54 6f 70 6f 6c 6f 67 79 22 3e 62 61 63  SO+Topology">bac
0230: 6b 20 74 6f 20 69 6e 64 65 78 3c 2f 61 3e 3c 2f  k to index</a></
0240: 74 64 3e 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22  td>..<td width="
0250: 33 33 25 22 20 61 6c 69 67 6e 3d 22 72 69 67 68  33%" align="righ
0260: 74 22 3e 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 3c  t"></td>..</tr><
0270: 2f 74 61 62 6c 65 3e 0d 0a 3c 64 69 76 20 77 69  /table>..<div wi
0280: 64 74 68 3d 39 30 25 3e 0d 0a 3c 68 33 3e 54 6f  dth=90%>..<h3>To
0290: 70 6f 4c 61 79 65 72 73 20 61 6e 64 20 54 6f 70  poLayers and Top
02a0: 6f 46 65 61 74 75 72 65 73 3c 2f 68 33 3e 0d 0a  oFeatures</h3>..
02b0: 49 6e 20 74 68 65 20 70 72 65 76 69 6f 75 73 20  In the previous 
02c0: 74 75 74 6f 72 69 61 6c 20 77 65 27 76 65 20 65  tutorial we've e
02d0: 78 61 6d 69 6e 65 64 20 61 20 66 69 72 73 74 20  xamined a first 
02e0: 63 6f 75 70 6c 65 20 6f 66 20 53 51 4c 20 66 75  couple of SQL fu
02f0: 6e 63 74 69 6f 6e 73 20 69 6e 74 65 6e 64 65 64  nctions intended
0300: 20 74 6f 20 65 78 70 6f 72 74 20 61 20 47 65 6f   to export a Geo
0310: 54 61 62 6c 65 20 6f 75 74 20 66 72 6f 6d 20 61  Table out from a
0320: 6e 20 65 78 69 73 74 69 6e 67 20 54 6f 70 6f 6c  n existing Topol
0330: 6f 67 79 3a 20 3c 62 3e 54 6f 70 6f 47 65 6f 5f  ogy: <b>TopoGeo_
0340: 54 6f 47 65 6f 54 61 62 6c 65 28 29 3c 2f 62 3e  ToGeoTable()</b>
0350: 20 61 6e 64 20 3c 62 3e 54 6f 70 6f 47 65 6f 5f   and <b>TopoGeo_
0360: 54 6f 47 65 6f 54 61 62 6c 65 47 65 6e 65 72 61  ToGeoTableGenera
0370: 6c 69 7a 65 28 29 3c 2f 62 3e 2e 3c 62 72 3e 0d  lize()</b>.<br>.
0380: 0a 53 70 61 74 69 61 4c 69 74 65 20 73 75 70 70  .SpatiaLite supp
0390: 6f 72 74 73 20 61 20 6d 6f 72 65 20 73 6f 70 68  orts a more soph
03a0: 69 73 74 69 63 61 74 65 64 20 28 61 6e 64 20 63  isticated (and c
03b0: 6f 6d 70 6c 65 78 29 20 61 70 70 72 6f 61 63 68  omplex) approach
03c0: 20 62 61 73 65 64 20 6f 6e 20 3c 62 3e 54 6f 70   based on <b>Top
03d0: 6f 4c 61 79 65 72 73 3c 2f 62 3e 20 61 6e 64 20  oLayers</b> and 
03e0: 3c 62 3e 54 6f 70 6f 46 65 61 74 75 72 65 73 3c  <b>TopoFeatures<
03f0: 2f 62 3e 20 73 70 65 63 69 66 69 63 61 6c 6c 79  /b> specifically
0400: 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 73 75 70   intended to sup
0410: 70 6f 72 74 20 61 20 76 65 72 79 20 66 6c 65 78  port a very flex
0420: 69 62 6c 65 20 6d 65 63 68 61 6e 69 73 6d 20 66  ible mechanism f
0430: 6f 72 20 65 78 70 6f 72 74 69 6e 67 20 61 20 66  or exporting a f
0440: 75 6c 6c 20 73 65 74 20 6f 66 20 47 65 6f 54 61  ull set of GeoTa
0450: 62 6c 65 28 73 29 20 64 69 72 65 63 74 6c 79 20  ble(s) directly 
0460: 64 65 72 69 76 69 6e 67 20 66 72 6f 6d 20 61 20  deriving from a 
0470: 54 6f 70 6f 6c 6f 67 79 2e 0d 0a 3c 68 34 3e 61  Topology...<h4>a
0480: 20 63 6f 6e 63 65 70 74 75 61 6c 20 72 65 66 65   conceptual refe
0490: 72 65 6e 63 65 20 66 72 61 6d 65 77 6f 72 6b 3c  rence framework<
04a0: 2f 68 34 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  /h4>..<ul>..<li>
04b0: 61 6e 20 49 53 4f 20 54 6f 70 6f 6c 6f 67 79 20  an ISO Topology 
04c0: 69 73 20 6a 75 73 74 20 69 6e 74 65 6e 64 65 64  is just intended
04d0: 20 74 6f 20 73 75 70 70 6f 72 74 20 61 20 63 6f   to support a co
04e0: 6e 73 69 73 74 65 6e 74 20 73 65 74 20 6f 66 20  nsistent set of 
04f0: 3c 62 3e 4e 6f 64 65 73 3c 2f 62 3e 2c 20 3c 62  <b>Nodes</b>, <b
0500: 3e 45 64 67 65 73 3c 2f 62 3e 20 61 6e 64 20 3c  >Edges</b> and <
0510: 62 3e 46 61 63 65 73 3c 2f 62 3e 20 70 72 69 6d  b>Faces</b> prim
0520: 69 74 69 76 65 73 20 66 75 6c 6c 79 20 63 6f 76  itives fully cov
0530: 65 72 69 6e 67 20 74 68 65 20 70 6c 61 6e 65 2e  ering the plane.
0540: 0d 0a 54 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69  ..Topology primi
0550: 74 69 76 65 73 20 63 6f 72 72 65 73 70 6f 6e 64  tives correspond
0560: 20 74 6f 20 70 75 72 65 20 67 65 6f 6d 65 74 72   to pure geometr
0570: 69 65 73 2c 20 61 6e 64 20 63 61 6e 20 3c 62 3e  ies, and can <b>
0580: 6e 65 76 65 72 3c 2f 62 3e 20 62 65 20 64 69 72  never</b> be dir
0590: 65 63 74 6c 79 20 61 73 73 6f 63 69 61 74 65 64  ectly associated
05a0: 20 74 6f 20 61 20 63 6f 72 72 65 73 70 6f 6e 64   to a correspond
05b0: 69 6e 67 20 73 65 74 20 6f 66 20 69 6e 66 6f 72  ing set of infor
05c0: 6d 61 74 69 6f 6e 61 6c 20 61 74 74 72 69 62 75  mational attribu
05d0: 74 65 73 2e 0d 0a 42 6f 74 68 20 4e 6f 64 65 20  tes...Both Node 
05e0: 61 6e 64 20 45 64 67 65 20 70 72 69 6d 69 74 69  and Edge primiti
05f0: 76 65 73 20 64 69 72 65 63 74 6c 79 20 63 6f 72  ves directly cor
0600: 72 65 73 70 6f 6e 64 20 74 6f 20 61 20 3c 75 3e  respond to a <u>
0610: 3c 69 3e 72 65 61 6c 20 67 65 6f 6d 65 74 72 79  <i>real geometry
0620: 3c 2f 69 3e 3c 2f 75 3e 2c 20 62 75 74 20 46 61  </i></u>, but Fa
0630: 63 65 20 70 72 69 6d 69 74 69 76 65 73 20 73 69  ce primitives si
0640: 6d 70 6c 79 20 63 6f 72 72 65 73 70 6f 6e 64 20  mply correspond 
0650: 74 6f 20 61 20 3c 75 3e 3c 69 3e 76 69 72 74 75  to a <u><i>virtu
0660: 61 6c 20 67 65 6f 6d 65 74 72 79 3c 2f 69 3e 3c  al geometry</i><
0670: 2f 75 3e 20 74 68 75 73 20 6e 65 63 65 73 73 61  /u> thus necessa
0680: 72 69 6c 79 20 72 65 71 75 69 72 69 6e 67 20 74  rily requiring t
0690: 6f 20 62 65 20 64 79 6e 61 6d 69 63 61 6c 6c 79  o be dynamically
06a0: 20 72 65 63 6f 6e 73 74 72 75 63 74 65 64 20 65   reconstructed e
06b0: 76 65 72 79 20 74 69 6d 65 20 74 68 61 74 20 74  very time that t
06c0: 68 65 79 20 61 72 65 20 72 65 66 65 72 65 6e 63  hey are referenc
06d0: 65 64 20 28 61 6e 64 20 74 68 69 73 20 63 6f 75  ed (and this cou
06e0: 6c 64 20 65 61 73 69 6c 79 20 62 65 63 6f 6d 65  ld easily become
06f0: 20 61 20 72 65 61 6c 20 62 6f 74 74 6c 65 6e 65   a real bottlene
0700: 63 6b 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 41  ck).</li>..<li>A
0710: 20 47 65 6f 54 61 62 6c 65 20 28 61 6c 69 61 73   GeoTable (alias
0720: 20 3c 75 3e 3c 69 3e 6c 61 79 65 72 3c 2f 69 3e   <u><i>layer</i>
0730: 3c 2f 75 3e 2c 20 74 6f 20 75 73 65 20 74 68 65  </u>, to use the
0740: 20 63 6f 6d 6d 6f 6e 20 47 49 53 20 74 65 72 6d   common GIS term
0750: 69 6e 6f 6c 6f 67 79 29 20 6f 6e 20 74 68 65 20  inology) on the 
0760: 6f 74 68 65 72 20 68 61 6e 64 2c 20 69 73 20 61  other hand, is a
0770: 6c 77 61 79 73 20 62 61 73 65 64 20 6f 6e 20 6d  lways based on m
0780: 61 6e 79 20 64 69 73 74 69 6e 63 74 20 66 65 61  any distinct fea
0790: 74 75 72 65 73 2c 20 61 6e 64 20 66 6f 72 20 65  tures, and for e
07a0: 61 63 68 20 66 65 61 74 75 72 65 20 61 20 47 65  ach feature a Ge
07b0: 6f 6d 65 74 72 79 20 3c 62 3e 77 69 74 68 3c 2f  ometry <b>with</
07c0: 62 3e 20 61 73 73 6f 63 69 61 74 65 64 20 73 65  b> associated se
07d0: 74 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e  t of information
07e0: 20 61 74 74 72 69 62 75 74 65 73 2e 3c 2f 6c 69   attributes.</li
07f0: 3e 0d 0a 3c 6c 69 3e 74 68 65 72 65 20 69 73 20  >..<li>there is 
0800: 61 20 66 75 72 74 68 65 72 20 64 69 66 66 65 72  a further differ
0810: 65 6e 63 65 20 74 6f 20 62 65 20 74 61 6b 65 6e  ence to be taken
0820: 20 69 6e 74 6f 20 61 63 63 6f 75 6e 74 3a 20 54   into account: T
0830: 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 76  opology primitiv
0840: 65 73 20 6e 65 63 65 73 73 61 72 69 6c 79 20 61  es necessarily a
0850: 72 65 20 65 6c 65 6d 65 6e 74 61 72 79 2e 20 46  re elementary. F
0860: 65 61 74 75 72 65 20 47 65 6f 6d 65 74 72 69 65  eature Geometrie
0870: 73 20 63 61 6e 20 75 73 75 61 6c 6c 79 20 72 65  s can usually re
0880: 70 72 65 73 65 6e 74 20 73 6f 6d 65 20 63 6f 6d  present some com
0890: 70 6c 65 78 20 74 79 70 65 3a 20 4d 55 4c 54 49  plex type: MULTI
08a0: 50 4f 49 4e 54 2c 20 4d 55 4c 54 49 4c 49 4e 45  POINT, MULTILINE
08b0: 53 54 52 49 4e 47 2c 20 4d 55 4c 54 49 50 4f 4c  STRING, MULTIPOL
08c0: 59 47 4f 4e 20 61 6e 64 20 70 6f 73 73 69 62 6c  YGON and possibl
08d0: 79 20 61 20 47 45 4f 4d 45 54 52 59 43 4f 4c 4c  y a GEOMETRYCOLL
08e0: 45 43 54 49 4f 4e 2e 20 53 6f 20 69 74 20 69 73  ECTION. So it is
08f0: 20 70 6f 73 73 69 62 6c 65 20 74 68 61 74 20 61   possible that a
0900: 20 46 65 61 74 75 72 65 20 47 65 6f 6d 65 74 72   Feature Geometr
0910: 79 20 64 6f 65 73 20 6e 6f 74 20 6e 65 63 65 73  y does not neces
0920: 73 61 72 69 6c 79 20 63 6f 72 72 65 73 70 6f 6e  sarily correspon
0930: 64 73 20 74 6f 20 61 20 73 69 6e 67 6c 65 20 54  ds to a single T
0940: 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 76  opology primitiv
0950: 65 20 3b 20 61 20 46 65 61 74 75 72 65 20 47 65  e ; a Feature Ge
0960: 6f 6d 65 74 72 79 20 63 6f 75 6c 64 20 65 61 73  ometry could eas
0970: 69 6c 79 20 62 65 20 64 65 72 69 76 65 64 20 66  ily be derived f
0980: 72 6f 6d 20 74 68 65 20 63 6f 6c 6c 65 63 74 69  rom the collecti
0990: 6f 6e 20 6f 66 20 6d 61 6e 79 20 64 69 66 66 65  on of many diffe
09a0: 72 65 6e 74 20 54 6f 70 6f 6c 6f 67 79 20 70 72  rent Topology pr
09b0: 69 6d 69 74 69 76 65 73 2e 3c 2f 6c 69 3e 20 0d  imitives.</li> .
09c0: 0a 3c 6c 69 3e 74 68 61 74 27 73 20 6e 6f 74 20  .<li>that's not 
09d0: 61 6c 6c 3a 20 6d 61 6e 79 20 64 69 66 66 65 72  all: many differ
09e0: 65 6e 74 20 47 65 6f 54 61 62 6c 65 73 20 63 6f  ent GeoTables co
09f0: 75 6c 64 20 65 76 65 6e 74 75 61 6c 6c 79 20 62  uld eventually b
0a00: 65 20 64 65 72 69 76 65 64 20 66 72 6f 6d 20 61  e derived from a
0a10: 20 73 69 6e 67 6c 65 20 54 6f 70 6f 6c 6f 67 79   single Topology
0a20: 3b 20 61 6e 64 20 74 68 65 20 73 61 6d 65 20 54  ; and the same T
0a30: 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 76  opology primitiv
0a40: 65 20 63 6f 75 6c 64 20 70 6c 61 79 20 61 20 20  e could play a  
0a50: 3c 62 3e 63 6f 6d 70 6c 65 74 65 6c 79 20 64 69  <b>completely di
0a60: 66 66 65 72 65 6e 74 3c 2f 62 3e 20 72 6f 6c 65  fferent</b> role
0a70: 20 69 6e 20 65 61 63 68 20 47 65 6f 54 61 62 6c   in each GeoTabl
0a80: 65 2e 3c 62 72 3e 0d 0a 41 20 73 69 6d 70 6c 65  e.<br>..A simple
0a90: 20 73 61 6d 70 6c 65 3a 20 69 6d 61 67 69 6e 65   sample: imagine
0aa0: 20 61 20 54 6f 70 6f 6c 6f 67 79 20 63 6f 72 72   a Topology corr
0ab0: 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 73 6f 6d  esponding to som
0ac0: 65 20 6c 61 6e 64 20 72 65 67 69 73 74 72 79 20  e land registry 
0ad0: 6d 61 70 20 77 68 65 72 65 20 6d 61 6e 79 20 70  map where many p
0ae0: 6f 74 65 6e 74 69 61 6c 20 6c 61 79 65 72 73 20  otential layers 
0af0: 73 75 63 68 20 61 73 3a 20 62 75 69 6c 64 69 6e  such as: buildin
0b00: 67 73 2c 20 61 67 72 69 63 75 6c 74 75 72 61 6c  gs, agricultural
0b10: 20 6c 61 6e 64 2c 20 70 6f 70 75 6c 61 74 65 64   land, populated
0b20: 20 70 6c 61 63 65 73 2c 20 61 64 6d 69 6e 69 73   places, adminis
0b30: 74 72 61 74 69 76 65 20 62 6f 75 6e 64 61 72 69  trative boundari
0b40: 65 73 2c 20 72 6f 61 64 73 2c 20 70 6f 6e 64 73  es, roads, ponds
0b50: 2c 20 72 69 76 65 72 73 2c 20 66 65 6e 63 65 73  , rivers, fences
0b60: 20 77 69 6c 6c 20 65 78 69 73 74 2e 3c 62 72 3e   will exist.<br>
0b70: 0d 0a 49 6e 20 73 75 63 68 20 61 20 63 6f 6e 74  ..In such a cont
0b80: 65 78 74 20 61 20 66 65 6e 63 65 20 63 6f 75 6c  ext a fence coul
0b90: 64 20 65 61 73 69 6c 79 20 63 6f 72 72 65 73 70  d easily corresp
0ba0: 6f 6e 64 20 74 6f 20 61 20 46 65 61 74 75 72 65  ond to a Feature
0bb0: 20 77 69 74 68 69 6e 20 74 68 65 20 22 3c 69 3e   within the "<i>
0bc0: 3c 62 3e 66 65 6e 63 65 73 3c 2f 62 3e 3c 2f 69  <b>fences</b></i
0bd0: 3e 22 20 6c 61 79 65 72 2c 20 63 6f 75 6c 64 2c  >" layer, could,
0be0: 20 3c 62 3e 6e 6f 74 20 6f 6e 6c 79 2c 20 73 65   <b>not only, se
0bf0: 70 61 72 61 74 65 3c 2f 62 3e 20 74 77 6f 20 61  parate</b> two a
0c00: 64 6a 61 63 65 6e 74 20 61 67 72 69 63 75 6c 74  djacent agricult
0c10: 75 72 61 6c 20 61 72 65 61 73 2c 20 3c 62 3e 62  ural areas, <b>b
0c20: 75 74 20 61 6c 73 6f 3c 2f 62 3e 2c 20 62 65 20  ut also</b>, be 
0c30: 70 61 72 74 20 6f 66 20 73 6f 6d 65 20 61 64 6d  part of some adm
0c40: 69 6e 69 73 74 72 61 74 69 76 65 20 62 6f 75 6e  inistrative boun
0c50: 64 61 72 79 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  dary.</li>..<li>
0c60: 3c 62 3e 54 6f 70 6f 4c 61 79 65 72 73 3c 2f 62  <b>TopoLayers</b
0c70: 3e 20 61 6e 64 20 3c 62 3e 54 6f 70 6f 46 65 61  > and <b>TopoFea
0c80: 74 75 72 65 73 3c 2f 62 3e 20 72 65 70 72 65 73  tures</b> repres
0c90: 65 6e 74 20 61 20 63 6f 6d 70 6c 65 78 20 61 6e  ent a complex an
0ca0: 64 20 66 6c 65 78 69 62 6c 65 20 73 74 72 75 63  d flexible struc
0cb0: 74 75 72 65 20 69 6e 74 65 6e 64 65 64 20 74 6f  ture intended to
0cc0: 20 65 73 74 61 62 6c 69 73 68 20 61 20 70 65 72   establish a per
0cd0: 6d 61 6e 65 6e 74 20 72 65 6c 61 74 69 6f 6e 73  manent relations
0ce0: 68 69 70 20 62 65 74 77 65 65 6e 20 54 6f 70 6f  hip between Topo
0cf0: 6c 6f 67 79 20 20 50 72 69 6d 69 74 69 76 65 73  logy  Primitives
0d00: 20 61 6e 64 20 47 65 6f 54 61 62 6c 65 20 46 65   and GeoTable Fe
0d10: 61 74 75 72 65 73 2e 0d 0a 3c 75 6c 3e 0d 0a 3c  atures...<ul>..<
0d20: 6c 69 3e 65 61 63 68 20 3c 62 3e 54 6f 70 6f 4c  li>each <b>TopoL
0d30: 61 79 65 72 3c 2f 62 3e 20 69 73 20 75 6e 69 71  ayer</b> is uniq
0d40: 75 65 6c 79 20 69 64 65 6e 74 69 66 69 65 64 20  uely identified 
0d50: 62 79 20 69 74 73 20 3c 62 3e 6e 61 6d 65 3c 2f  by its <b>name</
0d60: 62 3e 20 61 6e 64 20 64 69 72 65 63 74 6c 79 20  b> and directly 
0d70: 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 61  corresponds to a
0d80: 20 73 69 6e 67 6c 65 20 47 65 6f 54 61 62 6c 65   single GeoTable
0d90: 20 74 6f 20 62 65 20 65 78 70 6f 72 74 65 64 20   to be exported 
0da0: 66 72 6f 6d 20 74 68 65 20 54 6f 70 6f 6c 6f 67  from the Topolog
0db0: 79 3c 62 72 3e 0d 0a 41 6e 20 61 72 62 69 74 72  y<br>..An arbitr
0dc0: 61 72 79 20 6e 75 6d 62 65 72 20 6f 66 20 54 6f  ary number of To
0dd0: 70 6f 4c 61 79 65 72 73 20 63 61 6e 20 62 65 20  poLayers can be 
0de0: 63 72 65 61 74 65 64 20 6f 6e 20 74 68 65 20 73  created on the s
0df0: 61 6d 65 20 54 6f 70 6f 6c 6f 67 79 2c 20 61 6e  ame Topology, an
0e00: 64 20 65 61 63 68 20 6f 6e 65 20 6f 66 20 74 68  d each one of th
0e10: 65 6d 20 77 69 6c 6c 20 61 63 74 20 61 73 20 61  em will act as a
0e20: 20 73 65 70 61 72 61 74 65 20 63 6f 6e 74 61 69   separate contai
0e30: 6e 65 72 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 65  ner.</li>..<li>e
0e40: 61 63 68 20 3c 62 3e 54 6f 70 6f 46 65 61 74 75  ach <b>TopoFeatu
0e50: 72 65 3c 2f 62 3e 20 69 73 20 75 6e 69 71 75 65  re</b> is unique
0e60: 6c 79 20 69 64 65 6e 74 69 66 69 65 64 20 62 79  ly identified by
0e70: 20 69 74 73 20 3c 62 3e 66 69 64 3c 2f 62 3e 20   its <b>fid</b> 
0e80: 28 3c 69 3e 66 65 61 74 75 72 65 2d 69 64 3c 2f  (<i>feature-id</
0e90: 69 3e 29 20 61 6e 64 20 63 6f 72 72 65 73 70 6f  i>) and correspo
0ea0: 6e 64 73 20 74 6f 20 61 20 73 69 6e 67 6c 65 20  nds to a single 
0eb0: 46 65 61 74 75 72 65 20 63 6f 6e 74 61 69 6e 69  Feature containi
0ec0: 6e 67 20 61 6e 20 69 6e 64 69 76 69 64 75 61 6c  ng an individual
0ed0: 20 73 65 74 20 6f 66 20 69 6e 66 6f 72 6d 61 74   set of informat
0ee0: 69 6f 6e 61 6c 20 61 74 74 72 69 62 75 74 65 73  ional attributes
0ef0: 2e 3c 62 72 3e 0d 0a 54 68 65 20 47 65 6f 6d 65  .<br>..The Geome
0f00: 74 72 79 20 66 6f 72 20 65 61 63 68 20 54 6f 70  try for each Top
0f10: 6f 46 65 61 74 75 72 65 20 69 73 20 61 6c 77 61  oFeature is alwa
0f20: 79 73 20 69 6e 64 69 72 65 63 74 6c 79 20 64 65  ys indirectly de
0f30: 66 69 6e 65 64 20 62 79 20 73 70 65 63 69 66 79  fined by specify
0f40: 69 6e 67 20 61 20 6c 69 73 74 20 6f 66 20 54 6f  ing a list of To
0f50: 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 76 65  pology primitive
0f60: 73 20 69 6e 64 69 76 69 64 75 61 6c 6c 79 20 72  s individually r
0f70: 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 68 65  eferenced by the
0f80: 69 72 20 49 44 73 2e 3c 62 72 3e 0d 0a 53 75 63  ir IDs.<br>..Suc
0f90: 68 20 61 20 67 65 6f 6d 65 74 72 79 20 69 73 20  h a geometry is 
0fa0: 63 6f 6e 73 69 64 65 72 65 64 20 74 6f 20 62 65  considered to be
0fb0: 20 3c 62 3e 3c 69 3e 76 69 72 74 75 61 6c 3c 2f   <b><i>virtual</
0fc0: 69 3e 3c 2f 62 3e 2c 20 6d 65 61 6e 69 6e 67 20  i></b>, meaning 
0fd0: 74 68 61 74 20 69 74 20 77 69 6c 6c 20 62 65 20  that it will be 
0fe0: 63 72 65 61 74 65 64 20 74 68 72 6f 75 67 68 20  created through 
0ff0: 74 68 65 20 3c 62 3e 63 6f 6c 6c 65 63 74 69 6f  the <b>collectio
1000: 6e 2f 61 67 67 72 65 67 61 74 69 6f 6e 3c 2f 62  n/aggregation</b
1010: 3e 20 6f 66 20 61 6c 6c 20 72 65 66 65 72 65 6e  > of all referen
1020: 63 65 64 20 54 6f 70 6f 6c 6f 67 79 20 70 72 69  ced Topology pri
1030: 6d 69 74 69 76 65 73 2c 20 77 68 65 6e 20 65 78  mitives, when ex
1040: 70 6f 72 74 65 64 20 74 6f 20 74 68 65 20 64 65  ported to the de
1050: 73 74 69 6e 61 74 69 6f 6e 20 47 65 6f 54 61 62  stination GeoTab
1060: 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c  le.</li>..</ul><
1070: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 65 20 54 6f  /li>..<li>The To
1080: 70 6f 4c 61 79 65 72 73 20 2f 20 54 6f 70 6f 46  poLayers / TopoF
1090: 65 61 74 75 72 65 73 20 73 74 72 75 63 74 75 72  eatures structur
10a0: 65 20 69 73 20 70 72 61 63 74 69 63 61 6c 6c 79  e is practically
10b0: 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20   implemented as 
10c0: 61 20 73 65 74 20 6f 66 20 73 65 76 65 72 61 6c  a set of several
10d0: 20 63 6c 6f 73 65 6c 79 20 72 65 6c 61 74 65 64   closely related
10e0: 20 44 42 2d 74 61 62 6c 65 73 20 20 28 74 68 65   DB-tables  (the
10f0: 20 72 65 73 70 65 63 74 69 76 65 20 6c 61 79 6f   respective layo
1100: 75 74 73 20 6f 66 20 77 68 69 63 68 20 77 65 27  uts of which we'
1110: 6c 6c 20 65 78 61 6d 69 6e 65 20 6c 61 74 65 72  ll examine later
1120: 20 69 6e 20 66 75 6c 6c 20 64 65 74 61 69 6c 29   in full detail)
1130: 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e  :..<ul>..<li><b>
1140: 3c 3c 69 3e 74 6f 70 6f 2d 70 72 65 66 69 78 3c  <<i>topo-prefix<
1150: 2f 69 3e 3e 5f 74 6f 70 6f 6c 61 79 65 72 73 3c  /i>>_topolayers<
1160: 2f 62 3e 3a 20 74 68 69 73 20 66 69 72 73 74 20  /b>: this first 
1170: 74 61 62 6c 65 20 73 69 6d 70 6c 79 20 69 73 20  table simply is 
1180: 61 20 63 61 74 61 6c 6f 67 20 6f 66 20 61 6c 6c  a catalog of all
1190: 20 54 6f 70 6f 4c 61 79 65 72 73 20 73 75 70 70   TopoLayers supp
11a0: 6f 72 74 69 6e 67 20 74 68 65 20 73 61 6d 65 20  orting the same 
11b0: 54 6f 70 6f 6c 6f 67 79 2e 3c 62 72 3e 0d 0a 45  Topology.<br>..E
11c0: 61 63 68 20 54 6f 70 6f 4c 61 79 65 72 20 69 73  ach TopoLayer is
11d0: 20 69 64 65 6e 74 69 66 69 65 64 20 62 79 20 69   identified by i
11e0: 74 73 20 3c 62 3e 6e 61 6d 65 3c 2f 62 3e 20 61  ts <b>name</b> a
11f0: 6e 64 20 62 79 20 69 74 73 20 3c 62 3e 49 44 3c  nd by its <b>ID<
1200: 2f 62 3e 3b 20 62 6f 74 68 20 6f 66 20 77 68 69  /b>; both of whi
1210: 63 68 20 6d 75 73 74 20 62 65 20 3c 69 3e 3c 75  ch must be <i><u
1220: 3e 75 6e 69 71 75 65 3c 2f 75 3e 3c 2f 69 3e 2e  >unique</u></i>.
1230: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 3c 3c  </li>..<li><b><<
1240: 69 3e 74 6f 70 6f 2d 70 72 65 66 69 78 3c 2f 69  i>topo-prefix</i
1250: 3e 3e 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 3c  >>_topofeatures<
1260: 2f 62 3e 3a 20 74 68 69 73 20 73 65 63 6f 6e 64  /b>: this second
1270: 20 74 61 62 6c 65 20 69 73 20 69 6e 74 65 6e 64   table is intend
1280: 65 64 20 74 6f 20 70 65 72 6d 61 6e 65 6e 74 6c  ed to permanentl
1290: 79 20 73 74 6f 72 65 20 61 6c 6c 20 63 72 6f 73  y store all cros
12a0: 73 2d 72 65 66 65 72 65 6e 63 65 73 20 65 78 69  s-references exi
12b0: 73 74 69 6e 67 20 62 65 74 77 65 65 6e 20 54 6f  sting between To
12c0: 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 76 65  pology primitive
12d0: 73 20 61 6e 64 20 54 6f 70 6f 46 65 61 74 75 72  s and TopoFeatur
12e0: 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62  es.</li>..<li><b
12f0: 3e 3c 3c 69 3e 74 6f 70 6f 2d 70 72 65 66 69 78  ><<i>topo-prefix
1300: 3c 2f 69 3e 3e 5f 74 6f 70 6f 66 65 61 74 75 72  </i>>_topofeatur
1310: 65 73 5f 3c 3c 69 3e 74 6f 70 6f 6c 61 79 65 72  es_<<i>topolayer
1320: 2d 69 64 3c 2f 69 3e 3e 3c 2f 62 3e 3a 20 66 6f  -id</i>></b>: fo
1330: 72 20 65 61 63 68 20 73 69 6e 67 6c 65 20 54 6f  r each single To
1340: 70 6f 4c 61 79 65 72 20 61 20 73 65 70 61 72 61  poLayer a separa
1350: 74 65 20 74 61 62 6c 65 20 69 73 20 72 65 71 75  te table is requ
1360: 69 72 65 64 2e 20 54 68 65 20 61 63 74 75 61 6c  ired. The actual
1370: 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 20 69 73   relationship is
1380: 20 65 73 74 61 62 6c 69 73 68 65 64 20 76 69 61   established via
1390: 20 74 68 65 20 3c 62 3e 54 6f 70 6f 4c 61 79 65   the <b>TopoLaye
13a0: 72 2d 49 44 3c 2f 62 3e 20 73 75 66 66 69 78 2e  r-ID</b> suffix.
13b0: 3c 62 72 3e 0d 0a 41 6c 6c 20 74 68 65 73 65 20  <br>..All these 
13c0: 74 61 62 6c 65 73 20 61 72 65 20 69 6e 74 65 6e  tables are inten
13d0: 64 65 64 20 74 6f 20 70 65 72 6d 61 6e 65 6e 74  ded to permanent
13e0: 6c 79 20 73 74 6f 72 65 20 74 68 65 20 69 6e 66  ly store the inf
13f0: 6f 72 6d 61 74 69 6f 6e 61 6c 20 61 74 74 72 69  ormational attri
1400: 62 75 74 65 73 20 66 6f 72 20 65 61 63 68 20 54  butes for each T
1410: 6f 70 6f 46 65 61 74 75 72 65 20 6f 6e 20 74 68  opoFeature on th
1420: 65 20 73 61 6d 65 20 54 6f 70 6f 4c 61 79 65 72  e same TopoLayer
1430: 2e 0d 0a 44 69 66 66 65 72 65 6e 74 20 54 6f 70  ...Different Top
1440: 6f 4c 61 79 65 72 73 20 77 69 6c 6c 20 6f 62 76  oLayers will obv
1450: 69 6f 75 73 6c 79 20 73 75 70 70 6f 72 74 20 61  iously support a
1460: 20 64 69 66 66 65 72 65 6e 74 20 73 65 74 20 6f   different set o
1470: 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 61 6c 20  f informational 
1480: 61 74 74 72 69 62 75 74 65 73 20 74 68 75 73 20  attributes thus 
1490: 72 65 71 75 69 72 69 6e 67 20 61 6e 20 69 6e 64  requiring an ind
14a0: 69 76 69 64 75 61 6c 20 74 61 62 6c 65 20 6c 61  ividual table la
14b0: 79 6f 75 74 2e 3c 62 72 3e 0d 0a 41 20 3c 62 3e  yout.<br>..A <b>
14c0: 50 72 69 6d 61 72 79 20 4b 65 79 3c 2f 62 3e 20  Primary Key</b> 
14d0: 6f 66 20 74 68 65 20 3c 62 3e 49 4e 54 45 47 45  of the <b>INTEGE
14e0: 52 3c 2f 62 3e 20 74 79 70 65 20 6e 61 6d 65 64  R</b> type named
14f0: 20 3c 62 3e 66 69 64 3c 2f 62 3e 20 69 73 20 61   <b>fid</b> is a
1500: 6c 77 61 79 73 20 65 78 70 65 63 74 65 64 20 74  lways expected t
1510: 6f 20 64 65 63 6c 61 72 65 64 20 61 6e 64 20 69  o declared and i
1520: 73 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 62 65  s intended to be
1530: 20 61 6e 20 75 6e 69 71 75 65 20 69 64 65 6e 74   an unique ident
1540: 69 66 69 65 72 20 66 6f 72 20 65 61 63 68 20 54  ifier for each T
1550: 6f 70 6f 46 65 61 74 75 72 65 2e 3c 2f 6c 69 3e  opoFeature.</li>
1560: 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c  ..</ul></li>..<l
1570: 69 3e 53 65 76 65 72 61 6c 20 53 51 4c 20 66 75  i>Several SQL fu
1580: 6e 63 74 69 6f 6e 73 20 61 72 65 20 73 70 65 63  nctions are spec
1590: 69 66 69 63 61 6c 6c 79 20 69 6e 74 65 6e 64 65  ifically intende
15a0: 64 20 74 6f 20 73 75 70 70 6f 72 74 20 70 72 6f  d to support pro
15b0: 63 65 73 73 69 6e 67 20 6f 70 65 72 61 74 69 6f  cessing operatio
15c0: 6e 73 20 62 61 73 65 64 20 6f 6e 20 54 6f 70 6f  ns based on Topo
15d0: 4c 61 79 65 72 73 20 61 6e 64 20 54 6f 70 6f 46  Layers and TopoF
15e0: 65 61 74 75 72 65 73 3b 20 20 77 65 27 6c 6c 20  eatures;  we'll 
15f0: 65 78 61 6d 69 6e 65 20 74 68 65 6d 20 6c 61 74  examine them lat
1600: 65 72 20 69 6e 20 66 75 6c 6c 20 64 65 74 61 69  er in full detai
1610: 6c 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62  l.</li>..</ul><b
1620: 72 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 61  r><br>..<hr>..<a
1630: 20 6e 61 6d 65 3d 22 65 78 65 72 63 69 73 65 22   name="exercise"
1640: 3e 0d 0a 3c 68 32 3e 61 20 71 75 69 63 6b 2c 20  >..<h2>a quick, 
1650: 70 72 61 63 74 69 63 61 6c 20 65 78 65 72 63 69  practical exerci
1660: 73 65 3c 2f 68 32 3e 3c 2f 61 3e 0d 0a 52 65 71  se</h2></a>..Req
1670: 75 69 72 65 6d 65 6e 74 73 3a 0d 0a 3c 6f 6c 3e  uirements:..<ol>
1680: 0d 0a 3c 6c 69 3e 64 6f 77 6e 6c 6f 61 64 20 74  ..<li>download t
1690: 68 65 20 73 61 6d 70 6c 65 20 44 42 2d 66 69 6c  he sample DB-fil
16a0: 65 20 66 72 6f 6d 20 3c 61 20 68 72 65 66 3d 22  e from <a href="
16b0: 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61  https://www.gaia
16c0: 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d 73 69 6e  -gis.it/gaia-sin
16d0: 73 2f 74 6f 70 6f 73 61 6d 70 6c 65 73 2f 74 75  s/toposamples/tu
16e0: 73 63 61 6e 79 2d 63 65 6e 73 75 73 2d 32 30 31  scany-census-201
16f0: 31 2e 37 7a 22 3e 68 65 72 65 3c 2f 61 3e 3c 62  1.7z">here</a><b
1700: 72 3e 0d 0a 49 74 20 63 6f 6e 74 61 69 6e 73 20  r>..It contains 
1710: 43 65 6e 73 75 73 20 64 61 74 61 20 28 32 30 31  Census data (201
1720: 31 29 20 6b 69 6e 64 6c 79 20 72 65 6c 65 61 73  1) kindly releas
1730: 65 64 20 62 79 20 49 53 54 41 54 20 75 6e 64 65  ed by ISTAT unde
1740: 72 20 3c 62 3e 43 43 2d 42 59 3c 2f 62 3e 20 6c  r <b>CC-BY</b> l
1750: 69 63 65 6e 73 65 20 74 65 72 6d 73 2e 3c 62 72  icense terms.<br
1760: 3e 0d 0a 54 68 65 20 6f 72 69 67 69 6e 61 6c 20  >..The original 
1770: 64 61 74 61 73 65 74 73 20 68 61 76 65 20 62 65  datasets have be
1780: 65 6e 20 73 6c 69 67 68 74 6c 79 20 72 65 61 72  en slightly rear
1790: 72 61 6e 67 65 64 20 69 6e 20 61 20 6d 6f 72 65  ranged in a more
17a0: 20 63 6f 6e 76 65 6e 69 65 6e 74 20 66 6f 72 6d   convenient form
17b0: 2e 0d 0a 41 6c 6c 20 67 65 6f 6d 65 74 72 69 65  ...All geometrie
17c0: 73 20 61 72 65 20 69 6e 20 74 68 65 20 3c 62 3e  s are in the <b>
17d0: 53 52 49 44 20 33 32 36 33 32 3c 2f 62 3e 20 28  SRID 32632</b> (
17e0: 3c 69 3e 57 47 53 20 38 34 20 2f 20 55 54 4d 20  <i>WGS 84 / UTM 
17f0: 7a 6f 6e 65 20 33 32 4e 3c 2f 69 3e 29 3a 0d 0a  zone 32N</i>):..
1800: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 65 6e  <ul>..<li><b>cen
1810: 73 75 73 5f 32 30 31 31 3c 2f 62 3e 3a 20 61 6c  sus_2011</b>: al
1820: 6c 20 43 65 6e 73 75 73 20 41 72 65 61 73 20 28  l Census Areas (
1830: 32 30 31 31 29 20 63 6f 76 65 72 69 6e 67 20 54  2011) covering T
1840: 75 73 63 61 6e 79 2e 3c 62 72 3e 0d 0a 3c 75 3e  uscany.<br>..<u>
1850: 4e 6f 74 65 3a 3c 2f 75 3e 20 73 65 76 65 72 61  Note:</u> severa
1860: 6c 20 43 65 6e 73 75 73 20 41 72 65 61 73 20 61  l Census Areas a
1870: 72 65 20 63 6f 6d 70 6c 65 74 65 6c 79 20 75 6e  re completely un
1880: 69 6e 68 61 62 69 74 65 64 20 28 6c 61 6b 65 73  inhabited (lakes
1890: 2c 20 6d 61 72 73 68 6c 61 6e 64 73 2c 20 68 69  , marshlands, hi
18a0: 67 68 20 6d 6f 75 6e 74 61 69 6e 73 20 61 6e 64  gh mountains and
18b0: 20 61 6c 69 6b 65 29 2e 3c 2f 6c 69 3e 0d 0a 3c   alike).</li>..<
18c0: 6c 69 3e 3c 62 3e 70 70 6c 5f 32 30 31 31 3c 2f  li><b>ppl_2011</
18d0: 62 3e 3a 20 50 6f 70 75 6c 61 74 65 64 20 50 6c  b>: Populated Pl
18e0: 61 63 65 73 20 28 64 65 66 69 6e 65 64 20 61 73  aces (defined as
18f0: 20 61 6e 20 61 67 67 72 65 67 61 74 69 6f 6e 20   an aggregation 
1900: 6f 66 20 43 65 6e 73 75 73 20 41 72 65 61 73 29  of Census Areas)
1910: 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f  .<br>..<u>Note</
1920: 75 3e 3a 20 6e 6f 74 20 61 6c 6c 20 43 65 6e 73  u>: not all Cens
1930: 75 73 20 41 72 65 61 73 20 62 65 6c 6f 6e 67 20  us Areas belong 
1940: 74 6f 20 61 20 50 6f 70 75 6c 61 74 65 64 20 50  to a Populated P
1950: 6c 61 63 65 3a 20 74 68 65 72 65 20 61 72 65 20  lace: there are 
1960: 6d 61 6e 79 20 73 65 6c 66 2d 73 74 61 6e 64 69  many self-standi
1970: 6e 67 20 64 69 73 70 65 72 73 65 64 20 72 75 72  ng dispersed rur
1980: 61 6c 20 61 72 65 61 73 2e 3c 2f 6c 69 3e 0d 0a  al areas.</li>..
1990: 3c 6c 69 3e 3c 62 3e 63 6f 6d 5f 32 30 31 31 3c  <li><b>com_2011<
19a0: 2f 62 3e 3a 20 54 75 73 63 61 6e 79 20 4d 75 6e  /b>: Tuscany Mun
19b0: 69 63 69 70 61 6c 69 74 69 65 73 20 2f 20 4c 6f  icipalities / Lo
19c0: 63 61 6c 20 43 6f 75 6e 63 69 6c 73 20 32 30 31  cal Councils 201
19d0: 31 20 28 64 65 66 69 6e 65 64 20 61 73 20 61 6e  1 (defined as an
19e0: 20 61 67 67 72 65 67 61 74 69 6f 6e 73 20 6f 66   aggregations of
19f0: 20 43 65 6e 73 75 73 20 41 72 65 61 73 29 2e 3c   Census Areas).<
1a00: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 6f 6d  /li>..<li><b>com
1a10: 5f 32 30 31 34 5f 31 35 3c 2f 62 3e 3a 20 66 65  _2014_15</b>: fe
1a20: 77 20 6e 65 77 20 4d 75 6e 69 63 69 70 61 6c 69  w new Municipali
1a30: 74 69 65 73 20 63 72 65 61 74 65 64 20 64 75 72  ties created dur
1a40: 69 6e 67 20 74 68 65 20 79 65 61 72 73 20 32 30  ing the years 20
1a50: 31 34 2f 31 35 2c 20 74 68 72 6f 75 67 68 20 74  14/15, through t
1a60: 68 65 20 6d 65 72 67 69 6e 67 20 6f 66 20 70 72  he merging of pr
1a70: 65 2d 65 78 69 73 74 69 6e 67 20 73 6d 61 6c 6c  e-existing small
1a80: 65 72 20 4d 75 6e 69 63 69 70 61 6c 69 74 69 65  er Municipalitie
1a90: 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e  s.</li>..<li><b>
1aa0: 70 72 6f 76 5f 32 30 31 31 3c 2f 62 3e 3a 20 54  prov_2011</b>: T
1ab0: 75 73 63 61 6e 79 20 50 72 6f 76 69 6e 63 65 73  uscany Provinces
1ac0: 20 2f 20 43 6f 75 6e 74 69 65 73 20 28 64 65 66   / Counties (def
1ad0: 69 6e 65 64 20 61 73 20 61 6e 20 61 67 67 72 65  ined as an aggre
1ae0: 67 61 74 69 6f 6e 20 6f 66 20 4d 75 6e 69 63 69  gation of Munici
1af0: 70 61 6c 69 74 69 65 73 29 2e 3c 2f 6c 69 3e 0d  palities).</li>.
1b00: 0a 3c 6c 69 3e 3c 62 3e 72 65 67 5f 32 30 31 31  .<li><b>reg_2011
1b10: 3c 2f 62 3e 3a 20 54 75 73 63 61 6e 79 20 52 65  </b>: Tuscany Re
1b20: 67 69 6f 6e 20 28 64 65 66 69 6e 65 64 20 61 73  gion (defined as
1b30: 20 61 6e 20 61 67 67 72 65 67 61 74 69 6f 6e 20   an aggregation 
1b40: 6f 66 20 50 72 6f 76 69 6e 63 65 73 29 2e 3c 2f  of Provinces).</
1b50: 6c 69 3e 0d 0a 3c 6c 69 3e 6f 6e 6c 79 20 74 68  li>..<li>only th
1b60: 65 20 74 61 62 6c 65 20 3c 62 3e 63 65 6e 73 75  e table <b>censu
1b70: 73 5f 32 30 31 31 3c 2f 62 3e 20 68 61 73 20 67  s_2011</b> has g
1b80: 65 6f 6d 65 74 72 69 65 73 3b 20 6f 74 68 65 72  eometries; other
1b90: 20 61 64 6d 69 6e 69 73 74 72 61 74 69 6f 6e 20   administration 
1ba0: 6c 65 76 65 6c 73 20 61 72 65 20 64 65 66 69 6e  levels are defin
1bb0: 65 64 20 62 79 20 72 65 6c 61 74 69 6f 6e 20 63  ed by relation c
1bc0: 6f 64 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  odes.</li>..<li>
1bd0: 3c 75 3e 41 74 74 65 6e 74 69 6f 6e 3c 2f 75 3e  <u>Attention</u>
1be0: 3a 20 64 75 72 69 6e 67 20 74 68 69 73 20 73 61  : during this sa
1bf0: 6d 70 6c 65 20 28 61 73 20 69 6e 20 6f 74 68 65  mple (as in othe
1c00: 72 73 29 2c 20 77 65 20 77 69 6c 6c 20 3c 62 3e  rs), we will <b>
1c10: 6e 65 76 65 72 3c 2f 62 3e 20 64 69 72 65 63 74  never</b> direct
1c20: 6c 79 20 6f 70 65 6e 20 74 68 69 73 20 64 61 74  ly open this dat
1c30: 61 62 61 73 65 2c 20 62 75 74 20 6f 6e 6c 79 20  abase, but only 
1c40: 61 74 74 61 63 68 20 69 74 20 74 6f 20 74 68 65  attach it to the
1c50: 20 64 61 74 61 62 61 73 65 20 77 65 20 61 72 65   database we are
1c60: 20 63 72 65 61 74 69 6e 67 2e 3c 2f 6c 69 3e 0d   creating.</li>.
1c70: 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  .</ul></li>..<li
1c80: 3e 75 6e 63 6f 6d 70 72 65 73 73 20 74 68 65 20  >uncompress the 
1c90: 64 6f 77 6e 6c 6f 61 64 65 64 20 64 62 2d 66 69  downloaded db-fi
1ca0: 6c 65 20 28 3c 62 3e 3c 69 3e 74 75 73 63 61 6e  le (<b><i>tuscan
1cb0: 79 2d 63 65 6e 73 75 73 2d 32 30 31 31 2e 73 71  y-census-2011.sq
1cc0: 6c 69 74 65 3c 2f 69 3e 3c 2f 62 3e 29 2e 3c 2f  lite</i></b>).</
1cd0: 6c 69 3e 0d 0a 3c 6c 69 3e 6e 6f 77 20 73 74 61  li>..<li>now sta
1ce0: 72 74 20 61 20 53 70 61 74 69 61 4c 69 74 65 20  rt a SpatiaLite 
1cf0: 73 65 73 73 69 6f 6e 20 75 73 69 6e 67 20 79 6f  session using yo
1d00: 75 72 20 70 72 65 66 65 72 72 65 64 20 53 70 61  ur preferred Spa
1d10: 74 69 61 4c 69 74 65 20 66 72 6f 6e 74 20 65 6e  tiaLite front en
1d20: 64 20 74 6f 6f 6c 3a 0d 0a 3c 75 6c 3e 0d 0a 3c  d tool:..<ul>..<
1d30: 6c 69 3e 43 6f 6e 6e 65 63 74 20 74 6f 20 61 20  li>Connect to a 
1d40: 6e 65 77 20 28 65 6d 70 74 79 29 20 44 42 2d 66  new (empty) DB-f
1d50: 69 6c 65 20 6e 61 6d 65 64 20 3c 62 3e 3c 69 3e  ile named <b><i>
1d60: 74 75 73 63 61 6e 79 2d 63 65 6e 73 75 73 2d 32  tuscany-census-2
1d70: 30 31 31 2e 73 71 6c 69 74 65 3c 2f 69 3e 3c 2f  011.sqlite</i></
1d80: 62 3e 2c 20 74 6f 20 77 68 69 63 68 20 3c 62 3e  b>, to which <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 20 77 69 6c  1.sqlite</b> wil
1db0: 6c 20 62 65 20 61 74 74 61 63 68 65 64 20 74 6f  l be attached to
1dc0: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c  .</li>..</ul></l
1dd0: 69 3e 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c 76 65 72 62  i>..</ol>..<verb
1de0: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 43 72  atim>..SELECT Cr
1df0: 65 61 74 65 54 6f 70 6f 6c 6f 67 79 28 27 63 65  eateTopology('ce
1e00: 6e 73 75 73 32 30 31 31 27 2c 20 33 32 36 33 32  nsus2011', 32632
1e10: 2c 20 30 2c 20 30 29 3b 0d 0a 31 0d 0a 0d 0a 41  , 0, 0);..1....A
1e20: 54 54 41 43 48 20 44 41 54 41 42 41 53 45 20 22  TTACH DATABASE "
1e30: 2e 2f 74 75 73 63 61 6e 79 2d 63 65 6e 73 75 73  ./tuscany-census
1e40: 2d 32 30 31 31 2e 73 71 6c 69 74 65 22 20 41 53  -2011.sqlite" AS
1e50: 20 69 73 74 61 74 3b 0d 0a 0d 0a 53 45 4c 45 43   istat;....SELEC
1e60: 54 20 54 6f 70 6f 47 65 6f 5f 46 72 6f 6d 47 65  T TopoGeo_FromGe
1e70: 6f 54 61 62 6c 65 28 27 63 65 6e 73 75 73 32 30  oTable('census20
1e80: 31 31 27 2c 20 27 69 73 74 61 74 27 2c 20 27 63  11', 'istat', 'c
1e90: 65 6e 73 75 73 5f 32 30 31 31 27 2c 20 4e 55 4c  ensus_2011', NUL
1ea0: 4c 2c 20 4e 55 4c 4c 2c 20 35 31 32 29 3b 0d 0a  L, NULL, 512);..
1eb0: 31 0d 0a 0d 0a 53 45 4c 45 43 54 20 53 54 5f 56  1....SELECT ST_V
1ec0: 61 6c 69 64 61 74 65 54 6f 70 6f 47 65 6f 28 27  alidateTopoGeo('
1ed0: 63 65 6e 73 75 73 32 30 31 31 27 29 3b 0d 0a 4e  census2011');..N
1ee0: 55 4c 4c 0d 0a 0d 0a 53 45 4c 45 43 54 20 2a 20  ULL....SELECT * 
1ef0: 46 52 4f 4d 20 54 45 4d 50 2e 63 65 6e 73 75 73  FROM TEMP.census
1f00: 32 30 31 31 5f 76 61 6c 69 64 61 74 65 5f 74 6f  2011_validate_to
1f10: 70 6f 67 65 6f 3b 0d 0a 0d 0a 53 45 4c 45 43 54  pogeo;....SELECT
1f20: 20 54 6f 70 6f 47 65 6f 5f 43 72 65 61 74 65 54   TopoGeo_CreateT
1f30: 6f 70 6f 4c 61 79 65 72 28 27 63 65 6e 73 75 73  opoLayer('census
1f40: 32 30 31 31 27 2c 20 27 69 73 74 61 74 27 2c 20  2011', 'istat', 
1f50: 27 63 65 6e 73 75 73 5f 32 30 31 31 27 2c 20 4e  'census_2011', N
1f60: 55 4c 4c 2c 20 27 63 65 6e 73 75 73 5f 61 72 65  ULL, 'census_are
1f70: 61 73 27 29 3b 0d 0a 31 0d 0a 0d 0a 53 45 4c 45  as');..1....SELE
1f80: 43 54 20 54 6f 70 6f 47 65 6f 5f 49 6e 69 74 54  CT TopoGeo_InitT
1f90: 6f 70 6f 4c 61 79 65 72 28 27 63 65 6e 73 75 73  opoLayer('census
1fa0: 32 30 31 31 27 2c 20 27 69 73 74 61 74 27 2c 20  2011', 'istat', 
1fb0: 27 70 6f 70 5f 70 70 6c 5f 32 30 31 31 27 2c 20  'pop_ppl_2011', 
1fc0: 27 70 70 6c 27 29 3b 0d 0a 31 0d 0a 0d 0a 53 45  'ppl');..1....SE
1fd0: 4c 45 43 54 20 54 6f 70 6f 47 65 6f 5f 49 6e 69  LECT TopoGeo_Ini
1fe0: 74 54 6f 70 6f 4c 61 79 65 72 28 27 63 65 6e 73  tTopoLayer('cens
1ff0: 75 73 32 30 31 31 27 2c 20 27 69 73 74 61 74 27  us2011', 'istat'
2000: 2c 20 27 70 6f 70 5f 63 6f 6d 5f 32 30 31 31 27  , 'pop_com_2011'
2010: 2c 20 27 63 6f 6d 27 29 3b 0d 0a 31 0d 0a 0d 0a  , 'com');..1....
2020: 53 45 4c 45 43 54 20 54 6f 70 6f 47 65 6f 5f 49  SELECT TopoGeo_I
2030: 6e 69 74 54 6f 70 6f 4c 61 79 65 72 28 27 63 65  nitTopoLayer('ce
2040: 6e 73 75 73 32 30 31 31 27 2c 20 27 69 73 74 61  nsus2011', 'ista
2050: 74 27 2c 20 27 70 6f 70 5f 70 72 6f 76 5f 32 30  t', 'pop_prov_20
2060: 31 31 27 2c 20 27 70 72 6f 76 27 29 3b 0d 0a 31  11', 'prov');..1
2070: 0d 0a 0d 0a 53 45 4c 45 43 54 20 54 6f 70 6f 47  ....SELECT TopoG
2080: 65 6f 5f 49 6e 69 74 54 6f 70 6f 4c 61 79 65 72  eo_InitTopoLayer
2090: 28 27 63 65 6e 73 75 73 32 30 31 31 27 2c 20 27  ('census2011', '
20a0: 69 73 74 61 74 27 2c 20 27 70 6f 70 5f 72 65 67  istat', 'pop_reg
20b0: 5f 32 30 31 31 27 2c 20 27 72 65 67 27 29 3b 0d  _2011', 'reg');.
20c0: 0a 31 0d 0a 0d 0a 44 45 54 41 43 48 20 44 41 54  .1....DETACH DAT
20d0: 41 42 41 53 45 20 69 73 74 61 74 3b 0d 0a 3c 2f  ABASE istat;..</
20e0: 76 65 72 62 61 74 69 6d 3e 0d 0a 57 65 27 6c 6c  verbatim>..We'll
20f0: 20 73 74 61 72 74 20 74 68 69 73 20 70 72 61 63   start this prac
2100: 74 69 63 61 6c 20 74 75 74 6f 72 69 61 6c 20 62  tical tutorial b
2110: 79 20 64 75 6c 79 20 72 65 70 6c 69 63 61 74 69  y duly replicati
2120: 6e 67 20 74 68 65 20 73 61 6d 65 20 73 74 65 70  ng the same step
2130: 73 20 77 65 27 76 65 20 61 6c 72 65 61 64 79 20  s we've already 
2140: 65 78 61 6d 69 6e 65 64 20 69 6e 20 74 68 65 20  examined in the 
2150: 70 72 65 76 69 6f 75 73 20 74 75 74 6f 72 69 61  previous tutoria
2160: 6c 20 69 6e 20 3c 62 3e 74 6f 70 6f 2d 69 6e 74  l in <b>topo-int
2170: 65 72 6d 65 64 69 61 74 65 3c 2f 62 3e 3a 0d 0a  ermediate</b>:..
2180: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 77 65 27 6c 6c 20  <ul>..<li>we'll 
2190: 63 72 65 61 74 65 20 61 20 6e 65 77 20 32 44 20  create a new 2D 
21a0: 54 6f 70 6f 6c 6f 67 79 20 6e 61 6d 65 64 20 3c  Topology named <
21b0: 62 3e 63 65 6e 73 75 73 32 30 31 31 3c 2f 62 3e  b>census2011</b>
21c0: 20 61 6e 64 20 6c 6f 63 61 74 65 64 20 69 6e 74   and located int
21d0: 6f 20 3c 62 3e 53 52 49 44 20 33 32 36 33 32 3c  o <b>SRID 32632<
21e0: 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74  /b>.</li>..<li>t
21f0: 68 65 6e 20 77 65 27 6c 6c 20 3c 69 3e 61 74 74  hen we'll <i>att
2200: 61 63 68 3c 2f 69 3e 20 74 68 65 20 3c 62 3e 74  ach</i> the <b>t
2210: 75 73 63 61 6e 79 2d 74 6f 70 6f 2d 32 30 31 31  uscany-topo-2011
2220: 2e 73 71 6c 69 74 65 3c 2f 62 3e 20 65 78 74 65  .sqlite</b> exte
2230: 72 6e 61 6c 20 44 42 2d 66 69 6c 65 2e 3c 2f 6c  rnal DB-file.</l
2240: 69 3e 0d 0a 3c 6c 69 3e 61 66 74 65 72 2d 77 68  i>..<li>after-wh
2250: 69 63 68 20 77 65 27 6c 6c 20 70 6f 70 75 6c 61  ich we'll popula
2260: 74 65 20 74 68 65 20 3c 62 3e 63 65 6e 73 75 73  te the <b>census
2270: 32 30 31 31 3c 2f 62 3e 20 54 6f 70 6f 6c 6f 67  2011</b> Topolog
2280: 79 20 62 79 20 69 6d 70 6f 72 74 69 6e 67 20 74  y by importing t
2290: 68 65 20 3c 62 3e 69 73 74 61 74 2e 63 65 6e 73  he <b>istat.cens
22a0: 75 73 5f 32 30 31 31 3c 2f 62 3e 20 47 65 6f 54  us_2011</b> GeoT
22b0: 61 62 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  able.</li>..<li>
22c0: 41 73 20 66 69 6e 61 6c 20 74 61 73 6b 20 77 65  As final task we
22d0: 27 6c 6c 20 63 68 65 63 6b 20 69 66 20 74 68 69  'll check if thi
22e0: 73 20 54 6f 70 6f 6c 6f 67 79 20 69 73 20 66 75  s Topology is fu
22f0: 6c 6c 79 20 76 61 6c 69 64 2e 3c 2f 6c 69 3e 0d  lly valid.</li>.
2300: 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 41 66 74 65  .</ul><br>..Afte
2310: 72 20 74 68 65 73 65 20 70 72 65 70 61 72 61 74  r these preparat
2320: 69 6f 6e 73 20 68 61 76 65 20 62 65 65 6e 20 63  ions have been c
2330: 6f 6d 70 6c 65 74 65 64 2c 20 77 65 20 61 72 65  ompleted, we are
2340: 20 72 65 61 64 79 20 74 6f 20 73 74 61 72 74 20   ready to start 
2350: 64 65 66 69 6e 69 6e 67 20 61 6c 6c 20 3c 62 3e  defining all <b>
2360: 54 6f 70 6f 4c 61 79 65 72 73 3c 2f 62 3e 20 62  TopoLayers</b> b
2370: 61 73 65 64 20 6f 6e 20 74 68 65 20 3c 62 3e 63  ased on the <b>c
2380: 65 6e 73 75 73 32 30 31 31 3c 2f 62 3e 20 54 6f  ensus2011</b> To
2390: 70 6f 6c 6f 67 79 3b 20 65 61 63 68 20 73 69 6e  pology; each sin
23a0: 67 6c 65 20 54 6f 70 6f 4c 61 79 65 72 20 77 69  gle TopoLayer wi
23b0: 6c 6c 20 70 72 65 63 69 73 65 6c 79 20 72 65 70  ll precisely rep
23c0: 72 65 73 65 6e 74 20 73 6f 6d 65 20 61 64 6d 69  resent some admi
23d0: 6e 69 73 74 72 61 74 69 76 65 20 6c 65 76 65 6c  nistrative level
23e0: 2c 20 61 6e 64 20 61 6c 6c 20 54 6f 70 6f 4c 61  , and all TopoLa
23f0: 79 65 72 73 20 61 6c 74 6f 67 65 74 68 65 72 20  yers altogether 
2400: 77 69 6c 6c 20 63 6f 6d 70 6c 65 74 65 6c 79 20  will completely 
2410: 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 77 68  represent the wh
2420: 6f 6c 65 20 54 75 73 63 61 6e 20 61 64 6d 69 6e  ole Tuscan admin
2430: 69 73 74 72 61 74 69 76 65 20 68 69 65 72 61 72  istrative hierar
2440: 63 68 79 2e 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e  chy...<ol>..<li>
2450: 46 69 72 73 74 20 69 6e 76 6f 6b 65 20 3c 62 3e  First invoke <b>
2460: 54 6f 70 6f 47 65 6f 5f 43 72 65 61 74 65 54 6f  TopoGeo_CreateTo
2470: 70 6f 4c 61 79 65 72 28 29 3c 2f 62 3e 20 69 6e  poLayer()</b> in
2480: 20 6f 72 64 65 72 20 74 6f 20 63 6f 6d 70 6c 65   order to comple
2490: 74 65 6c 79 20 64 65 66 69 6e 65 20 61 20 66 69  tely define a fi
24a0: 72 73 74 20 54 6f 70 6f 4c 61 79 65 72 20 72 65  rst TopoLayer re
24b0: 70 72 65 73 65 6e 74 69 6e 67 20 3c 62 3e 43 65  presenting <b>Ce
24c0: 6e 73 75 73 20 41 72 65 61 73 3c 2f 62 3e 2e 3c  nsus Areas</b>.<
24d0: 62 72 3e 0d 0a 3c 75 3e 52 65 63 61 6c 6c 3c 2f  br>..<u>Recall</
24e0: 75 3e 3a 20 74 68 65 20 3c 62 3e 69 73 74 61 74  u>: the <b>istat
24f0: 2e 63 65 6e 73 75 73 5f 32 30 31 31 3c 2f 62 3e  .census_2011</b>
2500: 20 69 73 20 61 6e 20 65 78 69 73 74 69 6e 67 20   is an existing 
2510: 27 3c 62 3e 47 65 6f 54 61 62 6c 65 3c 2f 62 3e  '<b>GeoTable</b>
2520: 27 2c 20 62 65 69 6e 67 20 75 73 65 64 20 61 73  ', being used as
2530: 20 6f 75 72 20 69 6e 69 74 69 61 6c 20 64 61 74   our initial dat
2540: 61 73 65 74 2c 20 73 69 6e 63 65 20 69 74 20 61  aset, since it a
2550: 6c 72 65 61 64 79 20 63 6f 6e 74 61 69 6e 73 20  lready contains 
2560: 62 6f 74 68 20 74 68 65 20 69 6e 66 6f 72 6d 61  both the informa
2570: 74 69 6f 6e 20 61 74 74 72 69 62 75 74 65 73 20  tion attributes 
2580: 61 6e 64 20 67 65 6f 6d 65 74 72 69 65 73 20 6e  and geometries n
2590: 65 65 64 65 64 2c 20 66 6f 72 20 77 68 69 63 68  eeded, for which
25a0: 20 3c 62 3e 65 61 63 68 3c 2f 62 3e 20 27 43 65   <b>each</b> 'Ce
25b0: 6e 73 75 73 20 41 72 65 61 27 20 69 73 20 65 78  nsus Area' is ex
25c0: 70 65 63 74 65 64 20 74 6f 20 63 6f 72 72 65 73  pected to corres
25d0: 70 6f 6e 64 20 74 6f 20 61 20 3c 62 3e 73 69 6e  pond to a <b>sin
25e0: 67 6c 65 3c 2f 62 3e 20 54 6f 70 6f 6c 6f 67 79  gle</b> Topology
25f0: 20 46 61 63 65 2e 20 28 6c 61 74 65 72 20 77 65   Face. (later we
2600: 27 6c 6c 20 65 78 61 6d 69 6e 65 20 69 6e 20 6d  'll examine in m
2610: 6f 72 65 20 64 65 70 74 68 2c 20 68 6f 77 20 74  ore depth, how t
2620: 68 65 20 54 6f 70 6f 4c 61 79 65 72 20 2f 20 54  he TopoLayer / T
2630: 6f 70 6f 46 65 61 74 75 72 65 20 72 65 6c 61 74  opoFeature relat
2640: 69 6f 6e 73 68 69 70 73 20 68 61 76 65 20 61 63  ionships have ac
2650: 74 75 61 6c 6c 79 20 62 65 65 6e 20 64 65 66 69  tually been defi
2660: 6e 65 64 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  ned).</li>..<li>
2670: 74 68 65 6e 20 77 65 27 6c 6c 20 63 6f 6e 74 69  then we'll conti
2680: 6e 75 65 20 62 79 20 64 65 66 69 6e 69 6e 67 20  nue by defining 
2690: 73 65 76 65 72 61 6c 20 66 75 72 74 68 65 72 20  several further 
26a0: 54 6f 70 6f 4c 61 79 65 72 73 20 63 6f 72 72 65  TopoLayers corre
26b0: 73 70 6f 6e 64 69 6e 67 20 74 6f 20 74 68 65 20  sponding to the 
26c0: 3c 62 3e 50 6f 70 75 6c 61 74 65 64 20 50 6c 61  <b>Populated Pla
26d0: 63 65 73 3c 2f 62 3e 2c 20 3c 62 3e 4d 75 6e 69  ces</b>, <b>Muni
26e0: 63 69 70 61 6c 69 74 69 65 73 3c 2f 62 3e 2c 20  cipalities</b>, 
26f0: 3c 62 3e 50 72 6f 76 69 6e 63 65 73 3c 2f 62 3e  <b>Provinces</b>
2700: 20 61 6e 64 20 3c 62 3e 52 65 67 69 6f 6e 3c 2f   and <b>Region</
2710: 62 3e 20 61 64 6d 69 6e 69 73 74 72 61 74 69 6f  b> administratio
2720: 6e 20 6c 65 76 65 6c 73 2e 3c 62 72 3e 0d 0a 3c  n levels.<br>..<
2730: 75 3e 52 65 63 61 6c 6c 3c 2f 75 3e 3a 20 61 6c  u>Recall</u>: al
2740: 6c 20 74 68 65 73 65 20 61 64 6d 69 6e 69 73 74  l these administ
2750: 72 61 74 69 6f 6e 20 6c 65 76 65 6c 73 20 69 6e  ration levels in
2760: 20 74 68 65 20 69 6e 69 74 69 61 6c 20 64 61 74   the initial dat
2770: 61 73 65 74 20 61 72 65 20 73 69 6d 70 6c 79 20  aset are simply 
2780: 64 65 66 69 6e 65 64 20 62 79 20 72 65 6c 61 74  defined by relat
2790: 69 6f 6e 20 63 6f 64 65 73 20 69 6e 74 65 6e 64  ion codes intend
27a0: 65 64 20 74 6f 20 63 6f 6c 6c 65 63 74 2f 61 67  ed to collect/ag
27b0: 67 72 65 67 61 74 65 20 74 68 65 20 6c 6f 77 65  gregate the lowe
27c0: 72 20 6c 65 76 65 6c 20 65 6e 74 69 74 69 65 73  r level entities
27d0: 20 77 68 65 72 65 2c 20 69 6e 20 74 68 69 73 20   where, in this 
27e0: 63 61 73 65 2c 20 68 61 76 65 20 6e 6f 20 67 65  case, have no ge
27f0: 6f 6d 65 74 72 69 65 73 20 61 74 20 61 6c 6c 2e  ometries at all.
2800: 20 42 65 69 6e 67 20 73 6f 2c 20 77 65 20 63 61   Being so, we ca
2810: 6e 6e 6f 74 20 63 72 65 61 74 65 20 61 20 66 75  nnot create a fu
2820: 6c 6c 79 20 64 65 66 69 6e 65 64 20 54 6f 70 6f  lly defined Topo
2830: 4c 61 79 65 72 20 62 79 20 63 61 6c 6c 69 6e 67  Layer by calling
2840: 20 3c 62 3e 54 6f 70 6f 47 65 6f 5f 43 72 65 61   <b>TopoGeo_Crea
2850: 74 65 54 6f 70 6f 6c 61 79 65 72 28 29 3c 2f 62  teTopolayer()</b
2860: 3e 2e 3c 62 72 3e 0d 0a 42 79 20 69 6e 76 6f 6b  >.<br>..By invok
2870: 69 6e 67 20 3c 62 3e 54 6f 70 6f 47 65 6f 5f 49  ing <b>TopoGeo_I
2880: 6e 69 74 54 6f 70 6f 4c 61 79 65 72 28 29 3c 2f  nitTopoLayer()</
2890: 62 3e 20 6f 6e 6c 79 20 61 20 70 61 72 74 69 61  b> only a partia
28a0: 6c 6c 79 20 64 65 66 69 6e 65 64 20 54 6f 70 6f  lly defined Topo
28b0: 4c 61 79 65 72 20 77 69 6c 6c 20 69 6e 69 74 69  Layer will initi
28c0: 61 6c 69 7a 65 64 2c 20 62 75 74 20 77 68 69 63  alized, but whic
28d0: 68 20 77 69 6c 6c 20 62 65 20 63 6f 6d 70 6c 65  h will be comple
28e0: 6d 65 6e 74 20 6c 61 74 65 72 20 61 6e 79 20 6d  ment later any m
28f0: 69 73 73 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69  issing informati
2900: 6f 6e 20 2d 20 74 68 75 73 20 61 63 68 69 65 76  on - thus achiev
2910: 69 6e 67 2c 20 77 69 74 68 20 61 20 73 65 63 6f  ing, with a seco
2920: 6e 64 20 73 74 65 70 20 2d 20 61 20 70 72 6f 70  nd step - a prop
2930: 65 72 6c 79 20 77 6f 72 6b 69 6e 67 20 54 6f 70  erly working Top
2940: 6f 4c 61 79 65 72 20 28 61 73 20 77 65 27 6c 6c  oLayer (as we'll
2950: 20 73 65 65 20 6c 61 74 65 72 20 69 6e 20 66 75   see later in fu
2960: 6c 6c 20 64 65 74 61 69 6c 29 2e 3c 2f 6c 69 3e  ll detail).</li>
2970: 0d 0a 3c 6c 69 3e 66 69 6e 61 6c 6c 79 20 77 65  ..<li>finally we
2980: 27 6c 6c 20 64 65 74 61 63 68 20 74 68 65 20 6e  'll detach the n
2990: 6f 20 6c 6f 6e 67 65 72 20 6e 65 65 64 65 64 20  o longer needed 
29a0: 65 78 74 65 72 6e 61 6c 20 64 62 2d 66 69 6c 65  external db-file
29b0: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c  .</li>..</ol>..<
29c0: 68 72 3e 0d 0a 3c 61 20 6e 61 6d 65 3d 22 6c 61  hr>..<a name="la
29d0: 79 6f 75 74 22 3e 0d 0a 3c 68 33 3e 54 6f 70 6f  yout">..<h3>Topo
29e0: 4c 61 79 65 72 73 20 2f 20 54 6f 70 6f 46 65 61  Layers / TopoFea
29f0: 74 75 72 65 73 3a 20 6c 61 79 6f 75 74 20 6f 66  tures: layout of
2a00: 20 44 42 20 54 61 62 6c 65 73 20 61 6e 64 20 63   DB Tables and c
2a10: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 72 65 6c  orresponding rel
2a20: 61 74 69 6f 6e 73 68 69 70 73 3c 2f 68 33 3e 3c  ationships</h3><
2a30: 2f 61 3e 0d 0a 3c 74 61 62 6c 65 20 63 65 6c 6c  /a>..<table cell
2a40: 70 61 64 64 69 6e 67 3d 22 36 22 20 63 65 6c 6c  padding="6" cell
2a50: 73 70 61 63 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74  spacing="8">..<t
2a60: 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 3c 3c 69 3e 74  r><td>..<b><<i>t
2a70: 6f 70 6f 2d 70 72 65 66 69 78 3c 2f 69 3e 3e 5f  opo-prefix</i>>_
2a80: 74 6f 70 6f 6c 61 79 65 72 73 3c 2f 62 3e 0d 0a  topolayers</b>..
2a90: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45  <verbatim>..SELE
2aa0: 43 54 20 2a 20 46 52 4f 4d 20 63 65 6e 73 75 73  CT * FROM census
2ab0: 32 30 31 31 5f 74 6f 70 6f 6c 61 79 65 72 73 3b  2011_topolayers;
2ac0: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 54  ..</verbatim>..T
2ad0: 68 65 20 3c 62 3e 54 6f 70 6f 4c 61 79 65 72 73  he <b>TopoLayers
2ae0: 3c 2f 62 3e 20 74 61 62 6c 65 20 63 6f 6e 74 61  </b> table conta
2af0: 69 6e 73 20 61 20 64 69 73 74 69 6e 63 74 20 72  ins a distinct r
2b00: 6f 77 20 66 6f 72 20 65 76 65 72 79 20 54 6f 70  ow for every Top
2b10: 6f 4c 61 79 65 72 20 64 65 66 69 6e 65 64 20 6f  oLayer defined o
2b20: 6e 20 74 68 65 20 63 75 72 72 65 6e 74 20 54 6f  n the current To
2b30: 70 6f 6c 6f 67 79 2e 3c 62 72 3e 3c 62 72 3e 0d  pology.<br><br>.
2b40: 0a 45 61 63 68 20 54 6f 70 6f 4c 61 79 65 72 20  .Each TopoLayer 
2b50: 69 73 20 69 64 65 6e 74 69 66 69 65 64 20 62 79  is identified by
2b60: 20 61 6e 20 3c 62 3e 69 64 3c 2f 62 3e 20 61 6e   an <b>id</b> an
2b70: 64 20 62 79 20 61 20 3c 62 3e 6e 61 6d 65 3c 2f  d by a <b>name</
2b80: 62 3e 3b 20 62 6f 74 68 20 61 72 65 20 72 65 71  b>; both are req
2b90: 75 69 72 65 64 20 74 6f 20 62 65 20 75 6e 69 71  uired to be uniq
2ba0: 75 65 20 76 61 6c 75 65 73 2e 0d 0a 3c 2f 74 64  ue values...</td
2bb0: 3e 3c 74 64 3e 0d 0a 22 3c 69 3e 63 65 6e 73 75  ><td>.."<i>censu
2bc0: 73 32 30 31 31 5f 74 6f 70 6f 6c 61 79 65 72 73  s2011_topolayers
2bd0: 3c 2f 69 3e 22 0d 0a 3c 74 61 62 6c 65 20 63 65  </i>"..<table ce
2be0: 6c 6c 73 70 61 6e 3d 22 34 22 20 63 65 6c 6c 70  llspan="4" cellp
2bf0: 61 64 64 69 6e 67 3d 22 36 22 20 62 67 63 6f 6c  adding="6" bgcol
2c00: 6f 72 3d 22 23 66 38 66 38 66 30 22 20 62 6f 72  or="#f8f8f0" bor
2c10: 64 65 72 3d 22 31 22 3e 0d 0a 3c 74 72 3e 3c 74  der="1">..<tr><t
2c20: 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30  d bgcolor="#f0f0
2c30: 66 38 22 3e 3c 62 3e 74 6f 70 6f 6c 61 79 65 72  f8"><b>topolayer
2c40: 5f 69 64 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74  _id</b></td>..<t
2c50: 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30  d bgcolor="#f0f0
2c60: 66 38 22 3e 3c 62 3e 74 6f 70 6f 6c 61 79 65 72  f8"><b>topolayer
2c70: 5f 6e 61 6d 65 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f  _name</b></td></
2c80: 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69  tr>..<tr><td ali
2c90: 67 6e 3d 22 72 69 67 68 74 22 3e 31 3c 2f 74 64  gn="right">1</td
2ca0: 3e 3c 74 64 3e 63 65 6e 73 75 73 5f 61 72 65 61  ><td>census_area
2cb0: 73 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72  s</td></tr>..<tr
2cc0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68  ><td align="righ
2cd0: 74 22 3e 32 3c 2f 74 64 3e 3c 74 64 3e 70 70 6c  t">2</td><td>ppl
2ce0: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e  </td></tr>..<tr>
2cf0: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  <td align="right
2d00: 22 3e 33 3c 2f 74 64 3e 3c 74 64 3e 63 6f 6d 3c  ">3</td><td>com<
2d10: 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c  /td></tr>..<tr><
2d20: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22  td align="right"
2d30: 3e 34 3c 2f 74 64 3e 3c 74 64 3e 70 72 6f 76 3c  >4</td><td>prov<
2d40: 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c  /td></tr>..<tr><
2d50: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22  td align="right"
2d60: 3e 35 3c 2f 74 64 3e 3c 74 64 3e 72 65 67 3c 2f  >5</td><td>reg</
2d70: 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c  td></tr>..</tabl
2d80: 65 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a  e>..</td></tr>..
2d90: 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 3c 3c 69  <tr><td>..<b><<i
2da0: 3e 74 6f 70 6f 2d 70 72 65 66 69 78 3c 2f 69 3e  >topo-prefix</i>
2db0: 3e 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 3c  >_topofeatures_<
2dc0: 3c 69 3e 74 6f 70 6f 6c 61 79 65 72 2d 69 64 3c  <i>topolayer-id<
2dd0: 2f 69 3e 3e 3c 2f 62 3e 0d 0a 3c 76 65 72 62 61  /i>></b>..<verba
2de0: 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 2a 20 46  tim>..SELECT * F
2df0: 52 4f 4d 20 63 65 6e 73 75 73 32 30 31 31 5f 74  ROM census2011_t
2e00: 6f 70 6f 66 65 61 74 75 72 65 73 5f 32 3b 0d 0a  opofeatures_2;..
2e10: 0d 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20  ..SELECT * FROM 
2e20: 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66  census2011_topof
2e30: 65 61 74 75 72 65 73 5f 34 3b 0d 0a 3c 2f 76 65  eatures_4;..</ve
2e40: 72 62 61 74 69 6d 3e 0d 0a 54 68 65 20 73 61 6d  rbatim>..The sam
2e50: 65 20 54 6f 70 6f 6c 6f 67 79 20 63 61 6e 20 63  e Topology can c
2e60: 6f 6e 74 61 69 6e 20 6d 6f 72 65 20 74 68 61 6e  ontain more than
2e70: 20 61 20 73 69 6e 67 6c 65 20 3c 62 3e 54 6f 70   a single <b>Top
2e80: 6f 46 65 61 74 75 72 65 73 3c 2f 62 3e 20 74 61  oFeatures</b> ta
2e90: 62 6c 65 2c 20 61 6e 64 20 65 61 63 68 20 54 6f  ble, and each To
2ea0: 70 6f 46 65 61 74 75 72 65 73 20 74 61 62 6c 65  poFeatures table
2eb0: 20 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f 20   corresponds to 
2ec0: 61 20 73 69 6e 67 6c 65 20 54 6f 70 6f 4c 61 79  a single TopoLay
2ed0: 65 72 2e 3c 62 72 3e 0d 0a 45 76 65 72 79 20 74  er.<br>..Every t
2ee0: 61 62 6c 65 20 63 61 6e 20 68 61 76 65 20 61 20  able can have a 
2ef0: 73 70 65 63 69 66 69 63 20 6c 61 79 6f 75 74 20  specific layout 
2f00: 6f 6e 20 69 74 73 20 6f 77 6e 20 28 73 74 72 69  on its own (stri
2f10: 63 74 6c 79 20 72 65 66 6c 65 63 74 69 6e 67 20  ctly reflecting 
2f20: 74 68 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20  the information 
2f30: 61 74 74 72 69 62 75 74 65 73 20 66 6f 72 20 65  attributes for e
2f40: 61 63 68 20 6c 61 79 65 72 29 2c 20 61 6e 79 77  ach layer), anyw
2f50: 61 79 20 61 6c 6c 20 74 68 65 6d 20 77 69 6c 6c  ay all them will
2f60: 20 68 61 76 65 20 61 20 3c 62 3e 75 6e 69 71 75   have a <b>uniqu
2f70: 65 20 54 6f 70 6f 46 65 61 74 75 72 65 20 69 64  e TopoFeature id
2f80: 65 6e 74 69 66 69 65 72 3c 2f 62 3e 20 28 3c 62  entifier</b> (<b
2f90: 3e 3c 69 3e 66 69 64 3c 2f 69 3e 3c 2f 62 3e 29  ><i>fid</i></b>)
2fa0: 20 61 63 74 69 6e 67 20 69 6e 20 74 68 65 20 50   acting in the P
2fb0: 72 69 6d 61 72 79 20 4b 65 79 20 72 6f 6c 65 2e  rimary Key role.
2fc0: 3c 62 72 3e 0d 0a 54 68 65 20 72 65 6c 61 74 69  <br>..The relati
2fd0: 6f 6e 73 68 69 70 20 62 65 74 77 65 65 6e 20 74  onship between t
2fe0: 61 62 6c 65 20 6e 61 6d 65 73 20 61 6e 64 20 54  able names and T
2ff0: 6f 70 6f 4c 61 79 65 72 73 20 69 73 20 65 73 74  opoLayers is est
3000: 61 62 6c 69 73 68 65 64 20 62 79 20 61 70 70 65  ablished by appe
3010: 6e 64 69 6e 67 20 61 20 6e 75 6d 65 72 69 63 20  nding a numeric 
3020: 73 75 66 66 69 78 20 74 6f 20 74 68 65 20 63 6f  suffix to the co
3030: 6d 6d 6f 6e 20 6e 61 6d 65 20 74 68 61 74 20 6d  mmon name that m
3040: 75 73 74 20 65 78 61 63 74 6c 79 20 6d 61 74 63  ust exactly matc
3050: 68 20 74 68 65 20 3c 62 3e 74 6f 70 6f 6c 61 79  h the <b>topolay
3060: 65 72 5f 69 64 3c 2f 62 3e 20 76 61 6c 75 65 20  er_id</b> value 
3070: 64 65 63 6c 61 72 65 64 20 69 6e 20 74 68 65 20  declared in the 
3080: 3c 62 3e 54 6f 70 6f 4c 61 79 65 72 73 3c 2f 62  <b>TopoLayers</b
3090: 3e 20 6d 61 69 6e 20 74 61 62 6c 65 2e 3c 62 72  > main table.<br
30a0: 3e 3c 62 72 3e 0d 0a 41 73 20 69 73 20 73 68 6f  ><br>..As is sho
30b0: 77 6e 20 69 6e 20 74 68 69 73 20 65 78 61 6d 70  wn in this examp
30c0: 6c 65 20 74 68 65 20 66 69 72 73 74 20 74 61 62  le the first tab
30d0: 6c 65 20 3c 62 3e 63 65 6e 73 75 73 32 30 31 31  le <b>census2011
30e0: 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 32 3c  _topofeatures_2<
30f0: 2f 62 3e 20 28 3c 69 3e 74 6f 70 6f 6c 61 79 65  /b> (<i>topolaye
3100: 72 5f 69 64 3c 2f 69 3e 3d 3c 69 3e 32 3c 2f 69  r_id</i>=<i>2</i
3110: 3e 29 20 63 6f 6e 74 61 69 6e 73 20 61 6c 6c 20  >) contains all 
3120: 54 6f 70 6f 46 65 61 74 75 72 65 73 20 61 73 73  TopoFeatures ass
3130: 6f 63 69 61 74 65 64 20 74 6f 20 74 68 65 20 54  ociated to the T
3140: 6f 70 6f 4c 61 79 65 72 20 3c 62 3e 70 70 6c 3c  opoLayer <b>ppl<
3150: 2f 62 3e 20 28 3c 69 3e 50 6f 70 75 6c 61 74 65  /b> (<i>Populate
3160: 64 20 50 6c 61 63 65 73 3c 2f 69 3e 29 2e 3c 62  d Places</i>).<b
3170: 72 3e 3c 62 72 3e 0d 0a 54 68 65 20 73 65 63 6f  r><br>..The seco
3180: 6e 64 20 74 61 62 6c 65 20 3c 62 3e 63 65 6e 73  nd table <b>cens
3190: 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75  us2011_topofeatu
31a0: 72 65 73 5f 34 3c 2f 62 3e 20 28 3c 69 3e 74 6f  res_4</b> (<i>to
31b0: 70 6f 6c 61 79 65 72 5f 69 64 3c 2f 69 3e 3d 3c  polayer_id</i>=<
31c0: 69 3e 34 3c 2f 69 3e 29 20 63 6f 6e 74 61 69 6e  i>4</i>) contain
31d0: 73 20 61 6c 6c 20 54 6f 70 6f 46 65 61 74 75 72  s all TopoFeatur
31e0: 65 73 20 61 73 73 6f 63 69 61 74 65 64 20 74 6f  es associated to
31f0: 20 74 68 65 20 54 6f 70 6f 4c 61 79 65 72 20 3c   the TopoLayer <
3200: 62 3e 70 72 6f 76 3c 2f 62 3e 20 28 3c 69 3e 50  b>prov</b> (<i>P
3210: 72 6f 76 69 6e 63 65 73 3c 2f 69 3e 29 2e 0d 0a  rovinces</i>)...
3220: 3c 2f 74 64 3e 3c 74 64 3e 0d 0a 22 3c 69 3e 63  </td><td>.."<i>c
3230: 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65  ensus2011_topofe
3240: 61 74 75 72 65 73 5f 32 3c 2f 69 3e 22 0d 0a 3c  atures_2</i>"..<
3250: 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 6e 3d 22  table cellspan="
3260: 34 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22  4" cellpadding="
3270: 36 22 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66  6" bgcolor="#f8f
3280: 38 66 30 22 20 62 6f 72 64 65 72 3d 22 31 22 3e  8f0" border="1">
3290: 0d 0a 3c 74 72 3e 3c 74 64 20 62 67 63 6f 6c 6f  ..<tr><td bgcolo
32a0: 72 3d 22 23 66 30 66 30 66 38 22 3e 3c 62 3e 66  r="#f0f0f8"><b>f
32b0: 69 64 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64  id</b></td>..<td
32c0: 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66   bgcolor="#f0f0f
32d0: 38 22 3e 3c 62 3e 63 6f 64 5f 70 70 6c 3c 2f 62  8"><b>cod_ppl</b
32e0: 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 62 67 63 6f  ></td>..<td bgco
32f0: 6c 6f 72 3d 22 23 66 30 66 30 66 38 22 3e 3c 62  lor="#f0f0f8"><b
3300: 3e 63 6f 64 5f 63 6f 6d 3c 2f 62 3e 3c 2f 74 64  >cod_com</b></td
3310: 3e 0d 0a 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22  >..<td bgcolor="
3320: 23 66 30 66 30 66 38 22 3e 3c 62 3e 6e 61 6d 65  #f0f0f8"><b>name
3330: 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 62  </b></td>..<td b
3340: 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 22  gcolor="#f0f0f8"
3350: 3e 3c 62 3e 70 6f 70 5f 32 30 31 31 3c 2f 62 3e  ><b>pop_2011</b>
3360: 3c 2f 74 64 3e 0d 0a 3c 74 64 20 62 67 63 6f 6c  </td>..<td bgcol
3370: 6f 72 3d 22 23 66 30 66 30 66 38 22 3e 3c 62 3e  or="#f0f0f8"><b>
3380: 6d 5f 32 30 31 31 3c 2f 62 3e 3c 2f 74 64 3e 0d  m_2011</b></td>.
3390: 0a 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66  .<td bgcolor="#f
33a0: 30 66 30 66 38 22 3e 3c 62 3e 66 5f 32 30 31 31  0f0f8"><b>f_2011
33b0: 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a  </b></td></tr>..
33c0: 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72  <tr><td align="r
33d0: 69 67 68 74 22 3e 31 3c 2f 74 64 3e 3c 74 64 20  ight">1</td><td 
33e0: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 30  align="right">20
33f0: 35 31 34 32 37 30 35 3c 2f 74 64 3e 3c 74 64 20  5142705</td><td 
3400: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 34 35  align="right">45
3410: 30 30 31 3c 2f 74 64 3e 3c 74 64 3e 41 6c 62 69  001</td><td>Albi
3420: 61 6e 6f 20 4d 61 67 72 61 3c 2f 74 64 3e 3c 74  ano Magra</td><t
3430: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
3440: 31 39 30 37 3c 2f 74 64 3e 3c 74 64 20 61 6c 69  1907</td><td ali
3450: 67 6e 3d 22 72 69 67 68 74 22 3e 39 31 39 3c 2f  gn="right">919</
3460: 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69  td><td align="ri
3470: 67 68 74 22 3e 39 38 38 3c 2f 74 64 3e 3c 2f 74  ght">988</td></t
3480: 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 67  r>..<tr><td alig
3490: 6e 3d 22 72 69 67 68 74 22 3e 32 3c 2f 74 64 3e  n="right">2</td>
34a0: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  <td align="right
34b0: 22 3e 32 30 35 31 34 32 37 30 36 3c 2f 74 64 3e  ">205142706</td>
34c0: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  <td align="right
34d0: 22 3e 34 35 30 30 31 3c 2f 74 64 3e 3c 74 64 3e  ">45001</td><td>
34e0: 41 75 6c 6c 61 3c 2f 74 64 3e 3c 74 64 20 61 6c  Aulla</td><td al
34f0: 69 67 6e 3d 22 72 69 67 68 74 22 3e 34 33 32 31  ign="right">4321
3500: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
3510: 72 69 67 68 74 22 3e 32 30 34 36 3c 2f 74 64 3e  right">2046</td>
3520: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  <td align="right
3530: 22 3e 32 32 37 35 3c 2f 74 64 3e 3c 2f 74 72 3e  ">2275</td></tr>
3540: 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d  ..<tr><td align=
3550: 22 72 69 67 68 74 22 3e 33 3c 2f 74 64 3e 3c 74  "right">3</td><t
3560: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
3570: 32 30 35 31 34 32 37 31 30 3c 2f 74 64 3e 3c 74  205142710</td><t
3580: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
3590: 34 35 30 30 31 3c 2f 74 64 3e 3c 74 64 3e 43 61  45001</td><td>Ca
35a0: 70 72 69 67 6c 69 6f 6c 61 3c 2f 74 64 3e 3c 74  prigliola</td><t
35b0: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
35c0: 34 38 32 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67  482</td><td alig
35d0: 6e 3d 22 72 69 67 68 74 22 3e 32 32 36 3c 2f 74  n="right">226</t
35e0: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67  d><td align="rig
35f0: 68 74 22 3e 32 35 36 3c 2f 74 64 3e 3c 2f 74 72  ht">256</td></tr
3600: 3e 0d 0a 3c 74 72 3e 3c 74 64 20 63 6f 6c 73 70  >..<tr><td colsp
3610: 61 6e 3d 22 37 22 20 61 6c 69 67 6e 3d 22 63 65  an="7" align="ce
3620: 6e 74 65 72 22 3e 3c 68 72 3e 3c 2f 74 64 3e 3c  nter"><hr></td><
3630: 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c  /tr>..<tr><td al
3640: 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 30 31 38  ign="right">1018
3650: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
3660: 72 69 67 68 74 22 3e 31 34 31 30 37 37 35 34 31  right">141077541
3670: 35 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d  5</td><td align=
3680: 22 72 69 67 68 74 22 3e 31 30 30 30 30 37 3c 2f  "right">100007</
3690: 74 64 3e 3c 74 64 3e 53 61 73 73 65 74 61 3c 2f  td><td>Sasseta</
36a0: 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69  td><td align="ri
36b0: 67 68 74 22 3e 32 38 35 3c 2f 74 64 3e 3c 74 64  ght">285</td><td
36c0: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31   align="right">1
36d0: 33 37 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e  37</td><td align
36e0: 3d 22 72 69 67 68 74 22 3e 31 34 38 3c 2f 74 64  ="right">148</td
36f0: 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20  ></tr>..<tr><td 
3700: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 30  align="right">10
3710: 31 39 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e  19</td><td align
3720: 3d 22 72 69 67 68 74 22 3e 31 34 31 30 37 38 35  ="right">1410785
3730: 34 31 35 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67  415</td><td alig
3740: 6e 3d 22 72 69 67 68 74 22 3e 31 30 30 30 30 37  n="right">100007
3750: 3c 2f 74 64 3e 3c 74 64 3e 54 65 72 72 69 67 6f  </td><td>Terrigo
3760: 6c 69 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e  li</td><td align
3770: 3d 22 72 69 67 68 74 22 3e 35 33 37 3c 2f 74 64  ="right">537</td
3780: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68  ><td align="righ
3790: 74 22 3e 32 36 34 3c 2f 74 64 3e 3c 74 64 20 61  t">264</td><td a
37a0: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 37 33  lign="right">273
37b0: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61  </td></tr>..</ta
37c0: 62 6c 65 3e 0d 0a 3c 62 72 3e 0d 0a 22 3c 69 3e  ble>..<br>.."<i>
37d0: 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66  census2011_topof
37e0: 65 61 74 75 72 65 73 5f 34 3c 2f 69 3e 22 0d 0a  eatures_4</i>"..
37f0: 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 6e 3d  <table cellspan=
3800: 22 34 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d  "4" cellpadding=
3810: 22 36 22 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38  "6" bgcolor="#f8
3820: 66 38 66 30 22 20 62 6f 72 64 65 72 3d 22 31 22  f8f0" border="1"
3830: 3e 0d 0a 3c 74 72 3e 3c 74 64 20 62 67 63 6f 6c  >..<tr><td bgcol
3840: 6f 72 3d 22 23 66 30 66 30 66 38 22 3e 3c 62 3e  or="#f0f0f8"><b>
3850: 66 69 64 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74  fid</b></td>..<t
3860: 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30  d bgcolor="#f0f0
3870: 66 38 22 3e 3c 62 3e 63 6f 64 5f 70 72 6f 76 3c  f8"><b>cod_prov<
3880: 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 62 67  /b></td>..<td bg
3890: 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 22 3e  color="#f0f0f8">
38a0: 3c 62 3e 63 6f 64 5f 72 65 67 3c 2f 62 3e 3c 2f  <b>cod_reg</b></
38b0: 74 64 3e 0d 0a 3c 74 64 20 62 67 63 6f 6c 6f 72  td>..<td bgcolor
38c0: 3d 22 23 66 30 66 30 66 38 22 3e 3c 62 3e 6e 61  ="#f0f0f8"><b>na
38d0: 6d 65 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64  me</b></td>..<td
38e0: 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66   bgcolor="#f0f0f
38f0: 38 22 3e 3c 62 3e 61 62 62 72 65 76 3c 2f 62 3e  8"><b>abbrev</b>
3900: 3c 2f 74 64 3e 0d 0a 3c 74 64 20 62 67 63 6f 6c  </td>..<td bgcol
3910: 6f 72 3d 22 23 66 30 66 30 66 38 22 3e 3c 62 3e  or="#f0f0f8"><b>
3920: 70 6f 70 5f 32 30 31 31 3c 2f 62 3e 3c 2f 74 64  pop_2011</b></td
3930: 3e 0d 0a 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22  >..<td bgcolor="
3940: 23 66 30 66 30 66 38 22 3e 3c 62 3e 6d 5f 32 30  #f0f0f8"><b>m_20
3950: 31 31 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64  11</b></td>..<td
3960: 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66   bgcolor="#f0f0f
3970: 38 22 3e 3c 62 3e 66 5f 32 30 31 31 3c 2f 62 3e  8"><b>f_2011</b>
3980: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e  </td></tr>..<tr>
3990: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  <td align="right
39a0: 22 3e 31 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67  ">1</td><td alig
39b0: 6e 3d 22 72 69 67 68 74 22 3e 34 35 3c 2f 74 64  n="right">45</td
39c0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68  ><td align="righ
39d0: 74 22 3e 39 3c 2f 74 64 3e 3c 74 64 3e 4d 61 73  t">9</td><td>Mas
39e0: 73 61 26 6e 62 73 70 3b 43 61 72 72 61 72 61 3c  sa&nbsp;Carrara<
39f0: 2f 74 64 3e 3c 74 64 3e 4d 53 3c 2f 74 64 3e 3c  /td><td>MS</td><
3a00: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22  td align="right"
3a10: 3e 31 39 39 36 35 30 3c 2f 74 64 3e 3c 74 64 20  >199650</td><td 
3a20: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 39 35  align="right">95
3a30: 37 35 34 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67  754</td><td alig
3a40: 6e 3d 22 72 69 67 68 74 22 3e 31 30 33 38 39 36  n="right">103896
3a50: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e  </td></tr>..<tr>
3a60: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  <td align="right
3a70: 22 3e 32 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67  ">2</td><td alig
3a80: 6e 3d 22 72 69 67 68 74 22 3e 34 36 3c 2f 74 64  n="right">46</td
3a90: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68  ><td align="righ
3aa0: 74 22 3e 39 3c 2f 74 64 3e 3c 74 64 3e 4c 75 63  t">9</td><td>Luc
3ab0: 63 61 3c 2f 74 64 3e 3c 74 64 3e 4c 55 3c 2f 74  ca</td><td>LU</t
3ac0: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67  d><td align="rig
3ad0: 68 74 22 3e 33 38 38 33 32 37 3c 2f 74 64 3e 3c  ht">388327</td><
3ae0: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22  td align="right"
3af0: 3e 31 38 36 31 38 33 3c 2f 74 64 3e 3c 74 64 20  >186183</td><td 
3b00: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 30  align="right">20
3b10: 32 31 34 34 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a  2144</td></tr>..
3b20: 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72  <tr><td align="r
3b30: 69 67 68 74 22 3e 33 3c 2f 74 64 3e 3c 74 64 20  ight">3</td><td 
3b40: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 34 37  align="right">47
3b50: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
3b60: 72 69 67 68 74 22 3e 39 3c 2f 74 64 3e 3c 74 64  right">9</td><td
3b70: 3e 50 69 73 74 6f 69 61 3c 2f 74 64 3e 3c 74 64  >Pistoia</td><td
3b80: 3e 50 54 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67  >PT</td><td alig
3b90: 6e 3d 22 72 69 67 68 74 22 3e 32 38 37 38 36 36  n="right">287866
3ba0: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
3bb0: 72 69 67 68 74 22 3e 31 33 38 30 35 34 3c 2f 74  right">138054</t
3bc0: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67  d><td align="rig
3bd0: 68 74 22 3e 31 34 39 38 31 32 3c 2f 74 64 3e 3c  ht">149812</td><
3be0: 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 63 6f  /tr>..<tr><td co
3bf0: 6c 73 70 61 6e 3d 22 38 22 20 61 6c 69 67 6e 3d  lspan="8" align=
3c00: 22 63 65 6e 74 65 72 22 3e 3c 68 72 3e 3c 2f 74  "center"><hr></t
3c10: 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64  d></tr>..<tr><td
3c20: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 39   align="right">9
3c30: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
3c40: 72 69 67 68 74 22 3e 35 33 3c 2f 74 64 3e 3c 74  right">53</td><t
3c50: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
3c60: 39 3c 2f 74 64 3e 3c 74 64 3e 47 72 6f 73 73 65  9</td><td>Grosse
3c70: 74 6f 3c 2f 74 64 3e 3c 74 64 3e 47 52 3c 2f 74  to</td><td>GR</t
3c80: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67  d><td align="rig
3c90: 68 74 22 3e 32 32 30 35 36 34 3c 2f 74 64 3e 3c  ht">220564</td><
3ca0: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22  td align="right"
3cb0: 3e 31 30 35 35 38 35 3c 2f 74 64 3e 3c 74 64 20  >105585</td><td 
3cc0: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 31  align="right">11
3cd0: 34 39 37 39 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a  4979</td></tr>..
3ce0: 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72  <tr><td align="r
3cf0: 69 67 68 74 22 3e 31 30 3c 2f 74 64 3e 3c 74 64  ight">10</td><td
3d00: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31   align="right">1
3d10: 30 30 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e  00</td><td align
3d20: 3d 22 72 69 67 68 74 22 3e 39 3c 2f 74 64 3e 3c  ="right">9</td><
3d30: 74 64 3e 50 72 61 74 6f 3c 2f 74 64 3e 3c 74 64  td>Prato</td><td
3d40: 3e 50 4f 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67  >PO</td><td alig
3d50: 6e 3d 22 72 69 67 68 74 22 3e 32 34 35 39 31 36  n="right">245916
3d60: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
3d70: 72 69 67 68 74 22 3e 31 31 39 30 38 38 3c 2f 74  right">119088</t
3d80: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67  d><td align="rig
3d90: 68 74 22 3e 31 32 36 38 32 38 3c 2f 74 64 3e 3c  ht">126828</td><
3da0: 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a  /tr>..</table>..
3db0: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e  </td></tr>..<tr>
3dc0: 3c 74 64 3e 0d 0a 3c 62 3e 3c 3c 69 3e 74 6f 70  <td>..<b><<i>top
3dd0: 6f 2d 70 72 65 66 69 78 3c 2f 69 3e 3e 5f 74 6f  o-prefix</i>>_to
3de0: 70 6f 66 65 61 74 75 72 65 73 3c 2f 62 3e 0d 0a  pofeatures</b>..
3df0: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45  <verbatim>..SELE
3e00: 43 54 20 2a 20 46 52 4f 4d 20 63 65 6e 73 75 73  CT * FROM census
3e10: 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 65  2011_topofeature
3e20: 73 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d  s;..</verbatim>.
3e30: 0a 54 68 65 20 3c 62 3e 54 6f 70 6f 46 65 61 74  .The <b>TopoFeat
3e40: 75 72 65 73 2d 67 65 6f 6d 65 74 72 69 65 73 3c  ures-geometries<
3e50: 2f 62 3e 20 74 61 62 6c 65 20 69 73 20 69 6e 74  /b> table is int
3e60: 65 6e 64 65 64 20 74 6f 20 70 65 72 6d 61 6e 65  ended to permane
3e70: 6e 74 6c 79 20 73 74 6f 72 65 20 61 6c 6c 20 72  ntly store all r
3e80: 65 6c 61 74 69 6f 6e 73 20 62 65 74 77 65 65 6e  elations between
3e90: 20 54 6f 70 6f 46 65 61 74 75 72 65 73 20 61 6e   TopoFeatures an
3ea0: 64 20 54 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69  d Topology primi
3eb0: 74 69 76 65 73 20 72 65 71 75 69 72 65 64 20 69  tives required i
3ec0: 6e 20 6f 72 64 65 72 20 74 6f 20 63 6f 72 72 65  n order to corre
3ed0: 63 74 6c 79 20 62 75 69 6c 64 20 74 68 65 20 65  ctly build the e
3ee0: 78 70 65 63 74 65 64 20 6f 75 74 70 75 74 20 47  xpected output G
3ef0: 65 6f 6d 65 74 72 79 20 66 6f 72 20 65 61 63 68  eometry for each
3f00: 20 54 6f 70 6f 46 65 61 74 75 72 65 2e 0d 0a 3c   TopoFeature...<
3f10: 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 75 69 64 3c  ul>..<li><b>uid<
3f20: 2f 62 3e 20 69 73 20 74 68 65 20 50 72 69 6d 61  /b> is the Prima
3f30: 72 79 20 4b 65 79 2c 20 61 6e 64 20 69 73 20 73  ry Key, and is s
3f40: 69 6d 70 6c 79 20 69 6e 74 65 6e 64 65 64 20 74  imply intended t
3f50: 6f 20 62 65 20 61 6e 20 75 6e 69 71 75 65 20 69  o be an unique i
3f60: 64 65 6e 74 69 66 69 65 72 20 66 6f 72 20 65 61  dentifier for ea
3f70: 63 68 20 72 6f 77 20 62 75 74 20 64 6f 65 73 6e  ch row but doesn
3f80: 27 74 20 69 6e 74 65 6e 64 20 74 6f 20 68 61 76  't intend to hav
3f90: 65 20 61 6e 79 20 73 70 65 63 69 61 6c 20 6d 65  e any special me
3fa0: 61 6e 69 6e 67 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  aning.</li>..<li
3fb0: 3e 3c 62 3e 6e 6f 64 65 5f 69 64 3c 2f 62 3e 2c  ><b>node_id</b>,
3fc0: 20 3c 62 3e 65 64 67 65 5f 69 64 3c 2f 62 3e 20   <b>edge_id</b> 
3fd0: 61 6e 64 20 3c 62 3e 66 61 63 65 5f 69 64 3c 2f  and <b>face_id</
3fe0: 62 3e 20 61 72 65 20 46 6f 72 65 69 67 6e 20 4b  b> are Foreign K
3ff0: 65 79 73 20 64 69 72 65 63 74 6c 79 20 72 65 66  eys directly ref
4000: 65 72 65 6e 63 69 6e 67 20 61 20 54 6f 70 6f 6c  erencing a Topol
4010: 6f 67 79 20 70 72 69 6d 69 74 69 76 65 3b 20 74  ogy primitive; t
4020: 77 6f 20 6f 66 20 74 68 65 73 65 20 76 61 6c 75  wo of these valu
4030: 65 73 20 61 72 65 20 61 6c 77 61 79 73 20 65 78  es are always ex
4040: 70 65 63 74 65 64 20 74 6f 20 62 65 20 4e 55 4c  pected to be NUL
4050: 4c 2c 20 61 6e 64 20 6f 6e 6c 79 20 6f 6e 65 20  L, and only one 
4060: 69 73 20 65 78 70 65 63 74 65 64 20 74 6f 20 65  is expected to e
4070: 66 66 65 63 74 69 76 65 6c 79 20 72 65 66 65 72  ffectively refer
4080: 65 6e 63 65 20 61 20 54 6f 70 6f 6c 6f 67 79 20  ence a Topology 
4090: 70 72 69 6d 69 74 69 76 65 20 64 65 70 65 6e 64  primitive depend
40a0: 69 6e 67 20 6f 6e 20 69 74 73 20 74 79 70 65 2e  ing on its type.
40b0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 74 6f  </li>..<li><b>to
40c0: 70 6f 6c 61 79 65 72 5f 69 64 3c 2f 62 3e 20 61  polayer_id</b> a
40d0: 6e 64 20 3c 62 3e 66 69 64 3c 2f 62 3e 20 74 6f  nd <b>fid</b> to
40e0: 67 65 74 68 65 72 20 61 72 65 20 69 6e 74 65 6e  gether are inten
40f0: 64 65 64 20 74 6f 20 65 73 74 61 62 6c 69 73 68  ded to establish
4100: 20 61 20 72 65 6c 61 74 69 6f 6e 61 6c 20 72 65   a relational re
4110: 66 65 72 65 6e 63 65 20 74 6f 20 73 6f 6d 65 20  ference to some 
4120: 73 70 65 63 69 66 69 63 20 54 6f 70 6f 46 65 61  specific TopoFea
4130: 74 75 72 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c  ture.</li>..</ul
4140: 3e 0d 0a 3c 62 72 3e 0d 0a 3c 75 3e 45 78 61 6d  >..<br>..<u>Exam
4150: 70 6c 65 20 23 31 3c 2f 75 3e 3a 20 61 6c 6c 20  ple #1</u>: all 
4160: 54 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69  Topology primiti
4170: 76 65 73 20 64 69 72 65 63 74 6c 79 20 72 65 66  ves directly ref
4180: 65 72 65 6e 63 65 64 20 62 79 20 72 6f 77 73 20  erenced by rows 
4190: 64 65 63 6c 61 72 69 6e 67 20 3c 62 3e 74 6f 70  declaring <b>top
41a0: 6f 6c 61 79 65 72 5f 69 64 3d 32 3c 2f 62 3e 20  olayer_id=2</b> 
41b0: 61 6e 64 20 3c 62 3e 66 69 64 3d 33 3c 2f 62 3e  and <b>fid=3</b>
41c0: 20 6d 75 73 74 20 62 65 20 61 67 67 72 65 67 61   must be aggrega
41d0: 74 65 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20  ted in order to 
41e0: 62 75 69 6c 64 20 74 68 65 20 6f 75 74 70 75 74  build the output
41f0: 20 47 65 6f 6d 65 74 72 79 20 63 6f 72 72 65 73   Geometry corres
4200: 70 6f 6e 64 69 6e 67 20 74 6f 20 74 68 65 20 50  ponding to the P
4210: 6f 70 75 6c 61 74 65 64 20 50 6c 61 63 65 20 6f  opulated Place o
4220: 66 20 3c 62 3e 43 61 70 72 69 67 6c 69 6f 6c 61  f <b>Caprigliola
4230: 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 3c 75 3e 45 78  </b>.<br>..<u>Ex
4240: 61 6d 70 6c 65 20 23 32 3c 2f 75 3e 3a 20 61 6c  ample #2</u>: al
4250: 6c 20 70 72 69 6d 69 74 69 76 65 73 20 72 65 66  l primitives ref
4260: 65 72 65 6e 63 65 64 20 62 79 20 72 6f 77 73 20  erenced by rows 
4270: 64 65 63 6c 61 72 69 6e 67 20 3c 62 3e 74 6f 70  declaring <b>top
4280: 6f 6c 61 79 65 72 5f 69 64 3d 34 3c 2f 62 3e 20  olayer_id=4</b> 
4290: 61 6e 64 20 3c 62 3e 66 69 64 3d 39 3c 2f 62 3e  and <b>fid=9</b>
42a0: 20 6d 75 73 74 20 62 65 20 61 67 67 72 65 67 61   must be aggrega
42b0: 74 65 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20  ted in order to 
42c0: 62 75 69 6c 64 20 74 68 65 20 6f 75 74 70 75 74  build the output
42d0: 20 47 65 6f 6d 65 74 72 79 20 63 6f 72 72 65 73   Geometry corres
42e0: 70 6f 6e 64 69 6e 67 20 74 6f 20 74 68 65 20 50  ponding to the P
42f0: 72 6f 76 69 6e 63 65 20 6f 66 20 3c 62 3e 47 72  rovince of <b>Gr
4300: 6f 73 73 65 74 6f 3c 2f 62 3e 2e 0d 0a 3c 2f 74  osseto</b>...</t
4310: 64 3e 3c 74 64 3e 0d 0a 22 3c 69 3e 63 65 6e 73  d><td>.."<i>cens
4320: 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75  us2011_topofeatu
4330: 72 65 73 3c 2f 69 3e 22 0d 0a 3c 74 61 62 6c 65  res</i>"..<table
4340: 20 63 65 6c 6c 73 70 61 6e 3d 22 34 22 20 63 65   cellspan="4" ce
4350: 6c 6c 70 61 64 64 69 6e 67 3d 22 36 22 20 62 67  llpadding="6" bg
4360: 63 6f 6c 6f 72 3d 22 23 66 38 66 38 66 30 22 20  color="#f8f8f0" 
4370: 62 6f 72 64 65 72 3d 22 31 22 3e 0d 0a 3c 74 72  border="1">..<tr
4380: 3e 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66  ><td bgcolor="#f
4390: 30 66 30 66 38 22 3e 3c 62 3e 75 69 64 3c 2f 62  0f0f8"><b>uid</b
43a0: 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 62 67 63 6f  ></td>..<td bgco
43b0: 6c 6f 72 3d 22 23 66 30 66 30 66 38 22 3e 3c 62  lor="#f0f0f8"><b
43c0: 3e 6e 6f 64 65 5f 69 64 3c 2f 62 3e 3c 2f 74 64  >node_id</b></td
43d0: 3e 0d 0a 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22  >..<td bgcolor="
43e0: 23 66 30 66 30 66 38 22 3e 3c 62 3e 65 64 67 65  #f0f0f8"><b>edge
43f0: 5f 69 64 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74  _id</b></td>..<t
4400: 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30  d bgcolor="#f0f0
4410: 66 38 22 3e 3c 62 3e 66 61 63 65 5f 69 64 3c 2f  f8"><b>face_id</
4420: 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 62 67 63  b></td>..<td bgc
4430: 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 22 3e 3c  olor="#f0f0f8"><
4440: 62 3e 74 6f 70 6f 6c 61 79 65 72 5f 69 64 3c 2f  b>topolayer_id</
4450: 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 62 67 63  b></td>..<td bgc
4460: 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 22 3e 3c  olor="#f0f0f8"><
4470: 62 3e 66 69 64 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f  b>fid</b></td></
4480: 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69  tr>..<tr><td ali
4490: 67 6e 3d 22 72 69 67 68 74 22 3e 31 3c 2f 74 64  gn="right">1</td
44a0: 3e 3c 74 64 3e 4e 55 4c 4c 3c 2f 74 64 3e 3c 74  ><td>NULL</td><t
44b0: 64 3e 4e 55 4c 4c 3c 2f 74 64 3e 3c 74 64 20 61  d>NULL</td><td a
44c0: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 3c 2f  lign="right">1</
44d0: 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69  td><td align="ri
44e0: 67 68 74 22 3e 31 3c 2f 74 64 3e 3c 74 64 20 61  ght">1</td><td a
44f0: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 3c 2f  lign="right">1</
4500: 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74  td></tr>..<tr><t
4510: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
4520: 32 3c 2f 74 64 3e 3c 74 64 3e 4e 55 4c 4c 3c 2f  2</td><td>NULL</
4530: 74 64 3e 3c 74 64 3e 4e 55 4c 4c 3c 2f 74 64 3e  td><td>NULL</td>
4540: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  <td align="right
4550: 22 3e 32 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67  ">2</td><td alig
4560: 6e 3d 22 72 69 67 68 74 22 3e 31 3c 2f 74 64 3e  n="right">1</td>
4570: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  <td align="right
4580: 22 3e 32 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c  ">2</td></tr>..<
4590: 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69  tr><td align="ri
45a0: 67 68 74 22 3e 33 3c 2f 74 64 3e 3c 74 64 3e 4e  ght">3</td><td>N
45b0: 55 4c 4c 3c 2f 74 64 3e 3c 74 64 3e 4e 55 4c 4c  ULL</td><td>NULL
45c0: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
45d0: 72 69 67 68 74 22 3e 33 3c 2f 74 64 3e 3c 74 64  right">3</td><td
45e0: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31   align="right">1
45f0: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
4600: 72 69 67 68 74 22 3e 33 3c 2f 74 64 3e 3c 2f 74  right">3</td></t
4610: 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 63 6f 6c 73  r>..<tr><td cols
4620: 70 61 6e 3d 22 36 22 20 61 6c 69 67 6e 3d 22 63  pan="6" align="c
4630: 65 6e 74 65 72 22 3e 3c 68 72 3e 3c 2f 74 64 3e  enter"><hr></td>
4640: 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61  </tr>..<tr><td a
4650: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 38 38  lign="right">288
4660: 37 30 3c 2f 74 64 3e 3c 74 64 3e 4e 55 4c 4c 3c  70</td><td>NULL<
4670: 2f 74 64 3e 3c 74 64 3e 4e 55 4c 4c 3c 2f 74 64  /td><td>NULL</td
4680: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68  ><td align="righ
4690: 74 22 3e 32 38 38 36 34 3c 2f 74 64 3e 3c 74 64  t">28864</td><td
46a0: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31   align="right">1
46b0: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22  </td><td align="
46c0: 72 69 67 68 74 22 3e 32 38 38 36 37 3c 2f 74 64  right">28867</td
46d0: 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20  ></tr>..<tr><td 
46e0: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 38  align="right">28
46f0: 38 37 31 3c 2f 74 64 3e 3c 74 64 3e 4e 55 4c 4c  871</td><td>NULL
4700: 3c 2f 74 64 3e 3c 74 64 3e 4e 55 4c 4c 3c 2f 74  </td><td>NULL</t
4710: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67  d><td align="rig
4720: 68 74 22 3e 32 38 38 36 38 3c 2f 74 64 3e 3c 74  ht">28868</td><t
4730: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
4740: 31 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d  1</td><td align=
4750: 22 72 69 67 68 74 22 3e 32 38 38 36 38 3c 2f 74  "right">28868</t
4760: 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65  d></tr>..</table
4770: 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c  >..</td></tr>..<
4780: 2f 74 61 62 6c 65 3e 0d 0a 3c 74 61 62 6c 65 20  /table>..<table 
4790: 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 38 22 20  cellpadding="8" 
47a0: 62 67 63 6f 6c 6f 72 3d 22 23 64 30 66 66 62 30  bgcolor="#d0ffb0
47b0: 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 61  ">..<tr><td>..<a
47c0: 20 6e 61 6d 65 3d 22 72 65 6d 61 72 6b 73 22 3e   name="remarks">
47d0: 0d 0a 3c 68 33 3e 46 69 6e 61 6c 20 72 65 6d 61  ..<h3>Final rema
47e0: 72 6b 73 3c 2f 68 33 3e 3c 2f 61 3e 0d 0a 3c 6f  rks</h3></a>..<o
47f0: 6c 3e 0d 0a 3c 6c 69 3e 62 6f 74 68 20 3c 62 3e  l>..<li>both <b>
4800: 54 6f 70 6f 47 65 6f 5f 43 72 65 61 74 65 54 6f  TopoGeo_CreateTo
4810: 70 6f 4c 61 79 65 72 28 29 3c 2f 62 3e 20 61 6e  poLayer()</b> an
4820: 64 20 3c 62 3e 54 6f 70 6f 47 65 6f 5f 49 6e 69  d <b>TopoGeo_Ini
4830: 74 54 6f 70 6f 4c 61 79 65 72 28 29 3c 2f 62 3e  tTopoLayer()</b>
4840: 20 77 69 6c 6c 20 72 65 67 69 73 74 65 72 20 74   will register t
4850: 68 65 20 54 6f 70 6f 4c 61 79 65 72 20 69 6e 74  he TopoLayer int
4860: 6f 20 74 68 65 20 3c 62 3e 54 6f 70 6f 4c 61 79  o the <b>TopoLay
4870: 65 72 73 3c 2f 62 3e 20 74 61 62 6c 65 2c 20 61  ers</b> table, a
4880: 6e 64 20 77 69 6c 6c 20 63 72 65 61 74 65 20 61  nd will create a
4890: 6e 64 20 70 6f 70 75 6c 61 74 65 20 74 68 65 20  nd populate the 
48a0: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 3c 62  corresponding <b
48b0: 3e 54 6f 70 6f 46 65 61 74 75 72 65 73 3c 2f 62  >TopoFeatures</b
48c0: 3e 20 74 61 62 6c 65 20 62 79 20 69 6d 70 6f 72  > table by impor
48d0: 74 69 6e 67 20 61 6c 6c 20 69 6e 66 6f 72 6d 61  ting all informa
48e0: 74 69 6f 6e 20 61 74 74 72 69 62 75 74 65 73 20  tion attributes 
48f0: 66 6f 72 20 65 61 63 68 20 46 65 61 74 75 72 65  for each Feature
4900: 20 64 65 66 69 6e 65 64 20 62 79 20 74 68 65 20   defined by the 
4910: 72 65 66 65 72 65 6e 63 65 20 74 61 62 6c 65 20  reference table 
4920: 28 6f 72 20 72 65 66 65 72 65 6e 63 65 20 76 69  (or reference vi
4930: 65 77 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 6f  ew).</li>..<li>o
4940: 6e 6c 79 20 3c 62 3e 54 6f 70 6f 47 65 6f 5f 43  nly <b>TopoGeo_C
4950: 72 65 61 74 65 54 6f 70 6f 4c 61 79 65 72 28 29  reateTopoLayer()
4960: 3c 2f 62 3e 20 77 69 6c 6c 20 61 75 74 6f 6d 61  </b> will automa
4970: 74 69 63 61 6c 6c 79 20 70 6f 70 75 6c 61 74 65  tically populate
4980: 20 74 68 65 20 3c 62 3e 54 6f 70 6f 46 65 61 74   the <b>TopoFeat
4990: 75 72 65 73 2d 67 65 6f 6d 65 74 72 79 3c 2f 62  ures-geometry</b
49a0: 3e 20 74 61 62 6c 65 2c 20 61 6e 64 20 77 68 69  > table, and whi
49b0: 6c 65 20 64 6f 69 6e 67 20 73 6f 2c 20 69 64 65  le doing so, ide
49c0: 6e 74 69 66 79 20 61 6c 6c 20 72 65 6c 61 74 69  ntify all relati
49d0: 6f 6e 73 68 69 70 73 20 65 78 69 73 74 69 6e 67  onships existing
49e0: 20 62 65 74 77 65 65 6e 20 74 68 65 20 47 65 6f   between the Geo
49f0: 6d 65 74 72 69 65 73 20 66 6f 75 6e 64 20 69 6e  metries found in
4a00: 74 6f 20 74 68 65 20 72 65 66 65 72 65 6e 63 65  to the reference
4a10: 20 74 61 62 6c 65 20 6f 72 20 76 69 65 77 20 61   table or view a
4a20: 6e 64 20 74 68 65 20 54 6f 70 6f 6c 6f 67 79 20  nd the Topology 
4a30: 70 72 69 6d 69 74 69 76 65 73 20 62 61 73 65 64  primitives based
4a40: 20 6f 6e 20 74 68 65 20 76 61 6c 75 65 73 20 6f   on the values o
4a50: 66 20 74 68 65 20 3c 62 3e 54 6f 70 6f 53 65 65  f the <b>TopoSee
4a60: 64 73 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  ds</b>.</li>..<l
4a70: 69 3e 61 73 20 61 70 70 6f 73 65 64 20 74 6f 20  i>as apposed to 
4a80: 3c 62 3e 54 6f 70 6f 47 65 6f 5f 49 6e 69 74 54  <b>TopoGeo_InitT
4a90: 6f 70 6f 4c 61 79 65 72 28 29 3c 2f 62 3e 2c 20  opoLayer()</b>, 
4aa0: 77 68 69 63 68 20 77 69 6c 6c 20 6e 65 76 65 72  which will never
4ab0: 20 61 74 74 65 6d 70 74 20 74 6f 20 69 64 65 6e   attempt to iden
4ac0: 74 69 66 79 20 74 68 65 20 72 65 6c 61 74 69 6f  tify the relatio
4ad0: 6e 73 68 69 70 73 20 69 6e 74 65 72 63 75 72 72  nships intercurr
4ae0: 69 6e 67 20 62 65 74 77 65 65 6e 20 6f 75 74 70  ing between outp
4af0: 75 74 20 47 65 6f 6d 65 74 72 69 65 73 20 61 6e  ut Geometries an
4b00: 64 20 54 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69  d Topology primi
4b10: 74 69 76 65 73 2e 20 54 68 69 73 20 74 61 73 6b  tives. This task
4b20: 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 62 65 20   will always be 
4b30: 64 65 66 65 72 72 65 64 20 66 6f 72 20 74 68 65  deferred for the
4b40: 20 75 73 65 72 20 74 6f 20 64 65 61 6c 20 77 69   user to deal wi
4b50: 74 68 20 6c 61 74 65 72 2e 3c 62 72 3e 0d 0a 59  th later.<br>..Y
4b60: 6f 75 20 63 6f 75 6c 64 2c 20 66 6f 72 20 65 78  ou could, for ex
4b70: 61 6d 70 6c 65 2c 20 6d 61 6e 75 61 6c 6c 79 20  ample, manually 
4b80: 73 65 6c 65 63 74 20 61 6c 6c 20 54 6f 70 6f 6c  select all Topol
4b90: 6f 67 79 20 70 72 69 6d 69 74 69 76 65 73 20 63  ogy primitives c
4ba0: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20  orresponding to 
4bb0: 61 20 73 69 6e 67 6c 65 20 54 6f 70 6f 46 65 61  a single TopoFea
4bc0: 74 75 72 65 3b 20 6f 72 20 6d 6f 72 65 20 70 72  ture; or more pr
4bd0: 6f 62 61 62 6c 79 20 79 6f 75 20 63 6f 75 6c 64  obably you could
4be0: 20 70 65 72 66 6f 72 6d 20 74 68 69 73 20 74 61   perform this ta
4bf0: 73 6b 20 69 6e 20 61 20 73 65 63 6f 6e 64 20 72  sk in a second r
4c00: 6f 75 6e 64 20 62 79 20 65 78 65 63 75 74 69 6e  ound by executin
4c10: 67 20 73 6f 6d 65 20 61 70 70 72 6f 70 72 69 61  g some appropria
4c20: 74 65 20 53 51 4c 20 73 74 61 74 65 6d 65 6e 74  te SQL statement
4c30: 20 28 3c 69 3e 61 73 20 77 65 27 6c 6c 20 73 65   (<i>as we'll se
4c40: 65 6e 20 73 6f 6f 6e 20 69 6e 20 74 68 65 20 6e  en soon in the n
4c50: 65 78 74 20 65 78 61 6d 70 6c 65 3c 2f 69 3e 29  ext example</i>)
4c60: 2e 20 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c 2f 74 64 3e  . ..</ol>..</td>
4c70: 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 3c  </tr>..</table><
4c80: 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 61 20 6e 61  br>..<hr>..<a na
4c90: 6d 65 3d 22 45 78 70 6f 72 74 54 6f 70 6f 4c 61  me="ExportTopoLa
4ca0: 79 65 72 22 3e 0d 0a 3c 68 33 3e 54 6f 70 6f 47  yer">..<h3>TopoG
4cb0: 65 6f 5f 45 78 70 6f 72 74 54 6f 70 6f 4c 61 79  eo_ExportTopoLay
4cc0: 65 72 3a 20 65 78 70 6f 72 74 69 6e 67 20 61 20  er: exporting a 
4cd0: 66 75 6c 6c 20 54 6f 70 6f 4c 61 79 65 72 20 69  full TopoLayer i
4ce0: 6e 74 6f 20 61 20 47 65 6f 54 61 62 6c 65 3c 2f  nto a GeoTable</
4cf0: 68 33 3e 3c 2f 61 3e 0d 0a 3c 74 61 62 6c 65 20  h3></a>..<table 
4d00: 77 69 64 74 68 3d 22 31 30 30 25 22 20 20 63 65  width="100%"  ce
4d10: 6c 6c 73 70 61 6e 3d 22 34 22 20 63 65 6c 6c 70  llspan="4" cellp
4d20: 61 64 64 69 6e 67 3d 22 36 22 20 62 67 63 6f 6c  adding="6" bgcol
4d30: 6f 72 3d 22 23 66 38 66 38 66 30 22 20 62 6f 72  or="#f8f8f0" bor
4d40: 64 65 72 3d 22 31 22 3e 0d 0a 3c 74 72 3e 3c 74  der="1">..<tr><t
4d50: 64 20 63 6f 6c 73 70 61 6e 3d 22 32 22 20 61 6c  d colspan="2" al
4d60: 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 3c 62 3e  ign="center"><b>
4d70: 65 78 70 6f 72 74 69 6e 67 20 74 68 65 20 43 65  exporting the Ce
4d80: 6e 73 75 73 20 41 72 65 61 73 20 54 6f 70 6f 4c  nsus Areas TopoL
4d90: 61 79 65 72 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f 74  ayer</b></td></t
4da0: 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 57 65  r>..<tr><td>..We
4db0: 27 6c 6c 20 73 74 61 72 74 20 62 79 20 65 78 70  'll start by exp
4dc0: 6f 72 74 69 6e 67 20 66 69 72 73 74 20 74 68 65  orting first the
4dd0: 20 6f 6e 6c 79 20 63 6f 6d 70 6c 65 74 65 6c 79   only completely
4de0: 20 64 65 66 69 6e 65 64 20 54 6f 70 6f 4c 61 79   defined TopoLay
4df0: 65 72 20 77 65 20 68 61 76 65 20 61 74 20 74 68  er we have at th
4e00: 69 73 20 70 6f 69 6e 74 20 69 6e 20 74 68 65 20  is point in the 
4e10: 74 65 73 74 20 44 42 2d 66 69 6c 65 2c 20 69 2e  test DB-file, i.
4e20: 65 2e 20 3c 62 3e 63 65 6e 73 75 73 5f 61 72 65  e. <b>census_are
4e30: 61 73 3c 2f 62 3e 0d 0a 3c 76 65 72 62 61 74 69  as</b>..<verbati
4e40: 6d 3e 0d 0a 53 45 4c 45 43 54 20 54 6f 70 6f 47  m>..SELECT TopoG
4e50: 65 6f 5f 45 78 70 6f 72 74 54 6f 70 6f 4c 61 79  eo_ExportTopoLay
4e60: 65 72 28 27 63 65 6e 73 75 73 32 30 31 31 27 2c  er('census2011',
4e70: 20 27 63 65 6e 73 75 73 5f 61 72 65 61 73 27 2c   'census_areas',
4e80: 20 27 6f 75 74 5f 63 65 6e 73 75 73 5f 32 30 31   'out_census_201
4e90: 31 27 2c 20 31 29 3b 0d 0a 3c 2f 76 65 72 62 61  1', 1);..</verba
4ea0: 74 69 6d 3e 0d 0a 41 73 20 79 6f 75 20 63 61 6e  tim>..As you can
4eb0: 20 65 61 73 69 6c 79 20 63 68 65 63 6b 20 62 79   easily check by
4ec0: 20 79 6f 75 72 73 65 6c 66 20 61 20 6e 65 77 20   yourself a new 
4ed0: 47 65 6f 54 61 62 6c 65 20 6e 61 6d 65 64 20 3c  GeoTable named <
4ee0: 62 3e 6f 75 74 5f 63 65 6e 73 75 73 5f 32 30 31  b>out_census_201
4ef0: 31 3c 2f 62 3e 20 68 61 73 20 62 65 65 6e 20 63  1</b> has been c
4f00: 72 65 61 74 65 64 20 62 79 20 3c 62 3e 54 6f 70  reated by <b>Top
4f10: 6f 47 65 6f 5f 45 78 70 6f 72 74 54 6f 70 6f 4c  oGeo_ExportTopoL
4f20: 61 79 65 72 28 29 3c 2f 62 3e 3a 0d 0a 3c 75 6c  ayer()</b>:..<ul
4f30: 3e 0d 0a 3c 6c 69 3e 74 68 69 73 20 47 65 6f 54  >..<li>this GeoT
4f40: 61 62 6c 65 20 63 6f 6e 74 61 69 6e 73 20 61 6c  able contains al
4f50: 6c 20 54 6f 70 6f 46 65 61 74 75 72 65 73 20 64  l TopoFeatures d
4f60: 65 66 69 6e 65 64 20 69 6e 74 6f 20 74 68 65 20  efined into the 
4f70: 54 6f 70 6f 4c 61 79 65 72 2e 3c 2f 6c 69 3e 0d  TopoLayer.</li>.
4f80: 0a 3c 6c 69 3e 65 61 63 68 20 54 6f 70 6f 46 65  .<li>each TopoFe
4f90: 61 74 75 72 65 20 66 61 69 74 68 66 75 6c 6c 79  ature faithfully
4fa0: 20 70 72 65 73 65 72 76 65 73 20 69 74 73 20 69   preserves its i
4fb0: 6e 69 74 69 61 6c 20 69 6e 66 6f 72 6d 61 74 69  nitial informati
4fc0: 6f 6e 20 61 74 74 72 69 62 75 74 65 73 2e 3c 2f  on attributes.</
4fd0: 6c 69 3e 0d 0a 3c 6c 69 3e 61 6c 6c 20 47 65 6f  li>..<li>all Geo
4fe0: 6d 65 74 72 69 65 73 20 61 72 65 20 70 72 65 63  metries are prec
4ff0: 69 73 65 6c 79 20 62 75 69 6c 74 20 62 79 20 61  isely built by a
5000: 67 67 72 65 67 61 74 69 6e 67 20 74 68 65 20 63  ggregating the c
5010: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 54 6f 70  orresponding Top
5020: 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 76 65 73  ology primitives
5030: 20 61 73 20 73 70 65 63 69 66 69 65 64 20 62 79   as specified by
5040: 20 54 6f 70 6f 4c 61 79 65 72 20 2f 20 54 6f 70   TopoLayer / Top
5050: 6f 46 65 61 74 75 72 65 73 20 72 65 6c 61 74 69  oFeatures relati
5060: 6f 6e 73 68 69 70 73 2e 3c 2f 6c 69 3e 0d 0a 3c  onships.</li>..<
5070: 2f 75 6c 3e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68  /ul><br><br>..Th
5080: 65 20 69 6d 61 67 65 20 65 78 61 6d 70 6c 69 66  e image examplif
5090: 69 65 73 20 61 20 63 68 6f 72 6f 70 6c 65 74 68  ies a choropleth
50a0: 20 63 65 6e 74 65 72 65 64 20 61 72 6f 75 6e 64   centered around
50b0: 20 74 68 65 20 49 73 6c 61 6e 64 20 6f 66 20 45   the Island of E
50c0: 6c 62 61 20 61 6e 64 20 62 61 73 65 64 20 6f 6e  lba and based on
50d0: 20 74 68 65 20 3c 62 3e 6f 75 74 5f 63 65 6e 73   the <b>out_cens
50e0: 75 73 5f 32 30 31 31 3c 2f 62 3e 20 47 65 6f 54  us_2011</b> GeoT
50f0: 61 62 6c 65 3a 20 61 6c 6c 20 43 65 6e 73 75 73  able: all Census
5100: 20 41 72 65 61 73 20 61 72 65 20 64 69 73 70 6c   Areas are displ
5110: 61 79 65 64 20 62 79 20 61 64 6f 70 74 69 6e 67  ayed by adopting
5120: 20 61 20 63 6f 6c 6f 75 72 20 64 69 72 65 63 74   a colour direct
5130: 6c 79 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67  ly corresponding
5140: 20 74 6f 20 74 68 65 69 72 20 70 6f 70 75 6c 61   to their popula
5150: 74 69 6f 6e 20 64 65 6e 73 69 74 79 2e 0d 0a 3c  tion density...<
5160: 2f 74 64 3e 3c 74 64 3e 0d 0a 3c 69 6d 67 20 73  /td><td>..<img s
5170: 72 63 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e  rc="https://www.
5180: 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61  gaia-gis.it/gaia
5190: 2d 73 69 6e 73 2f 74 6f 70 6f 66 69 67 73 2f 65  -sins/topofigs/e
51a0: 6c 62 61 2d 63 68 6f 72 6f 70 6c 65 74 68 2e 70  lba-choropleth.p
51b0: 6e 67 22 20 61 6c 74 3d 22 65 6c 62 61 2d 63 68  ng" alt="elba-ch
51c0: 6f 72 6f 70 6c 65 74 68 22 3e 0d 0a 3c 2f 74 64  oropleth">..</td
51d0: 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e  ></tr>..</table>
51e0: 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 61 20 6e  <br>..<hr>..<a n
51f0: 61 6d 65 3d 22 41 64 6d 69 6e 69 73 74 72 61 74  ame="Administrat
5200: 69 76 65 2d 4c 65 76 65 6c 73 22 3e 0d 0a 3c 68  ive-Levels">..<h
5210: 33 3e 42 75 69 6c 64 69 6e 67 20 61 20 66 75 6c  3>Building a ful
5220: 6c 20 68 69 65 72 61 72 63 68 79 20 6f 66 20 41  l hierarchy of A
5230: 64 6d 69 6e 69 73 74 72 61 74 69 76 65 20 4c 65  dministrative Le
5240: 76 65 6c 73 20 62 79 20 53 51 4c 20 73 74 61 74  vels by SQL stat
5250: 65 6d 65 6e 74 73 3c 2f 68 33 3e 3c 2f 61 3e 0d  ements</h3></a>.
5260: 0a 41 73 20 77 65 27 76 65 20 61 6c 72 65 61 64  .As we've alread
5270: 79 20 73 65 65 6e 20 62 65 66 6f 72 65 20 77 65  y seen before we
5280: 20 61 72 65 20 6e 6f 77 20 65 78 70 65 63 74 65   are now expecte
5290: 64 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 73 6f  d to complete so
52a0: 6d 65 77 61 79 20 74 68 65 20 54 6f 70 6f 46 65  meway the TopoFe
52b0: 61 74 75 72 65 73 20 64 65 66 69 6e 69 74 69 6f  atures definitio
52c0: 6e 73 20 73 75 70 70 6f 72 74 69 6e 67 20 74 68  ns supporting th
52d0: 65 20 3c 62 3e 50 6f 70 75 6c 61 74 65 64 20 50  e <b>Populated P
52e0: 6c 61 63 65 73 3c 2f 62 3e 2c 20 3c 62 3e 4d 75  laces</b>, <b>Mu
52f0: 6e 69 63 69 70 61 6c 69 74 69 65 73 3c 2f 62 3e  nicipalities</b>
5300: 2c 20 3c 62 3e 50 72 6f 76 69 6e 63 65 73 3c 2f  , <b>Provinces</
5310: 62 3e 20 61 6e 64 20 3c 62 3e 52 65 67 69 6f 6e  b> and <b>Region
5320: 3c 2f 62 3e 20 54 6f 70 6f 4c 61 79 65 72 73 20  </b> TopoLayers 
5330: 77 65 27 76 65 20 70 72 65 76 69 6f 75 73 6c 79  we've previously
5340: 20 63 72 65 61 74 65 64 20 62 79 20 63 61 6c 6c   created by call
5350: 69 6e 67 20 3c 62 3e 54 6f 70 6f 47 65 6f 5f 49  ing <b>TopoGeo_I
5360: 6e 69 74 54 6f 70 6f 4c 61 79 65 72 28 29 3c 2f  nitTopoLayer()</
5370: 62 3e 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 48 61 70  b>.<br><br>..Hap
5380: 70 69 6c 79 20 65 6e 6f 75 67 68 20 61 6c 6c 20  pily enough all 
5390: 74 68 65 73 65 20 61 64 6d 69 6e 69 73 74 72 61  these administra
53a0: 74 69 76 65 20 6c 65 76 65 6c 73 20 61 72 65 20  tive levels are 
53b0: 73 69 6d 70 6c 79 20 62 61 73 65 64 20 6f 6e 20  simply based on 
53c0: 64 69 72 65 63 74 20 61 67 67 72 65 67 61 74 69  direct aggregati
53d0: 6f 6e 73 20 6f 66 20 3c 62 3e 43 65 6e 73 75 73  ons of <b>Census
53e0: 20 41 72 65 61 73 3c 2f 62 3e 2c 20 73 6f 20 77   Areas</b>, so w
53f0: 65 20 6a 75 73 74 20 68 61 76 65 20 74 6f 20 65  e just have to e
5400: 78 65 63 75 74 65 20 66 65 77 20 61 70 70 72 6f  xecute few appro
5410: 70 72 69 61 74 65 20 53 51 4c 20 73 74 61 74 65  priate SQL state
5420: 6d 65 6e 74 73 2e 0d 0a 3c 76 65 72 62 61 74 69  ments...<verbati
5430: 6d 3e 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20  m>..INSERT INTO 
5440: 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66  census2011_topof
5450: 65 61 74 75 72 65 73 0d 0a 53 45 4c 45 43 54 20  eatures..SELECT 
5460: 4e 55 4c 4c 2c 20 63 2e 6e 6f 64 65 5f 69 64 2c  NULL, c.node_id,
5470: 20 63 2e 65 64 67 65 5f 69 64 2c 20 63 2e 66 61   c.edge_id, c.fa
5480: 63 65 5f 69 64 2c 20 32 2c 20 61 2e 66 69 64 0d  ce_id, 2, a.fid.
5490: 0a 46 52 4f 4d 20 63 65 6e 73 75 73 32 30 31 31  .FROM census2011
54a0: 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 32 20  _topofeatures_2 
54b0: 41 53 20 61 0d 0a 4a 4f 49 4e 20 63 65 6e 73 75  AS a..JOIN censu
54c0: 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72  s2011_topofeatur
54d0: 65 73 5f 31 20 41 53 20 62 20 4f 4e 20 28 62 2e  es_1 AS b ON (b.
54e0: 63 6f 64 5f 70 70 6c 20 3d 20 61 2e 63 6f 64 5f  cod_ppl = a.cod_
54f0: 70 70 6c 29 0d 0a 4a 4f 49 4e 20 63 65 6e 73 75  ppl)..JOIN censu
5500: 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72  s2011_topofeatur
5510: 65 73 20 41 53 20 63 20 4f 4e 20 28 63 2e 74 6f  es AS c ON (c.to
5520: 70 6f 6c 61 79 65 72 5f 69 64 20 3d 20 31 20 41  polayer_id = 1 A
5530: 4e 44 20 63 2e 66 69 64 20 3d 20 62 2e 66 69 64  ND c.fid = b.fid
5540: 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d  );..</verbatim>.
5550: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 65  .<ul>..<li><b>ce
5560: 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61  nsus2011_topofea
5570: 74 75 72 65 73 5f 31 3c 2f 62 3e 20 69 73 20 74  tures_1</b> is t
5580: 68 65 20 54 6f 70 6f 46 65 61 74 75 72 65 73 20  he TopoFeatures 
5590: 74 61 62 6c 65 20 63 6f 72 72 65 73 70 6f 6e 64  table correspond
55a0: 69 6e 67 20 74 6f 20 3c 62 3e 43 65 6e 73 75 73  ing to <b>Census
55b0: 20 41 72 65 61 73 3c 2f 62 3e 2e 3c 2f 6c 69 3e   Areas</b>.</li>
55c0: 0d 0a 3c 6c 69 3e 3c 62 3e 63 65 6e 73 75 73 32  ..<li><b>census2
55d0: 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 73  011_topofeatures
55e0: 5f 32 3c 2f 62 3e 20 69 73 20 74 68 65 20 63 6f  _2</b> is the co
55f0: 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 3c 62 3e  rresponds to <b>
5600: 50 6f 70 75 6c 61 74 65 64 20 50 6c 61 63 65 73  Populated Places
5610: 3c 2f 62 3e 3b 20 74 68 65 20 63 6c 61 75 73 65  </b>; the clause
5620: 20 3c 62 3e 62 2e 63 6f 64 5f 70 70 6c 20 3d 20   <b>b.cod_ppl = 
5630: 61 2e 63 6f 64 5f 70 70 6c 3c 2f 62 3e 20 77 69  a.cod_ppl</b> wi
5640: 6c 6c 20 72 65 6c 61 74 69 6f 6e 61 6c 6c 79 20  ll relationally 
5650: 6a 6f 69 6e 20 65 61 63 68 20 50 6f 70 75 6c 61  join each Popula
5660: 74 65 64 20 50 6c 61 63 65 20 74 6f 20 69 74 73  ted Place to its
5670: 20 75 6e 64 65 72 6c 61 79 69 6e 67 20 43 65 6e   underlaying Cen
5680: 73 75 73 20 41 72 65 61 73 2e 3c 2f 6c 69 3e 0d  sus Areas.</li>.
5690: 0a 3c 6c 69 3e 73 6f 20 77 65 20 63 61 6e 20 64  .<li>so we can d
56a0: 75 6c 79 20 69 6e 73 65 72 74 20 69 6e 74 6f 20  uly insert into 
56b0: 74 68 65 20 3c 62 3e 54 6f 70 6f 46 65 61 74 75  the <b>TopoFeatu
56c0: 72 65 73 2d 67 65 6f 6d 65 74 72 79 3c 2f 62 3e  res-geometry</b>
56d0: 20 74 61 62 6c 65 20 28 69 2e 65 2e 20 3c 69 3e   table (i.e. <i>
56e0: 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66  census2011_topof
56f0: 65 61 74 75 72 65 73 3c 2f 69 3e 29 20 61 20 6e  eatures</i>) a n
5700: 65 77 20 6c 65 76 65 6c 20 6f 66 20 72 65 66 65  ew level of refe
5710: 72 65 6e 63 65 73 20 74 6f 20 54 6f 70 6f 6c 6f  rences to Topolo
5720: 67 79 20 70 72 69 6d 69 74 69 76 65 73 20 62 79  gy primitives by
5730: 20 73 69 6d 70 6c 79 20 63 6f 70 79 69 6e 67 20   simply copying 
5740: 61 6c 6c 20 64 65 66 69 6e 69 74 69 6f 6e 73 20  all definitions 
5750: 61 6c 72 65 61 64 79 20 73 74 6f 72 65 64 20 69  already stored i
5760: 6e 74 6f 20 74 68 65 20 70 72 65 76 69 6f 75 73  nto the previous
5770: 20 68 69 65 72 61 72 63 68 69 63 61 6c 20 6c 65   hierarchical le
5780: 76 65 6c 2e 3c 62 72 3e 0d 0a 41 6e 64 20 74 6f  vel.<br>..And to
5790: 20 64 6f 20 73 75 63 68 20 61 20 74 68 69 6e 67   do such a thing
57a0: 20 77 65 20 73 69 6d 70 6c 79 20 68 61 76 65 20   we simply have 
57b0: 74 6f 20 72 65 61 64 20 66 72 6f 6d 20 3c 62 3e  to read from <b>
57c0: 74 6f 70 6f 6c 61 79 65 72 3d 31 3c 2f 62 3e 20  topolayer=1</b> 
57d0: 74 68 65 6e 20 69 6e 73 65 72 74 69 6e 67 20 69  then inserting i
57e0: 6e 74 6f 20 3c 62 3e 74 6f 70 6f 6c 61 79 65 72  nto <b>topolayer
57f0: 3d 32 3c 2f 62 3e 20 61 66 74 65 72 20 73 65 74  =2</b> after set
5800: 74 69 6e 67 20 74 68 65 20 61 70 70 72 6f 70 72  ting the appropr
5810: 69 61 74 65 20 3c 62 3e 66 69 64 3c 2f 62 3e 20  iate <b>fid</b> 
5820: 76 61 6c 75 65 73 2e 3c 62 72 3e 0d 0a 52 65 61  values.<br>..Rea
5830: 6c 6c 79 20 6e 6f 74 20 61 20 64 69 66 66 69 63  lly not a diffic
5840: 75 6c 74 20 74 61 73 6b 2e 3c 2f 6c 69 3e 0d 0a  ult task.</li>..
5850: 3c 2f 75 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 6d  </ul>..<verbatim
5860: 3e 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 63  >..INSERT INTO c
5870: 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65  ensus2011_topofe
5880: 61 74 75 72 65 73 0d 0a 53 45 4c 45 43 54 20 4e  atures..SELECT N
5890: 55 4c 4c 2c 20 63 2e 6e 6f 64 65 5f 69 64 2c 20  ULL, c.node_id, 
58a0: 63 2e 65 64 67 65 5f 69 64 2c 20 63 2e 66 61 63  c.edge_id, c.fac
58b0: 65 5f 69 64 2c 20 33 2c 20 61 2e 66 69 64 0d 0a  e_id, 3, a.fid..
58c0: 46 52 4f 4d 20 63 65 6e 73 75 73 32 30 31 31 5f  FROM census2011_
58d0: 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 33 20 41  topofeatures_3 A
58e0: 53 20 61 0d 0a 4a 4f 49 4e 20 63 65 6e 73 75 73  S a..JOIN census
58f0: 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 65  2011_topofeature
5900: 73 5f 31 20 41 53 20 62 20 4f 4e 20 28 62 2e 63  s_1 AS b ON (b.c
5910: 6f 64 5f 63 6f 6d 20 3d 20 61 2e 63 6f 64 5f 63  od_com = a.cod_c
5920: 6f 6d 29 0d 0a 4a 4f 49 4e 20 63 65 6e 73 75 73  om)..JOIN census
5930: 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 65  2011_topofeature
5940: 73 20 41 53 20 63 20 4f 4e 20 28 63 2e 74 6f 70  s AS c ON (c.top
5950: 6f 6c 61 79 65 72 5f 69 64 20 3d 20 31 20 41 4e  olayer_id = 1 AN
5960: 44 20 63 2e 66 69 64 20 3d 20 62 2e 66 69 64 29  D c.fid = b.fid)
5970: 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a  ;..</verbatim>..
5980: 57 65 20 63 61 6e 20 61 64 6f 70 74 20 65 78 61  We can adopt exa
5990: 63 74 6c 79 20 74 68 65 20 73 61 6d 65 20 69 64  ctly the same id
59a0: 65 6e 74 69 63 61 6c 20 61 70 70 72 6f 61 63 68  entical approach
59b0: 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 63 6f 6d   in order to com
59c0: 70 6c 65 74 65 20 3c 62 3e 74 6f 70 6f 6c 61 79  plete <b>topolay
59d0: 65 72 3d 33 3c 2f 62 3e 20 63 6f 72 72 65 73 70  er=3</b> corresp
59e0: 6f 6e 64 69 6e 67 20 74 6f 20 3c 62 3e 4d 75 6e  onding to <b>Mun
59f0: 69 63 69 70 61 6c 69 74 69 65 73 3c 2f 62 3e 2e  icipalities</b>.
5a00: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 49 4e  ..<verbatim>..IN
5a10: 53 45 52 54 20 49 4e 54 4f 20 63 65 6e 73 75 73  SERT INTO census
5a20: 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 65  2011_topofeature
5a30: 73 0d 0a 53 45 4c 45 43 54 20 4e 55 4c 4c 2c 20  s..SELECT NULL, 
5a40: 63 2e 6e 6f 64 65 5f 69 64 2c 20 63 2e 65 64 67  c.node_id, c.edg
5a50: 65 5f 69 64 2c 20 63 2e 66 61 63 65 5f 69 64 2c  e_id, c.face_id,
5a60: 20 34 2c 20 61 2e 66 69 64 0d 0a 46 52 4f 4d 20   4, a.fid..FROM 
5a70: 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66  census2011_topof
5a80: 65 61 74 75 72 65 73 5f 34 20 41 53 20 61 0d 0a  eatures_4 AS a..
5a90: 4a 4f 49 4e 20 63 65 6e 73 75 73 32 30 31 31 5f  JOIN census2011_
5aa0: 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 33 20 41  topofeatures_3 A
5ab0: 53 20 62 20 4f 4e 20 28 62 2e 63 6f 64 5f 70 72  S b ON (b.cod_pr
5ac0: 6f 76 20 3d 20 61 2e 63 6f 64 5f 70 72 6f 76 29  ov = a.cod_prov)
5ad0: 0d 0a 4a 4f 49 4e 20 63 65 6e 73 75 73 32 30 31  ..JOIN census201
5ae0: 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 20 41  1_topofeatures A
5af0: 53 20 63 20 4f 4e 20 28 63 2e 74 6f 70 6f 6c 61  S c ON (c.topola
5b00: 79 65 72 5f 69 64 20 3d 20 33 20 41 4e 44 20 63  yer_id = 3 AND c
5b10: 2e 66 69 64 20 3d 20 62 2e 66 69 64 29 3b 0d 0a  .fid = b.fid);..
5b20: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 4d 6f 72  </verbatim>..Mor
5b30: 65 20 6f 72 20 6c 65 73 73 20 74 68 65 20 73 61  e or less the sa
5b40: 6d 65 20 69 73 20 66 6f 72 20 64 65 72 69 76 69  me is for derivi
5b50: 6e 67 20 3c 62 3e 74 6f 70 6f 6c 61 79 65 72 3d  ng <b>topolayer=
5b60: 34 3c 2f 62 3e 20 63 6f 72 72 65 73 70 6f 6e 64  4</b> correspond
5b70: 69 6e 67 20 74 6f 20 3c 62 3e 50 72 6f 76 69 6e  ing to <b>Provin
5b80: 63 65 73 3c 2f 62 3e 3b 20 74 68 69 73 20 74 69  ces</b>; this ti
5b90: 6d 65 20 77 65 27 6c 6c 20 73 69 6d 70 6c 79 20  me we'll simply 
5ba0: 61 67 67 72 65 67 61 74 65 20 74 68 65 20 75 6e  aggregate the un
5bb0: 64 65 72 6c 79 69 6e 67 20 4d 75 6e 69 63 69 70  derlying Municip
5bc0: 61 6c 69 74 69 65 73 20 66 72 6f 6d 20 3c 62 3e  alities from <b>
5bd0: 74 6f 70 6f 6c 61 79 65 72 3d 33 3c 2f 62 3e 2e  topolayer=3</b>.
5be0: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 57  ..</verbatim>..W
5bf0: 65 20 63 61 6e 20 61 64 6f 70 74 20 65 78 61 63  e can adopt exac
5c00: 74 6c 79 20 74 68 65 20 73 61 6d 65 20 69 64 65  tly the same ide
5c10: 6e 74 69 63 61 6c 20 61 70 70 72 6f 61 63 68 20  ntical approach 
5c20: 69 6e 20 6f 72 64 65 72 20 74 6f 20 63 6f 6d 70  in order to comp
5c30: 6c 65 74 65 20 3c 62 3e 74 6f 70 6f 6c 61 79 65  lete <b>topolaye
5c40: 72 3d 33 3c 2f 62 3e 20 63 6f 72 72 65 73 70 6f  r=3</b> correspo
5c50: 6e 64 69 6e 67 20 74 6f 20 3c 62 3e 4d 75 6e 69  nding to <b>Muni
5c60: 63 69 70 61 6c 69 74 69 65 73 3c 2f 62 3e 2e 0d  cipalities</b>..
5c70: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 49 4e 53  .<verbatim>..INS
5c80: 45 52 54 20 49 4e 54 4f 20 63 65 6e 73 75 73 32  ERT INTO census2
5c90: 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 73  011_topofeatures
5ca0: 0d 0a 53 45 4c 45 43 54 20 4e 55 4c 4c 2c 20 63  ..SELECT NULL, c
5cb0: 2e 6e 6f 64 65 5f 69 64 2c 20 63 2e 65 64 67 65  .node_id, c.edge
5cc0: 5f 69 64 2c 20 63 2e 66 61 63 65 5f 69 64 2c 20  _id, c.face_id, 
5cd0: 35 2c 20 61 2e 66 69 64 0d 0a 46 52 4f 4d 20 63  5, a.fid..FROM c
5ce0: 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65  ensus2011_topofe
5cf0: 61 74 75 72 65 73 5f 35 20 41 53 20 61 0d 0a 4a  atures_5 AS a..J
5d00: 4f 49 4e 20 63 65 6e 73 75 73 32 30 31 31 5f 74  OIN census2011_t
5d10: 6f 70 6f 66 65 61 74 75 72 65 73 5f 34 20 41 53  opofeatures_4 AS
5d20: 20 62 20 4f 4e 20 28 62 2e 63 6f 64 5f 72 65 67   b ON (b.cod_reg
5d30: 20 3d 20 61 2e 63 6f 64 5f 72 65 67 29 0d 0a 4a   = a.cod_reg)..J
5d40: 4f 49 4e 20 63 65 6e 73 75 73 32 30 31 31 5f 74  OIN census2011_t
5d50: 6f 70 6f 66 65 61 74 75 72 65 73 20 41 53 20 63  opofeatures AS c
5d60: 20 4f 4e 20 28 63 2e 74 6f 70 6f 6c 61 79 65 72   ON (c.topolayer
5d70: 5f 69 64 20 3d 20 34 20 41 4e 44 20 63 2e 66 69  _id = 4 AND c.fi
5d80: 64 20 3d 20 62 2e 66 69 64 29 3b 0d 0a 3c 2f 76  d = b.fid);..</v
5d90: 65 72 62 61 74 69 6d 3e 0d 0a 41 6e 64 20 66 69  erbatim>..And fi
5da0: 6e 61 6c 6c 79 20 77 65 20 63 61 6e 20 64 65 72  nally we can der
5db0: 69 76 65 20 3c 62 3e 74 6f 70 6f 6c 61 79 65 72  ive <b>topolayer
5dc0: 3d 35 3c 2f 62 3e 20 63 6f 72 72 65 73 70 6f 6e  =5</b> correspon
5dd0: 64 69 6e 67 20 74 6f 20 3c 62 3e 52 65 67 69 6f  ding to <b>Regio
5de0: 6e 73 3c 2f 62 3e 20 62 79 20 64 69 72 65 63 74  ns</b> by direct
5df0: 6c 79 20 61 67 67 72 65 67 61 74 69 6e 67 20 74  ly aggregating t
5e00: 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 50 72  he underlying Pr
5e10: 6f 76 69 6e 63 65 73 20 66 72 6f 6d 20 3c 62 3e  ovinces from <b>
5e20: 74 6f 70 6f 6c 61 79 65 72 3d 34 3c 2f 62 3e 2e  topolayer=4</b>.
5e30: 0d 0a 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 74 61 62  ..<br><br>..<tab
5e40: 6c 65 20 77 69 64 74 68 3d 22 31 30 30 25 22 20  le width="100%" 
5e50: 20 63 65 6c 6c 73 70 61 6e 3d 22 34 22 20 63 65   cellspan="4" ce
5e60: 6c 6c 70 61 64 64 69 6e 67 3d 22 36 22 20 62 67  llpadding="6" bg
5e70: 63 6f 6c 6f 72 3d 22 23 66 38 66 38 66 30 22 20  color="#f8f8f0" 
5e80: 62 6f 72 64 65 72 3d 22 31 22 3e 0d 0a 3c 74 72  border="1">..<tr
5e90: 3e 3c 74 64 3e 0d 0a 3c 62 3e 73 74 65 70 20 23  ><td>..<b>step #
5ea0: 31 3a 20 65 78 70 6f 72 74 69 6e 67 20 74 68 65  1: exporting the
5eb0: 20 52 65 67 69 6f 6e 20 54 6f 70 6f 4c 61 79 65   Region TopoLaye
5ec0: 72 3c 2f 62 3e 0d 0a 3c 76 65 72 62 61 74 69 6d  r</b>..<verbatim
5ed0: 3e 0d 0a 53 45 4c 45 43 54 20 54 6f 70 6f 47 65  >..SELECT TopoGe
5ee0: 6f 5f 45 78 70 6f 72 74 54 6f 70 6f 4c 61 79 65  o_ExportTopoLaye
5ef0: 72 28 27 63 65 6e 73 75 73 32 30 31 31 27 2c 20  r('census2011', 
5f00: 27 72 65 67 27 2c 20 27 6f 75 74 5f 72 65 67 5f  'reg', 'out_reg_
5f10: 32 30 31 31 27 2c 20 31 29 3b 0d 0a 3c 2f 76 65  2011', 1);..</ve
5f20: 72 62 61 74 69 6d 3e 0d 0a 57 65 20 61 72 65 20  rbatim>..We are 
5f30: 6e 6f 77 20 64 65 66 69 6e 69 74 65 6c 79 20 72  now definitely r
5f40: 65 61 64 79 20 74 6f 20 65 78 70 6f 72 74 20 61  eady to export a
5f50: 6e 79 20 6f 74 68 65 72 20 41 64 6d 69 6e 69 73  ny other Adminis
5f60: 74 72 61 74 69 76 65 20 4c 65 76 65 6c 2e 3c 62  trative Level.<b
5f70: 72 3e 0d 0a 46 6f 72 20 74 68 65 20 73 61 6b 65  r>..For the sake
5f80: 20 6f 66 20 63 6c 61 72 69 74 79 20 77 65 27 6c   of clarity we'l
5f90: 6c 20 66 6f 6c 6c 6f 77 20 61 20 74 6f 70 2d 62  l follow a top-b
5fa0: 6f 74 74 6f 6d 20 6f 72 64 65 72 2c 20 73 6f 20  ottom order, so 
5fb0: 77 65 27 6c 6c 20 73 74 61 72 74 20 62 79 20 65  we'll start by e
5fc0: 78 70 6f 72 74 69 6e 67 20 66 69 72 73 74 20 74  xporting first t
5fd0: 68 65 20 77 68 6f 6c 65 20 54 75 73 63 61 6e 79  he whole Tuscany
5fe0: 2e 0d 0a 3c 2f 74 64 3e 3c 74 64 3e 0d 0a 3c 69  ...</td><td>..<i
5ff0: 6d 67 20 73 72 63 3d 22 68 74 74 70 73 3a 2f 2f  mg src="https://
6000: 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f  www.gaia-gis.it/
6010: 67 61 69 61 2d 73 69 6e 73 2f 74 6f 70 6f 66 69  gaia-sins/topofi
6020: 67 73 2f 74 6f 70 6f 6c 61 79 65 72 2d 72 65 67  gs/topolayer-reg
6030: 69 6f 6e 2e 70 6e 67 22 20 61 6c 74 3d 22 74 6f  ion.png" alt="to
6040: 70 6f 6c 61 79 65 72 2d 72 65 67 69 6f 6e 22 3e  polayer-region">
6050: 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74  ..</td></tr>..<t
6060: 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 73 74 65 70 20  r><td>..<b>step 
6070: 23 32 3a 20 65 78 70 6f 72 74 69 6e 67 20 74 68  #2: exporting th
6080: 65 20 50 72 6f 76 69 6e 63 65 73 20 54 6f 70 6f  e Provinces Topo
6090: 4c 61 79 65 72 3c 2f 62 3e 0d 0a 3c 76 65 72 62  Layer</b>..<verb
60a0: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 54 6f  atim>..SELECT To
60b0: 70 6f 47 65 6f 5f 45 78 70 6f 72 74 54 6f 70 6f  poGeo_ExportTopo
60c0: 4c 61 79 65 72 28 27 63 65 6e 73 75 73 32 30 31  Layer('census201
60d0: 31 27 2c 20 27 70 72 6f 76 27 2c 20 27 6f 75 74  1', 'prov', 'out
60e0: 5f 70 72 6f 76 5f 32 30 31 31 27 2c 20 31 29 3b  _prov_2011', 1);
60f0: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 57  ..</verbatim>..W
6100: 65 27 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 62 79  e'll continue by
6110: 20 65 78 70 6f 72 74 69 6e 67 20 61 6c 6c 20 74   exporting all t
6120: 68 65 20 54 75 73 63 61 6e 79 20 50 72 6f 76 69  he Tuscany Provi
6130: 6e 63 65 73 2e 0d 0a 3c 2f 74 64 3e 3c 74 64 3e  nces...</td><td>
6140: 0d 0a 3c 69 6d 67 20 73 72 63 3d 22 68 74 74 70  ..<img src="http
6150: 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73  s://www.gaia-gis
6160: 2e 69 74 2f 67 61 69 61 2d 73 69 6e 73 2f 74 6f  .it/gaia-sins/to
6170: 70 6f 66 69 67 73 2f 74 6f 70 6f 6c 61 79 65 72  pofigs/topolayer
6180: 2d 70 72 6f 76 69 6e 63 65 73 2e 70 6e 67 22 20  -provinces.png" 
6190: 61 6c 74 3d 22 74 6f 70 6f 6c 61 79 65 72 2d 70  alt="topolayer-p
61a0: 72 6f 76 69 6e 63 65 73 22 3e 0d 0a 3c 2f 74 64  rovinces">..</td
61b0: 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e  ></tr>..<tr><td>
61c0: 0d 0a 3c 62 3e 73 74 65 70 20 23 33 3a 20 65 78  ..<b>step #3: ex
61d0: 70 6f 72 74 69 6e 67 20 74 68 65 20 4d 75 6e 69  porting the Muni
61e0: 63 69 70 61 6c 69 74 69 65 73 20 54 6f 70 6f 4c  cipalities TopoL
61f0: 61 79 65 72 3c 2f 62 3e 0d 0a 3c 76 65 72 62 61  ayer</b>..<verba
6200: 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 54 6f 70  tim>..SELECT Top
6210: 6f 47 65 6f 5f 45 78 70 6f 72 74 54 6f 70 6f 4c  oGeo_ExportTopoL
6220: 61 79 65 72 28 27 63 65 6e 73 75 73 32 30 31 31  ayer('census2011
6230: 27 2c 20 27 63 6f 6d 27 2c 20 27 6f 75 74 5f 63  ', 'com', 'out_c
6240: 6f 6d 5f 32 30 31 31 27 2c 20 31 29 3b 0d 0a 3c  om_2011', 1);..<
6250: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 54 68 65 6e  /verbatim>..Then
6260: 20 77 65 27 6c 6c 20 65 78 70 6f 72 74 20 61 6c   we'll export al
6270: 6c 20 74 68 65 20 54 75 73 63 61 6e 79 20 4d 75  l the Tuscany Mu
6280: 6e 69 63 69 70 61 6c 69 74 69 65 73 2e 3c 62 72  nicipalities.<br
6290: 3e 0d 0a 46 6f 72 20 62 65 74 74 65 72 20 63 6c  >..For better cl
62a0: 61 72 69 74 79 20 74 68 65 20 66 69 67 75 72 65  arity the figure
62b0: 20 73 68 6f 77 73 20 61 20 6d 61 67 6e 69 66 69   shows a magnifi
62c0: 65 64 20 64 65 74 61 69 6c 20 63 65 6e 74 65 72  ed detail center
62d0: 65 64 20 61 72 6f 75 6e 64 20 74 68 65 20 49 73  ed around the Is
62e0: 6c 61 6e 64 20 6f 66 20 45 6c 62 61 2e 0d 0a 3c  land of Elba...<
62f0: 2f 74 64 3e 3c 74 64 3e 0d 0a 3c 69 6d 67 20 73  /td><td>..<img s
6300: 72 63 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e  rc="https://www.
6310: 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61  gaia-gis.it/gaia
6320: 2d 73 69 6e 73 2f 74 6f 70 6f 66 69 67 73 2f 74  -sins/topofigs/t
6330: 6f 70 6f 6c 61 79 65 72 2d 6d 75 6e 69 63 69 70  opolayer-municip
6340: 61 6c 69 74 69 65 73 2e 70 6e 67 22 20 61 6c 74  alities.png" alt
6350: 3d 22 74 6f 70 6f 6c 61 79 65 72 2d 6d 75 6e 69  ="topolayer-muni
6360: 63 69 70 61 6c 69 74 69 65 73 22 3e 0d 0a 3c 2f  cipalities">..</
6370: 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74  td></tr>..<tr><t
6380: 64 3e 0d 0a 3c 62 3e 73 74 65 70 20 23 34 3a 20  d>..<b>step #4: 
6390: 65 78 70 6f 72 74 69 6e 67 20 74 68 65 20 50 6f  exporting the Po
63a0: 70 75 6c 61 74 65 64 20 50 6c 61 63 65 73 20 54  pulated Places T
63b0: 6f 70 6f 4c 61 79 65 72 3c 2f 62 3e 0d 0a 3c 76  opoLayer</b>..<v
63c0: 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54  erbatim>..SELECT
63d0: 20 54 6f 70 6f 47 65 6f 5f 45 78 70 6f 72 74 54   TopoGeo_ExportT
63e0: 6f 70 6f 4c 61 79 65 72 28 27 63 65 6e 73 75 73  opoLayer('census
63f0: 32 30 31 31 27 2c 20 27 70 70 6c 27 2c 20 27 6f  2011', 'ppl', 'o
6400: 75 74 5f 70 70 6c 5f 32 30 31 31 27 2c 20 31 29  ut_ppl_2011', 1)
6410: 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a  ;..</verbatim>..
6420: 41 6e 64 20 77 65 27 6c 6c 20 66 69 6e 61 6c 6c  And we'll finall
6430: 79 20 65 78 70 6f 72 74 20 61 6c 6c 20 50 6f 70  y export all Pop
6440: 75 6c 61 74 65 64 20 50 6c 61 63 65 73 2e 3c 62  ulated Places.<b
6450: 72 3e 3c 62 72 3e 3c 62 72 3e 3c 62 72 3e 0d 0a  r><br><br><br>..
6460: 3c 75 3e 43 6f 6e 63 6c 75 73 69 6f 6e 3c 2f 75  <u>Conclusion</u
6470: 3e 3a 20 77 65 20 73 74 61 72 74 65 64 20 74 68  >: we started th
6480: 69 73 20 61 64 76 61 6e 63 65 64 20 74 75 74 6f  is advanced tuto
6490: 72 69 61 6c 20 62 79 20 69 6d 70 6f 72 74 69 6e  rial by importin
64a0: 67 20 69 6e 74 6f 20 61 20 54 6f 70 6f 6c 6f 67  g into a Topolog
64b0: 79 20 6a 75 73 74 20 61 20 73 69 6e 67 6c 65 20  y just a single 
64c0: 6c 61 79 65 72 20 28 43 65 6e 73 75 73 20 41 72  layer (Census Ar
64d0: 65 61 73 29 20 61 6e 64 20 6e 6f 77 20 77 65 27  eas) and now we'
64e0: 76 65 20 66 69 6e 69 73 68 65 64 20 62 79 20 70  ve finished by p
64f0: 72 6f 64 75 63 69 6e 67 20 61 20 63 6f 6d 70 6c  roducing a compl
6500: 65 74 65 20 73 65 74 20 6f 66 20 61 64 6d 69 6e  ete set of admin
6510: 69 73 74 72 61 74 69 76 65 20 62 6f 75 6e 64 61  istrative bounda
6520: 72 69 65 73 20 61 74 20 64 69 66 66 65 72 65 6e  ries at differen
6530: 74 20 68 69 65 72 61 72 63 68 69 63 61 6c 20 6c  t hierarchical l
6540: 65 76 65 6c 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c  evels:..<ul>..<l
6550: 69 3e 50 6f 70 75 6c 61 74 65 64 20 50 6c 61 63  i>Populated Plac
6560: 65 73 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 4d 75 6e  es</li>..<li>Mun
6570: 69 63 69 70 61 6c 69 74 69 65 73 3c 2f 6c 69 3e  icipalities</li>
6580: 0d 0a 3c 6c 69 3e 50 72 6f 76 69 6e 63 65 73 3c  ..<li>Provinces<
6590: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 52 65 67 69 6f 6e  /li>..<li>Region
65a0: 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f  </li>..</ul>..</
65b0: 74 64 3e 3c 74 64 3e 0d 0a 3c 69 6d 67 20 73 72  td><td>..<img sr
65c0: 63 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67  c="https://www.g
65d0: 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d  aia-gis.it/gaia-
65e0: 73 69 6e 73 2f 74 6f 70 6f 66 69 67 73 2f 74 6f  sins/topofigs/to
65f0: 70 6f 6c 61 79 65 72 2d 70 6f 70 75 6c 61 74 65  polayer-populate
6600: 64 2d 70 6c 61 63 65 73 2e 70 6e 67 22 20 61 6c  d-places.png" al
6610: 74 3d 22 74 6f 70 6f 6c 61 79 65 72 2d 70 6f 70  t="topolayer-pop
6620: 75 6c 61 74 65 64 2d 70 6c 61 63 65 73 22 3e 0d  ulated-places">.
6630: 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74  .</td></tr>..</t
6640: 61 62 6c 65 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 0d  able><br>..<hr>.
6650: 0a 3c 61 20 6e 61 6d 65 3d 22 6f 6c 64 2d 6e 65  .<a name="old-ne
6660: 77 2d 4d 75 6e 69 63 69 70 61 6c 69 74 69 65 73  w-Municipalities
6670: 22 3e 0d 0a 3c 68 33 3e 52 65 63 65 6e 74 20 63  ">..<h3>Recent c
6680: 68 61 6e 67 65 73 3a 20 6f 6c 64 20 4d 75 6e 69  hanges: old Muni
6690: 63 69 70 61 6c 69 74 69 65 73 20 6d 65 72 67 69  cipalities mergi
66a0: 6e 67 20 69 6e 74 6f 20 6e 65 77 20 4d 75 6e 69  ng into new Muni
66b0: 63 69 70 61 6c 69 74 69 65 73 3c 2f 68 33 3e 3c  cipalities</h3><
66c0: 2f 61 3e 0d 0a 49 66 20 79 6f 75 20 72 65 6d 65  /a>..If you reme
66d0: 6d 62 65 72 20 74 68 65 20 69 6e 69 74 69 61 6c  mber the initial
66e0: 20 3c 62 3e 74 75 73 63 61 6e 79 2d 63 65 6e 73   <b>tuscany-cens
66f0: 75 73 2d 32 30 31 31 2e 73 71 6c 69 74 65 3c 2f  us-2011.sqlite</
6700: 62 3e 20 44 42 2d 66 69 6c 65 20 63 6f 6e 74 61  b> DB-file conta
6710: 69 6e 73 20 61 20 3c 62 3e 63 6f 6d 5f 32 30 31  ins a <b>com_201
6720: 34 5f 31 35 3c 2f 62 3e 20 54 61 62 6c 65 3b 20  4_15</b> Table; 
6730: 64 75 72 69 6e 67 20 79 65 61 72 73 20 32 30 31  during years 201
6740: 34 20 61 6e 64 20 32 30 31 35 20 66 65 77 20 4d  4 and 2015 few M
6750: 75 6e 69 63 69 70 61 6c 69 74 69 65 73 20 6d 65  unicipalities me
6760: 72 67 65 64 20 74 77 6f 20 62 79 20 74 77 6f 20  rged two by two 
6770: 74 68 75 73 20 67 69 76 69 6e 67 20 62 69 72 74  thus giving birt
6780: 68 20 74 6f 20 6e 65 77 20 4d 75 6e 69 63 69 70  h to new Municip
6790: 61 6c 69 74 69 65 73 2e 20 54 68 69 73 20 69 73  alities. This is
67a0: 20 74 68 65 20 66 75 6c 6c 20 6c 69 73 74 3a 3c   the full list:<
67b0: 62 72 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20  br><br>..<table 
67c0: 63 65 6c 6c 73 70 61 6e 3d 22 34 22 20 63 65 6c  cellspan="4" cel
67d0: 6c 70 61 64 64 69 6e 67 3d 22 36 22 20 62 67 63  lpadding="6" bgc
67e0: 6f 6c 6f 72 3d 22 23 66 38 66 38 66 30 22 20 62  olor="#f8f8f0" b
67f0: 6f 72 64 65 72 3d 22 31 22 3e 0d 0a 3c 74 72 3e  order="1">..<tr>
6800: 3c 74 64 20 63 6f 6c 73 70 61 6e 3d 22 33 22 20  <td colspan="3" 
6810: 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 20 62  align="center" b
6820: 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 22  gcolor="#f0f0f8"
6830: 3e 3c 62 3e 4e 65 77 20 4d 75 6e 69 63 69 70 61  ><b>New Municipa
6840: 6c 69 74 79 20 28 32 30 31 34 2f 31 35 29 3c 2f  lity (2014/15)</
6850: 62 3e 3c 2f 74 64 3e 3c 74 64 20 63 6f 6c 73 70  b></td><td colsp
6860: 61 6e 3d 22 32 22 20 61 6c 69 67 6e 3d 22 63 65  an="2" align="ce
6870: 6e 74 65 72 22 20 20 62 67 63 6f 6c 6f 72 3d 22  nter"  bgcolor="
6880: 23 66 30 66 38 66 38 22 3e 3c 62 3e 73 75 70 70  #f0f8f8"><b>supp
6890: 72 65 73 73 65 64 20 23 31 3c 2f 62 3e 3c 2f 74  ressed #1</b></t
68a0: 64 3e 3c 74 64 20 63 6f 6c 73 70 61 6e 3d 22 32  d><td colspan="2
68b0: 22 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22  " align="center"
68c0: 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66 30 66   bgcolor="#f8f0f
68d0: 38 22 3e 3c 62 3e 73 75 70 70 72 65 73 73 65 64  8"><b>suppressed
68e0: 20 23 32 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f 74 72   #2</b></td></tr
68f0: 3e 0d 0a 3c 74 72 3e 3c 74 64 20 62 67 63 6f 6c  >..<tr><td bgcol
6900: 6f 72 3d 22 23 66 30 66 30 66 38 22 3e 3c 62 3e  or="#f0f0f8"><b>
6910: 63 6f 64 5f 70 72 6f 76 3c 2f 62 3e 3c 2f 74 64  cod_prov</b></td
6920: 3e 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66  ><td bgcolor="#f
6930: 30 66 30 66 38 22 3e 3c 62 3e 63 6f 64 5f 63 6f  0f0f8"><b>cod_co
6940: 6d 3c 2f 62 3e 3c 2f 74 64 3e 3c 74 64 20 62 67  m</b></td><td bg
6950: 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 22 3e  color="#f0f0f8">
6960: 3c 62 3e 6e 61 6d 65 3c 2f 62 3e 3c 2f 74 64 3e  <b>name</b></td>
6970: 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30  <td bgcolor="#f0
6980: 66 38 66 38 22 3e 3c 62 3e 63 6f 64 5f 63 6f 6d  f8f8"><b>cod_com
6990: 3c 2f 62 3e 3c 2f 74 64 3e 3c 74 64 20 62 67 63  </b></td><td bgc
69a0: 6f 6c 6f 72 3d 22 23 66 30 66 38 66 38 22 3e 3c  olor="#f0f8f8"><
69b0: 62 3e 6e 61 6d 65 3c 2f 62 3e 3c 2f 74 64 3e 3c  b>name</b></td><
69c0: 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66  td bgcolor="#f8f
69d0: 30 66 38 22 3e 3c 62 3e 63 6f 64 5f 63 6f 6d 3c  0f8"><b>cod_com<
69e0: 2f 62 3e 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f  /b></td><td bgco
69f0: 6c 6f 72 3d 22 23 66 38 66 30 66 38 22 3e 3c 62  lor="#f8f0f8"><b
6a00: 3e 6e 61 6d 65 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f  >name</b></td></
6a10: 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 41 52 3c  tr>..<tr><td>AR<
6a20: 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72  /td><td align="r
6a30: 69 67 68 74 22 3e 35 31 30 34 30 3c 2f 74 64 3e  ight">51040</td>
6a40: 3c 74 64 3e 43 61 73 74 65 6c 66 72 61 6e 63 6f  <td>Castelfranco
6a50: 20 50 69 61 6e 64 69 73 63 c3 b2 3c 2f 74 64 3e   Piandisc..</td>
6a60: 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30  <td bgcolor="#f0
6a70: 66 38 66 38 22 20 61 6c 69 67 6e 3d 22 72 69 67  f8f8" align="rig
6a80: 68 74 22 3e 35 31 30 30 39 3c 2f 74 64 20 62 67  ht">51009</td bg
6a90: 63 6f 6c 6f 72 3d 22 23 66 30 66 38 66 38 22 3e  color="#f0f8f8">
6aa0: 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30  <td bgcolor="#f0
6ab0: 66 38 66 38 22 3e 43 61 73 74 65 6c 66 72 61 6e  f8f8">Castelfran
6ac0: 63 6f 20 64 69 20 53 6f 70 72 61 3c 2f 74 64 3e  co di Sopra</td>
6ad0: 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38  <td bgcolor="#f8
6ae0: 66 30 66 38 22 20 61 6c 69 67 6e 3d 22 72 69 67  f0f8" align="rig
6af0: 68 74 22 3e 35 31 30 32 39 3c 2f 74 64 3e 3c 74  ht">51029</td><t
6b00: 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66 30  d bgcolor="#f8f0
6b10: 66 38 22 3e 50 69 61 6e 20 64 69 20 53 63 6f 3c  f8">Pian di Sco<
6b20: 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c  /td></tr>..<tr><
6b30: 74 64 3e 41 52 3c 2f 74 64 3e 3c 74 64 20 61 6c  td>AR</td><td al
6b40: 69 67 6e 3d 22 72 69 67 68 74 22 3e 35 31 30 34  ign="right">5104
6b50: 31 3c 2f 74 64 3e 3c 74 64 3e 50 72 61 74 6f 76  1</td><td>Pratov
6b60: 65 63 63 68 69 6f 20 53 74 69 61 3c 2f 74 64 3e  ecchio Stia</td>
6b70: 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30  <td bgcolor="#f0
6b80: 66 38 66 38 22 20 61 6c 69 67 6e 3d 22 72 69 67  f8f8" align="rig
6b90: 68 74 22 3e 35 31 30 33 32 3c 2f 74 64 3e 3c 74  ht">51032</td><t
6ba0: 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 38  d bgcolor="#f0f8
6bb0: 66 38 22 3e 50 72 61 74 6f 76 65 63 63 68 69 6f  f8">Pratovecchio
6bc0: 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f 72  </td><td bgcolor
6bd0: 3d 22 23 66 38 66 30 66 38 22 20 61 6c 69 67 6e  ="#f8f0f8" align
6be0: 3d 22 72 69 67 68 74 22 3e 35 31 30 33 36 3c 2f  ="right">51036</
6bf0: 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22  td><td bgcolor="
6c00: 23 66 38 66 30 66 38 22 3e 53 74 69 61 3c 2f 74  #f8f0f8">Stia</t
6c10: 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64  d></tr>..<tr><td
6c20: 3e 46 49 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67  >FI</td><td alig
6c30: 6e 3d 22 72 69 67 68 74 22 3e 34 38 30 35 32 3c  n="right">48052<
6c40: 2f 74 64 3e 3c 74 64 3e 46 69 67 6c 69 6e 65 20  /td><td>Figline 
6c50: 65 20 49 6e 63 69 73 61 20 56 61 6c 64 61 72 6e  e Incisa Valdarn
6c60: 6f 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f  o</td><td bgcolo
6c70: 72 3d 22 23 66 30 66 38 66 38 22 20 61 6c 69 67  r="#f0f8f8" alig
6c80: 6e 3d 22 72 69 67 68 74 22 3e 34 38 30 31 36 3c  n="right">48016<
6c90: 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f 72 3d  /td><td bgcolor=
6ca0: 22 23 66 30 66 38 66 38 22 3e 46 69 67 6c 69 6e  "#f0f8f8">Figlin
6cb0: 65 20 56 61 6c 64 61 72 6e 6f 3c 2f 74 64 3e 3c  e Valdarno</td><
6cc0: 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66  td bgcolor="#f8f
6cd0: 30 66 38 22 20 61 6c 69 67 6e 3d 22 72 69 67 68  0f8" align="righ
6ce0: 74 22 3e 34 38 30 32 33 3c 2f 74 64 3e 3c 74 64  t">48023</td><td
6cf0: 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66 30 66   bgcolor="#f8f0f
6d00: 38 22 3e 49 6e 63 69 73 61 20 69 6e 20 56 61 6c  8">Incisa in Val
6d10: 20 64 27 41 72 6e 6f 3c 2f 74 64 3e 3c 2f 74 72   d'Arno</td></tr
6d20: 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 46 49 3c 2f 74  >..<tr><td>FI</t
6d30: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67  d><td align="rig
6d40: 68 74 22 3e 34 38 30 35 33 3c 2f 74 64 3e 3c 74  ht">48053</td><t
6d50: 64 3e 53 63 61 72 70 65 72 69 61 20 65 20 53 61  d>Scarperia e Sa
6d60: 6e 20 50 69 65 72 6f 3c 2f 74 64 3e 3c 74 64 20  n Piero</td><td 
6d70: 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 38 66 38  bgcolor="#f0f8f8
6d80: 22 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  " align="right">
6d90: 34 38 30 34 32 3c 2f 74 64 3e 3c 74 64 20 62 67  48042</td><td bg
6da0: 63 6f 6c 6f 72 3d 22 23 66 30 66 38 66 38 22 3e  color="#f0f8f8">
6db0: 53 63 61 72 70 65 72 69 61 3c 2f 74 64 3e 3c 74  Scarperia</td><t
6dc0: 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66 30  d bgcolor="#f8f0
6dd0: 66 38 22 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  f8" align="right
6de0: 22 3e 34 38 30 34 30 3c 2f 74 64 3e 3c 74 64 20  ">48040</td><td 
6df0: 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66 30 66 38  bgcolor="#f8f0f8
6e00: 22 3e 53 61 6e 20 50 69 65 72 6f 20 61 20 53 69  ">San Piero a Si
6e10: 65 76 65 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c  eve</td></tr>..<
6e20: 74 72 3e 3c 74 64 3e 4c 55 3c 2f 74 64 3e 3c 74  tr><td>LU</td><t
6e30: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e  d align="right">
6e40: 34 36 30 33 36 3c 2f 74 64 3e 3c 74 64 3e 46 61  46036</td><td>Fa
6e50: 62 62 72 69 63 68 65 20 64 69 20 56 65 72 67 65  bbriche di Verge
6e60: 6d 6f 6c 69 3c 2f 74 64 3e 3c 74 64 20 20 62 67  moli</td><td  bg
6e70: 63 6f 6c 6f 72 3d 22 23 66 30 66 38 66 38 22 20  color="#f0f8f8" 
6e80: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 34 36  align="right">46
6e90: 30 31 32 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f  012</td><td bgco
6ea0: 6c 6f 72 3d 22 23 66 30 66 38 66 38 22 3e 46 61  lor="#f0f8f8">Fa
6eb0: 62 62 72 69 63 68 65 20 64 69 20 56 61 6c 6c 69  bbriche di Valli
6ec0: 63 6f 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c  co</td><td bgcol
6ed0: 6f 72 3d 22 23 66 38 66 30 66 38 22 20 61 6c 69  or="#f8f0f8" ali
6ee0: 67 6e 3d 22 72 69 67 68 74 22 3e 34 36 30 33 32  gn="right">46032
6ef0: 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f 72  </td><td bgcolor
6f00: 3d 22 23 66 38 66 30 66 38 22 3e 56 65 72 67 65  ="#f8f0f8">Verge
6f10: 6d 6f 6c 69 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a  moli</td></tr>..
6f20: 3c 74 72 3e 3c 74 64 3e 4c 55 3c 2f 74 64 3e 3c  <tr><td>LU</td><
6f30: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22  td align="right"
6f40: 3e 34 36 30 33 37 3c 2f 74 64 3e 3c 74 64 3e 53  >46037</td><td>S
6f50: 69 6c 6c 61 6e 6f 20 47 69 75 6e 63 75 67 6e 61  illano Giuncugna
6f60: 6e 6f 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c  no</td><td bgcol
6f70: 6f 72 3d 22 23 66 30 66 38 66 38 22 61 6c 69 67  or="#f0f8f8"alig
6f80: 6e 3d 22 72 69 67 68 74 22 3e 34 36 30 32 39 3c  n="right">46029<
6f90: 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f 72 3d  /td><td bgcolor=
6fa0: 22 23 66 30 66 38 66 38 22 3e 53 69 6c 6c 61 6e  "#f0f8f8">Sillan
6fb0: 6f 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f  o</td><td bgcolo
6fc0: 72 3d 22 23 66 38 66 30 66 38 22 20 61 6c 69 67  r="#f8f0f8" alig
6fd0: 6e 3d 22 72 69 67 68 74 22 3e 34 36 30 31 36 3c  n="right">46016<
6fe0: 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f 72 3d  /td><td bgcolor=
6ff0: 22 23 66 38 66 30 66 38 22 3e 47 69 75 6e 63 75  "#f8f0f8">Giuncu
7000: 67 6e 61 6e 6f 3c 2f 74 64 3e 3c 2f 74 72 3e 0d  gnano</td></tr>.
7010: 0a 3c 74 72 3e 3c 74 64 3e 50 49 3c 2f 74 64 3e  .<tr><td>PI</td>
7020: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74  <td align="right
7030: 22 3e 35 30 30 35 30 3c 2f 74 64 3e 3c 74 64 3e  ">50050</td><td>
7040: 43 61 73 63 69 61 6e 61 20 54 65 72 6d 65 20 4c  Casciana Terme L
7050: 61 72 69 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f  ari</td><td bgco
7060: 6c 6f 72 3d 22 23 66 30 66 38 66 38 22 20 61 6c  lor="#f0f8f8" al
7070: 69 67 6e 3d 22 72 69 67 68 74 22 3e 35 30 30 30  ign="right">5000
7080: 37 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c 6f  7</td><td bgcolo
7090: 72 3d 22 23 66 30 66 38 66 38 22 3e 43 61 73 63  r="#f0f8f8">Casc
70a0: 69 61 6e 61 20 54 65 72 6d 65 3c 2f 74 64 3e 3c  iana Terme</td><
70b0: 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66  td bgcolor="#f8f
70c0: 30 66 38 22 20 61 6c 69 67 6e 3d 22 72 69 67 68  0f8" align="righ
70d0: 74 22 3e 35 30 30 31 37 3c 2f 74 64 3e 3c 74 64  t">50017</td><td
70e0: 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66 30 66   bgcolor="#f8f0f
70f0: 38 22 3e 4c 61 72 69 3c 2f 74 64 3e 3c 2f 74 72  8">Lari</td></tr
7100: 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 50 49 3c 2f 74  >..<tr><td>PI</t
7110: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67  d><td align="rig
7120: 68 74 22 3e 35 30 30 34 31 3c 2f 74 64 3e 3c 74  ht">50041</td><t
7130: 64 3e 43 72 65 73 70 69 6e 61 20 4c 6f 72 65 6e  d>Crespina Loren
7140: 7a 61 6e 61 3c 2f 74 64 3e 3c 74 64 20 62 67 63  zana</td><td bgc
7150: 6f 6c 6f 72 3d 22 23 66 30 66 38 66 38 22 20 61  olor="#f0f8f8" a
7160: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 35 30 30  lign="right">500
7170: 31 33 3c 2f 74 64 3e 3c 74 64 20 62 67 63 6f 6c  13</td><td bgcol
7180: 6f 72 3d 22 23 66 30 66 38 66 38 22 3e 43 72 65  or="#f0f8f8">Cre
7190: 73 70 69 6e 61 3c 2f 74 64 3e 3c 74 64 20 20 62  spina</td><td  b
71a0: 67 63 6f 6c 6f 72 3d 22 23 66 38 66 30 66 38 22  gcolor="#f8f0f8"
71b0: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 35   align="right">5
71c0: 30 30 31 38 3c 2f 74 64 3e 3c 74 64 20 62 67 63  0018</td><td bgc
71d0: 6f 6c 6f 72 3d 22 23 66 38 66 30 66 38 22 3e 4c  olor="#f8f0f8">L
71e0: 6f 72 65 6e 7a 61 6e 61 3c 2f 74 64 3e 3c 2f 74  orenzana</td></t
71f0: 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62  r>..</table>..<b
7200: 72 3e 0d 0a 53 75 63 68 20 63 68 61 6e 67 65 73  r>..Such changes
7210: 20 73 69 6d 70 6c 79 20 61 66 66 65 63 74 73 20   simply affects 
7220: 4d 75 6e 69 63 69 70 61 6c 69 74 69 65 73 3b 20  Municipalities; 
7230: 50 72 6f 76 69 6e 63 65 73 20 61 72 65 20 75 6e  Provinces are un
7240: 61 66 66 65 63 74 65 64 20 62 79 20 74 68 69 73  affected by this
7250: 20 70 72 6f 63 65 73 73 3b 20 73 6f 20 77 65 20   process; so we 
7260: 63 61 6e 20 6e 6f 77 20 64 75 6c 79 20 67 65 6e  can now duly gen
7270: 65 72 61 74 65 20 61 20 66 75 72 74 68 65 72 20  erate a further 
7280: 6c 61 79 65 72 20 63 6f 72 72 65 73 70 6f 6e 64  layer correspond
7290: 69 6e 67 20 74 6f 20 32 30 31 35 20 4d 75 6e 69  ing to 2015 Muni
72a0: 63 69 70 61 6c 69 74 69 65 73 2c 20 61 6e 64 20  cipalities, and 
72b0: 77 65 20 73 69 6d 70 6c 79 20 68 61 76 65 20 74  we simply have t
72c0: 6f 20 73 6c 69 67 68 74 6c 79 20 72 65 61 72 72  o slightly rearr
72d0: 61 6e 67 65 20 74 68 65 20 54 6f 70 6f 4c 61 79  ange the TopoLay
72e0: 65 72 73 2f 54 6f 70 6f 46 65 61 74 75 72 65 73  ers/TopoFeatures
72f0: 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 69 6e 20   definitions in 
7300: 6f 72 64 65 72 20 74 6f 20 61 63 68 69 65 76 65  order to achieve
7310: 20 74 68 69 73 20 66 75 72 74 68 65 72 20 67 6f   this further go
7320: 61 6c 2e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d  al...<verbatim>.
7330: 0a 41 54 54 41 43 48 20 44 41 54 41 42 41 53 45  .ATTACH DATABASE
7340: 20 22 2e 2f 74 75 73 63 61 6e 79 2d 63 65 6e 73   "./tuscany-cens
7350: 75 73 2d 32 30 31 31 2e 73 71 6c 69 74 65 22 20  us-2011.sqlite" 
7360: 41 53 20 69 73 74 61 74 3b 0d 0a 0d 0a 43 52 45  AS istat;....CRE
7370: 41 54 45 20 54 41 42 4c 45 20 63 6f 6d 32 30 31  ATE TABLE com201
7380: 35 20 41 53 0d 0a 53 45 4c 45 43 54 20 2a 20 46  5 AS..SELECT * F
7390: 52 4f 4d 20 69 73 74 61 74 2e 70 6f 70 5f 63 6f  ROM istat.pop_co
73a0: 6d 5f 32 30 31 31 3b 0d 0a 0d 0a 49 4e 53 45 52  m_2011;....INSER
73b0: 54 20 49 4e 54 4f 20 63 6f 6d 32 30 31 35 0d 0a  T INTO com2015..
73c0: 53 45 4c 45 43 54 20 61 2e 63 6f 64 5f 63 6f 6d  SELECT a.cod_com
73d0: 2c 20 61 2e 63 6f 64 5f 70 72 6f 76 2c 20 61 2e  , a.cod_prov, a.
73e0: 63 6f 64 5f 69 73 74 61 74 2c 20 61 2e 63 6f 64  cod_istat, a.cod
73f0: 5f 63 61 64 61 73 74 72 65 2c 20 61 2e 6e 61 6d  _cadastre, a.nam
7400: 65 2c 20 61 2e 74 6f 77 6e 68 61 6c 6c 5f 61 64  e, a.townhall_ad
7410: 64 72 2c 0d 0a 20 20 20 20 53 75 6d 28 62 2e 70  dr,..    Sum(b.p
7420: 6f 70 5f 32 30 31 31 29 2c 20 53 75 6d 28 62 2e  op_2011), Sum(b.
7430: 6d 5f 32 30 31 31 29 2c 20 53 75 6d 28 62 2e 66  m_2011), Sum(b.f
7440: 5f 32 30 31 31 29 0d 0a 46 52 4f 4d 20 69 73 74  _2011)..FROM ist
7450: 61 74 2e 63 6f 6d 5f 32 30 31 34 5f 31 35 20 41  at.com_2014_15 A
7460: 53 20 61 0d 0a 4a 4f 49 4e 20 69 73 74 61 74 2e  S a..JOIN istat.
7470: 70 6f 70 5f 63 6f 6d 5f 32 30 31 31 20 41 53 20  pop_com_2011 AS 
7480: 62 20 4f 4e 20 28 62 2e 63 6f 64 5f 63 6f 6d 20  b ON (b.cod_com 
7490: 49 4e 20 28 61 2e 6f 6c 64 5f 63 6f 64 5f 63 6f  IN (a.old_cod_co
74a0: 6d 5f 31 2c 20 61 2e 6f 6c 64 5f 63 6f 64 5f 63  m_1, a.old_cod_c
74b0: 6f 6d 5f 32 29 29 0d 0a 47 52 4f 55 50 20 42 59  om_2))..GROUP BY
74c0: 20 61 2e 63 6f 64 5f 63 6f 6d 3b 0d 0a 0d 0a 44   a.cod_com;....D
74d0: 45 54 41 43 48 20 44 41 54 41 42 41 53 45 20 69  ETACH DATABASE i
74e0: 73 74 61 74 3b 0d 0a 3c 2f 76 65 72 62 61 74 69  stat;..</verbati
74f0: 6d 3e 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e 77 65  m>..<ol>..<li>we
7500: 27 6c 6c 20 3c 69 3e 61 74 74 61 63 68 3c 2f 69  'll <i>attach</i
7510: 3e 20 79 65 74 20 61 6e 6f 74 68 65 72 20 74 69  > yet another ti
7520: 6d 65 20 74 68 65 20 69 6e 69 74 69 61 6c 20 3c  me the initial <
7530: 62 3e 74 75 73 63 61 6e 79 2d 63 65 6e 73 75 73  b>tuscany-census
7540: 2d 32 30 31 31 2e 73 71 6c 69 74 65 3c 2f 62 3e  -2011.sqlite</b>
7550: 20 44 42 2d 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a   DB-file.</li>..
7560: 3c 6c 69 3e 77 65 27 6c 6c 20 63 72 65 61 74 65  <li>we'll create
7570: 20 61 20 6e 65 77 20 3c 62 3e 63 6f 6d 32 30 31   a new <b>com201
7580: 35 3c 2f 62 3e 20 74 61 62 6c 65 20 62 79 20 6a  5</b> table by j
7590: 75 73 74 20 6a 75 73 74 20 63 6f 70 79 69 6e 67  ust just copying
75a0: 20 74 68 65 20 3c 62 3e 69 73 74 61 74 2e 70 6f   the <b>istat.po
75b0: 70 5f 63 6f 6d 5f 32 30 31 31 3c 2f 62 3e 20 56  p_com_2011</b> V
75c0: 69 65 77 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61  iew.</li>..<li>a
75d0: 6e 64 20 66 69 6e 61 6c 6c 79 20 77 65 27 6c 6c  nd finally we'll
75e0: 20 61 70 70 65 6e 64 20 74 6f 20 74 68 65 20 73   append to the s
75f0: 61 6d 65 20 74 61 62 6c 65 20 74 68 65 20 6e 65  ame table the ne
7600: 77 20 4d 75 6e 69 63 69 70 61 6c 69 74 69 65 73  w Municipalities
7610: 20 66 72 6f 6d 20 74 68 65 20 3c 62 3e 69 73 74   from the <b>ist
7620: 61 74 2e 63 6f 6d 5f 32 30 31 34 5f 31 35 3c 2f  at.com_2014_15</
7630: 62 3e 20 74 61 62 6c 65 3b 20 64 75 72 69 6e 67  b> table; during
7640: 20 74 68 69 73 20 73 74 65 70 20 77 65 27 6c 6c   this step we'll
7650: 20 63 6f 6d 70 75 74 65 20 74 68 65 20 50 6f 70   compute the Pop
7660: 75 6c 61 74 69 6f 6e 20 32 30 31 31 20 63 65 6e  ulation 2011 cen
7670: 73 75 73 20 76 61 6c 75 65 73 2e 3c 62 72 3e 0d  sus values.<br>.
7680: 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 61 66  .<u>Note</u>: af
7690: 74 65 72 20 63 6f 6d 70 6c 65 74 69 6e 67 20 74  ter completing t
76a0: 68 65 20 61 62 6f 76 65 20 73 74 65 70 73 20 6e  he above steps n
76b0: 6f 77 20 74 68 65 20 3c 62 3e 63 6f 6d 32 30 31  ow the <b>com201
76c0: 35 3c 2f 62 3e 20 74 61 62 6c 65 20 63 6f 6e 74  5</b> table cont
76d0: 61 69 6e 73 20 62 6f 74 68 20 73 75 70 70 72 65  ains both suppre
76e0: 73 73 65 64 20 61 6e 64 20 6e 65 77 20 4d 75 6e  ssed and new Mun
76f0: 69 63 69 70 61 6c 69 74 69 65 73 3c 2f 6c 69 3e  icipalities</li>
7700: 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c 76 65 72 62 61 74  ..</ol>..<verbat
7710: 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 54 6f 70 6f  im>..SELECT Topo
7720: 47 65 6f 5f 49 6e 69 74 54 6f 70 6f 4c 61 79 65  Geo_InitTopoLaye
7730: 72 28 27 63 65 6e 73 75 73 32 30 31 31 27 2c 20  r('census2011', 
7740: 4e 55 4c 4c 2c 20 27 63 6f 6d 32 30 31 35 27 2c  NULL, 'com2015',
7750: 20 27 63 6f 6d 32 30 31 35 27 29 3b 0d 0a 0d 0a   'com2015');....
7760: 49 4e 53 45 52 54 20 49 4e 54 4f 20 63 65 6e 73  INSERT INTO cens
7770: 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75  us2011_topofeatu
7780: 72 65 73 0d 0a 53 45 4c 45 43 54 20 4e 55 4c 4c  res..SELECT NULL
7790: 2c 20 61 2e 6e 6f 64 65 5f 69 64 2c 20 61 2e 65  , a.node_id, a.e
77a0: 64 67 65 5f 69 64 2c 20 61 2e 66 61 63 65 5f 69  dge_id, a.face_i
77b0: 64 2c 20 36 2c 20 61 2e 66 69 64 0d 0a 46 52 4f  d, 6, a.fid..FRO
77c0: 4d 20 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70  M census2011_top
77d0: 6f 66 65 61 74 75 72 65 73 20 41 53 20 61 0d 0a  ofeatures AS a..
77e0: 4a 4f 49 4e 20 63 65 6e 73 75 73 32 30 31 31 5f  JOIN census2011_
77f0: 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 33 20 41  topofeatures_3 A
7800: 53 20 62 20 4f 4e 20 28 61 2e 74 6f 70 6f 6c 61  S b ON (a.topola
7810: 79 65 72 5f 69 64 20 3d 20 33 20 41 4e 44 20 61  yer_id = 3 AND a
7820: 2e 66 69 64 20 3d 20 62 2e 66 69 64 29 3b 0d 0a  .fid = b.fid);..
7830: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 4e 6f 74  </verbatim>..Not
7840: 68 69 6e 67 20 72 65 61 6c 6c 79 20 69 6e 74 65  hing really inte
7850: 72 65 73 74 69 6e 67 20 69 6e 20 74 68 69 73 2c  resting in this,
7860: 20 62 65 63 61 75 73 65 20 77 65 20 61 6c 72 65   because we alre
7870: 61 64 79 20 70 65 72 66 6f 72 6d 65 64 20 74 68  ady performed th
7880: 69 73 20 73 74 65 70 20 64 75 72 69 6e 67 20 74  is step during t
7890: 68 65 20 70 72 65 76 69 6f 75 73 20 65 78 65 72  he previous exer
78a0: 63 69 73 65 2e 20 57 65 27 76 65 20 73 69 6d 70  cise. We've simp
78b0: 6c 79 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 79  ly initialized y
78c0: 65 74 20 61 6e 6f 74 68 65 72 20 54 6f 70 6f 4c  et another TopoL
78d0: 61 79 65 72 73 2c 20 61 6e 64 20 77 65 27 76 65  ayers, and we've
78e0: 20 63 6f 70 69 65 64 20 69 6e 74 6f 20 69 74 20   copied into it 
78f0: 74 68 65 20 73 61 6d 65 20 54 6f 70 6f 46 65 61  the same TopoFea
7900: 74 75 72 65 73 20 64 65 66 69 6e 69 74 69 6f 6e  tures definition
7910: 73 20 61 6c 72 65 61 64 79 20 73 75 70 70 6f 72  s already suppor
7920: 74 69 6e 67 20 32 30 31 31 20 4d 75 6e 69 63 69  ting 2011 Munici
7930: 70 61 6c 69 74 69 65 73 2e 0d 0a 3c 76 65 72 62  palities...<verb
7940: 61 74 69 6d 3e 0d 0a 55 50 44 41 54 45 20 63 65  atim>..UPDATE ce
7950: 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61  nsus2011_topofea
7960: 74 75 72 65 73 0d 0a 53 45 54 20 66 69 64 20 3d  tures..SET fid =
7970: 20 28 53 45 4c 45 43 54 20 66 69 64 20 46 52 4f   (SELECT fid FRO
7980: 4d 20 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70  M census2011_top
7990: 6f 66 65 61 74 75 72 65 73 5f 36 20 57 48 45 52  ofeatures_6 WHER
79a0: 45 20 63 6f 64 5f 63 6f 6d 20 3d 20 35 31 30 34  E cod_com = 5104
79b0: 30 29 0d 0a 57 48 45 52 45 20 74 6f 70 6f 6c 61  0)..WHERE topola
79c0: 79 65 72 5f 69 64 20 3d 20 36 20 41 4e 44 20 66  yer_id = 6 AND f
79d0: 69 64 20 49 4e 20 28 53 45 4c 45 43 54 20 66 69  id IN (SELECT fi
79e0: 64 20 46 52 4f 4d 20 63 65 6e 73 75 73 32 30 31  d FROM census201
79f0: 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 36  1_topofeatures_6
7a00: 20 57 48 45 52 45 20 63 6f 64 5f 63 6f 6d 20 69   WHERE cod_com i
7a10: 6e 20 28 35 31 30 30 39 2c 20 35 31 30 32 39 29  n (51009, 51029)
7a20: 29 3b 0d 0a 0d 0a 55 50 44 41 54 45 20 63 65 6e  );....UPDATE cen
7a30: 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74  sus2011_topofeat
7a40: 75 72 65 73 0d 0a 53 45 54 20 66 69 64 20 3d 20  ures..SET fid = 
7a50: 28 53 45 4c 45 43 54 20 66 69 64 20 46 52 4f 4d  (SELECT fid FROM
7a60: 20 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f   census2011_topo
7a70: 66 65 61 74 75 72 65 73 5f 36 20 57 48 45 52 45  features_6 WHERE
7a80: 20 63 6f 64 5f 63 6f 6d 20 3d 20 35 31 30 34 31   cod_com = 51041
7a90: 29 0d 0a 57 48 45 52 45 20 74 6f 70 6f 6c 61 79  )..WHERE topolay
7aa0: 65 72 5f 69 64 20 3d 20 36 20 41 4e 44 20 66 69  er_id = 6 AND fi
7ab0: 64 20 49 4e 20 28 53 45 4c 45 43 54 20 66 69 64  d IN (SELECT fid
7ac0: 20 46 52 4f 4d 20 63 65 6e 73 75 73 32 30 31 31   FROM census2011
7ad0: 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 36 20  _topofeatures_6 
7ae0: 57 48 45 52 45 20 63 6f 64 5f 63 6f 6d 20 69 6e  WHERE cod_com in
7af0: 20 28 35 31 30 33 32 2c 20 35 31 30 33 36 29 29   (51032, 51036))
7b00: 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a  ;..</verbatim>..
7b10: 4e 6f 77 20 77 65 27 76 65 20 73 69 6d 70 6c 79  Now we've simply
7b20: 20 75 70 64 61 74 65 64 20 61 6c 6c 20 72 65 6c   updated all rel
7b30: 61 74 69 6f 6e 73 68 69 70 73 20 62 65 74 77 65  ationships betwe
7b40: 65 6e 20 54 6f 70 6f 6c 6f 67 79 20 46 61 63 65  en Topology Face
7b50: 73 20 61 6e 64 20 54 6f 70 6f 46 65 61 74 75 72  s and TopoFeatur
7b60: 65 73 20 62 79 20 74 72 61 6e 73 66 65 72 72 69  es by transferri
7b70: 6e 67 20 74 68 65 6d 20 66 72 6f 6d 20 3c 62 3e  ng them from <b>
7b80: 35 31 30 30 39 20 3c 69 3e 43 61 73 74 65 6c 66  51009 <i>Castelf
7b90: 72 61 6e 63 6f 20 64 69 20 53 6f 70 72 61 3c 2f  ranco di Sopra</
7ba0: 69 3e 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 35 31  i></b> and <b>51
7bb0: 30 32 39 20 3c 69 3e 50 69 61 6e 20 64 69 20 53  029 <i>Pian di S
7bc0: 63 6f 3c 2f 69 3e 3c 2f 62 3e 20 74 6f 20 3c 62  co</i></b> to <b
7bd0: 3e 35 31 30 34 35 20 3c 69 3e 43 61 73 74 65 6c  >51045 <i>Castel
7be0: 66 72 61 6e 63 6f 20 50 69 61 6e 64 69 73 63 c3  franco Piandisc.
7bf0: b2 3c 2f 69 3e 3c 2f 62 3e 2e 20 54 68 65 6e 20  .</i></b>. Then 
7c00: 77 65 27 76 65 20 72 65 70 6c 69 65 64 20 74 68  we've replied th
7c10: 65 20 73 61 6d 65 20 61 63 74 69 6f 6e 2e 66 72  e same action.fr
7c20: 6f 6d 20 3c 62 3e 35 31 30 33 32 20 3c 69 3e 50  om <b>51032 <i>P
7c30: 72 61 74 6f 76 65 63 63 68 69 6f 3c 2f 69 3e 3c  ratovecchio</i><
7c40: 2f 62 3e 20 61 6e 64 20 3c 62 3e 35 31 30 34 31  /b> and <b>51041
7c50: 20 3c 69 3e 53 74 69 61 3c 2f 69 3e 3c 2f 62 3e   <i>Stia</i></b>
7c60: 20 74 6f 20 3c 62 3e 35 31 30 34 31 20 3c 69 3e   to <b>51041 <i>
7c70: 50 72 61 74 6f 76 65 63 63 68 69 6f 20 53 74 69  Pratovecchio Sti
7c80: 61 3c 2f 69 3e 3c 2f 62 3e 20 73 6f 20 74 6f 20  a</i></b> so to 
7c90: 63 6f 72 72 65 63 74 6c 79 20 75 70 64 61 74 65  correctly update
7ca0: 20 61 6c 6c 20 6e 65 77 20 4d 75 6e 69 63 69 70   all new Municip
7cb0: 61 6c 69 74 69 65 73 20 69 6e 74 65 72 65 73 74  alities interest
7cc0: 69 6e 67 20 74 68 65 20 50 72 6f 76 69 6e 63 65  ing the Province
7cd0: 20 6f 66 20 41 72 65 7a 7a 6f 2e 3c 62 72 3e 0d   of Arezzo.<br>.
7ce0: 0a 59 6f 75 20 63 6f 75 6c 64 20 65 76 65 6e 74  .You could event
7cf0: 75 61 6c 6c 79 20 63 6f 6e 74 69 6e 75 65 20 62  ually continue b
7d00: 79 20 79 6f 75 72 73 65 6c 66 20 73 6f 20 74 6f  y yourself so to
7d10: 20 75 70 64 61 74 65 20 61 6c 6c 20 50 72 6f 76   update all Prov
7d20: 69 6e 63 65 73 2e 20 0d 0a 3c 76 65 72 62 61 74  inces. ..<verbat
7d30: 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 54 6f 70 6f  im>..SELECT Topo
7d40: 47 65 6f 5f 45 78 70 6f 72 74 54 6f 70 6f 4c 61  Geo_ExportTopoLa
7d50: 79 65 72 28 27 63 65 6e 73 75 73 32 30 31 31 27  yer('census2011'
7d60: 2c 20 27 63 6f 6d 32 30 31 35 27 2c 20 27 6f 75  , 'com2015', 'ou
7d70: 74 5f 63 6f 6d 5f 61 72 5f 32 30 31 35 27 2c 20  t_com_ar_2015', 
7d80: 31 2c 20 31 29 3b 0d 0a 0d 0a 53 45 4c 45 43 54  1, 1);....SELECT
7d90: 20 54 6f 70 6f 47 65 6f 5f 49 6e 73 65 72 74 46   TopoGeo_InsertF
7da0: 65 61 74 75 72 65 46 72 6f 6d 54 6f 70 6f 4c 61  eatureFromTopoLa
7db0: 79 65 72 20 28 27 63 65 6e 73 75 73 32 30 31 31  yer ('census2011
7dc0: 27 2c 20 27 63 6f 6d 32 30 31 35 27 2c 20 27 6f  ', 'com2015', 'o
7dd0: 75 74 5f 63 6f 6d 5f 61 72 5f 32 30 31 35 27 2c  ut_com_ar_2015',
7de0: 20 66 69 64 29 0d 0a 46 52 4f 4d 20 63 65 6e 73   fid)..FROM cens
7df0: 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75  us2011_topofeatu
7e00: 72 65 73 5f 36 0d 0a 57 48 45 52 45 20 63 6f 64  res_6..WHERE cod
7e10: 5f 70 72 6f 76 20 3d 20 35 31 20 41 4e 44 20 63  _prov = 51 AND c
7e20: 6f 64 5f 63 6f 6d 20 4e 4f 54 20 49 4e 20 28 35  od_com NOT IN (5
7e30: 31 30 30 39 2c 20 35 31 30 32 39 2c 20 35 31 30  1009, 51029, 510
7e40: 33 32 2c 20 35 31 30 33 36 29 3b 0d 0a 3c 2f 76  32, 51036);..</v
7e50: 65 72 62 61 74 69 6d 3e 0d 0a 46 69 6e 61 6c 6c  erbatim>..Finall
7e60: 79 20 77 65 27 6c 6c 20 65 78 70 6f 72 74 20 61  y we'll export a
7e70: 20 6e 65 77 20 6c 61 79 65 72 20 72 65 70 72 65   new layer repre
7e80: 73 65 6e 74 69 6e 67 20 74 68 65 20 75 70 64 61  senting the upda
7e90: 74 65 64 20 32 30 31 35 20 50 72 6f 76 69 6e 63  ted 2015 Provinc
7ea0: 65 20 6f 66 20 41 72 65 7a 7a 6f 2e 3c 62 72 3e  e of Arezzo.<br>
7eb0: 0d 0a 54 68 69 73 20 74 69 6d 65 20 77 65 27 6c  ..This time we'l
7ec0: 6c 20 69 6e 76 6f 6b 65 20 3c 62 3e 54 6f 70 6f  l invoke <b>Topo
7ed0: 47 65 6f 5f 45 78 70 6f 72 74 54 6f 70 6f 4c 61  Geo_ExportTopoLa
7ee0: 79 65 72 28 29 3c 2f 62 3e 20 62 79 20 73 70 65  yer()</b> by spe
7ef0: 63 69 66 79 69 6e 67 20 74 68 65 20 3c 62 3e 3c  cifying the <b><
7f00: 69 3e 63 72 65 61 74 65 2d 6f 6e 6c 79 3c 2f 69  i>create-only</i
7f10: 3e 3c 2f 62 3e 20 73 70 65 63 69 61 6c 20 6f 70  ></b> special op
7f20: 74 69 6f 6e 2c 20 61 6e 64 20 74 68 65 6e 20 77  tion, and then w
7f30: 65 27 6c 6c 20 75 73 65 20 74 68 65 20 3c 62 3e  e'll use the <b>
7f40: 54 6f 70 6f 47 65 6f 5f 49 6e 73 65 72 74 46 65  TopoGeo_InsertFe
7f50: 61 74 75 72 65 46 72 6f 6d 54 6f 70 6f 4c 61 79  atureFromTopoLay
7f60: 65 72 28 29 3c 2f 62 3e 20 53 51 4c 20 66 75 6e  er()</b> SQL fun
7f70: 63 74 69 6f 6e 20 69 6e 20 6f 72 64 65 72 20 74  ction in order t
7f80: 6f 20 73 65 6c 65 63 74 69 76 65 6c 79 20 65 78  o selectively ex
7f90: 70 6f 72 74 20 6f 6e 6c 79 20 61 20 6c 69 6d 69  port only a limi
7fa0: 74 65 64 20 73 75 62 73 65 74 20 66 72 6f 6d 20  ted subset from 
7fb0: 74 68 65 20 6f 76 65 72 61 6c 6c 20 54 6f 70 6f  the overall Topo
7fc0: 46 65 61 74 75 72 65 73 2e 3c 62 72 3e 3c 62 72  Features.<br><br
7fd0: 3e 0d 0a 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70  >..<table cellsp
7fe0: 61 6e 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69  an="4" cellpaddi
7ff0: 6e 67 3d 22 36 22 20 62 67 63 6f 6c 6f 72 3d 22  ng="6" bgcolor="
8000: 23 66 38 66 38 66 30 22 20 62 6f 72 64 65 72 3d  #f8f8f0" border=
8010: 22 31 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a  "1">..<tr><td>..
8020: 3c 69 6d 67 20 73 72 63 3d 22 68 74 74 70 73 3a  <img src="https:
8030: 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69  //www.gaia-gis.i
8040: 74 2f 67 61 69 61 2d 73 69 6e 73 2f 74 6f 70 6f  t/gaia-sins/topo
8050: 66 69 67 73 2f 74 6f 70 6f 2d 61 72 2d 32 30 31  figs/topo-ar-201
8060: 31 2e 70 6e 67 22 20 61 6c 74 3d 22 74 6f 70 6f  1.png" alt="topo
8070: 2d 61 72 2d 32 30 31 31 22 3e 0d 0a 3c 2f 74 64  -ar-2011">..</td
8080: 3e 3c 74 64 3e 0d 0a 3c 69 6d 67 20 73 72 63 3d  ><td>..<img src=
8090: 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69  "https://www.gai
80a0: 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d 73 69  a-gis.it/gaia-si
80b0: 6e 73 2f 74 6f 70 6f 66 69 67 73 2f 74 6f 70 6f  ns/topofigs/topo
80c0: 2d 61 72 2d 32 30 31 35 2e 70 6e 67 22 20 61 6c  -ar-2015.png" al
80d0: 74 3d 22 74 6f 70 6f 2d 61 72 2d 32 30 31 35 22  t="topo-ar-2015"
80e0: 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c  >..</td></tr>..<
80f0: 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 63 65  tr><td align="ce
8100: 6e 74 65 72 22 3e 4d 75 6e 69 63 69 70 61 6c 69  nter">Municipali
8110: 74 69 65 73 20 69 6e 20 74 68 65 20 50 72 6f 76  ties in the Prov
8120: 69 6e 63 65 20 6f 66 20 41 72 65 7a 7a 6f 3a 20  ince of Arezzo: 
8130: 3c 62 3e 32 30 31 31 3c 2f 62 3e 3c 2f 74 64 3e  <b>2011</b></td>
8140: 3c 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65  <td align="cente
8150: 72 22 3e 4d 75 6e 69 63 69 70 61 6c 69 74 69 65  r">Municipalitie
8160: 73 20 69 6e 20 74 68 65 20 50 72 6f 76 69 6e 63  s in the Provinc
8170: 65 20 6f 66 20 41 72 65 7a 7a 6f 3a 20 3c 62 3e  e of Arezzo: <b>
8180: 32 30 31 35 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f 74  2015</b></td></t
8190: 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 3c 62 72 3e  r>..</table><br>
81a0: 0d 0a 3c 68 72 3e 0d 0a 3c 2f 64 69 76 3e 0d 0a  ..<hr>..</div>..
81b0: 3c 74 61 62 6c 65 20 77 69 64 74 68 3d 22 31 30  <table width="10
81c0: 30 25 22 3e 3c 74 72 3e 0d 0a 3c 74 64 20 77 69  0%"><tr>..<td wi
81d0: 64 74 68 3d 22 33 33 25 22 20 61 6c 69 67 6e 3d  dth="33%" align=
81e0: 22 6c 65 66 74 22 3e 3c 61 20 68 72 65 66 3d 22  "left"><a href="
81f0: 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61  https://www.gaia
8200: 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c  -gis.it/fossil/l
8210: 69 62 73 70 61 74 69 61 6c 69 74 65 2f 77 69 6b  ibspatialite/wik
8220: 69 3f 6e 61 6d 65 3d 74 6f 70 6f 2d 69 6e 74 65  i?name=topo-inte
8230: 72 6d 65 64 69 61 74 65 22 3e 70 72 65 76 69 6f  rmediate">previo
8240: 75 73 20 70 61 67 65 3c 2f 61 3e 3c 2f 74 64 3e  us page</a></td>
8250: 0d 0a 3c 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e  ..<td align="cen
8260: 74 65 72 22 3e 3c 61 20 68 72 65 66 3d 22 68 74  ter"><a href="ht
8270: 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67  tps://www.gaia-g
8280: 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62  is.it/fossil/lib
8290: 73 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f  spatialite/wiki?
82a0: 6e 61 6d 65 3d 49 53 4f 2b 54 6f 70 6f 6c 6f 67  name=ISO+Topolog
82b0: 79 22 3e 62 61 63 6b 20 74 6f 20 69 6e 64 65 78  y">back to index
82c0: 3c 2f 61 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 77  </a></td>..<td w
82d0: 69 64 74 68 3d 22 33 33 25 22 20 61 6c 69 67 6e  idth="33%" align
82e0: 3d 22 72 69 67 68 74 22 3e 3c 2f 74 64 3e 0d 0a  ="right"></td>..
82f0: 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0a 5a 20  </tr></table>.Z 
8300: 65 63 64 65 32 34 66 37 30 35 31 32 39 33 63 66  ecde24f7051293cf
8310: 32 64 39 33 65 64 64 35 33 66 39 61 32 63 38 32  2d93edd53f9a2c82
8320: 0a                                               .