Wiki page
[topo-advanced] by
sandro
2015-11-17 23:44:54.
0000: 44 20 32 30 31 35 2d 31 31 2d 31 37 54 32 33 3a D 2015-11-17T23:
0010: 34 34 3a 35 34 2e 34 30 35 0a 4c 20 74 6f 70 6f 44:54.405.L topo
0020: 2d 61 64 76 61 6e 63 65 64 0a 50 20 61 62 37 39 -advanced.P ab79
0030: 36 62 63 38 32 32 36 39 31 34 36 37 36 61 35 61 6bc8226914676a5a
0040: 64 65 32 35 63 33 62 61 30 33 37 65 37 62 33 33 de25c3ba037e7b33
0050: 31 39 32 31 0a 55 20 73 61 6e 64 72 6f 0a 57 20 1921.U sandro.W
0060: 32 38 32 33 37 0a 3c 74 61 62 6c 65 20 63 65 6c 28237.<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 6d lite/wiki?name=m
0220: 69 73 63 2d 64 6f 63 73 22 3e 62 61 63 6b 20 74 isc-docs">back t
0230: 6f 20 69 6e 64 65 78 3c 2f 61 3e 3c 2f 74 64 3e o index</a></td>
0240: 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22 33 33 25 ..<td width="33%
0250: 22 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e " align="right">
0260: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f <a href="https:/
0270: 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 /www.gaia-gis.it
0280: 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 /fossil/libspati
0290: 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d alite/wiki?name=
02a0: 74 6f 70 6f 2d 61 64 76 61 6e 63 65 64 22 3e 6e topo-advanced">n
02b0: 65 78 74 20 70 61 67 65 3c 2f 61 3e 3c 2f 74 64 ext page</a></td
02c0: 3e 0d 0a 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e >..</tr></table>
02d0: 0d 0a 3c 68 33 3e 54 6f 70 6f 4c 61 79 65 72 73 ..<h3>TopoLayers
02e0: 20 61 6e 64 20 54 6f 70 6f 46 65 61 74 75 72 65 and TopoFeature
02f0: 73 3c 2f 68 33 3e 0d 0a 49 6e 20 74 68 65 20 70 s</h3>..In the p
0300: 72 65 76 69 6f 75 73 20 74 75 74 6f 72 69 61 6c revious tutorial
0310: 20 77 65 27 76 65 20 65 78 61 6d 69 6e 65 64 20 we've examined
0320: 61 20 66 69 72 73 74 20 63 6f 75 70 6c 65 20 6f a first couple o
0330: 66 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e 73 20 f SQL functions
0340: 69 6e 74 65 6e 64 65 64 20 74 6f 20 65 78 70 6f intended to expo
0350: 72 74 20 61 20 47 65 6f 54 61 62 6c 65 20 6f 75 rt a GeoTable ou
0360: 74 20 66 72 6f 6d 20 61 6e 20 65 78 69 73 74 69 t from an existi
0370: 6e 67 20 54 6f 70 6f 6c 6f 67 79 3a 20 3c 62 3e ng Topology: <b>
0380: 54 6f 70 6f 47 65 6f 5f 54 6f 47 65 6f 54 61 62 TopoGeo_ToGeoTab
0390: 6c 65 28 29 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e le()</b> and <b>
03a0: 54 6f 70 6f 47 65 6f 5f 54 6f 47 65 6f 54 61 62 TopoGeo_ToGeoTab
03b0: 6c 65 47 65 6e 65 72 61 6c 69 7a 65 28 29 3c 2f leGeneralize()</
03c0: 62 3e 2e 3c 62 72 3e 0d 0a 41 6e 79 77 61 79 20 b>.<br>..Anyway
03d0: 53 70 61 74 69 61 4c 69 74 65 20 73 75 70 70 6f SpatiaLite suppo
03e0: 72 74 73 20 61 6e 20 6d 6f 72 65 20 73 6f 70 68 rts an more soph
03f0: 69 73 74 69 63 61 74 65 64 20 28 61 6e 64 20 63 isticated (and c
0400: 6f 6d 70 6c 65 78 29 20 61 70 70 72 6f 61 63 68 omplex) approach
0410: 20 62 61 73 65 64 20 6f 6e 20 3c 62 3e 54 6f 70 based on <b>Top
0420: 6f 4c 61 79 65 72 73 3c 2f 62 3e 20 61 6e 64 20 oLayers</b> and
0430: 3c 62 3e 54 6f 70 6f 46 65 61 74 75 72 65 73 3c <b>TopoFeatures<
0440: 2f 62 3e 20 73 70 65 63 69 66 69 63 61 6c 6c 79 /b> specifically
0450: 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 73 75 70 intended to sup
0460: 70 6f 72 74 20 61 20 76 65 72 79 20 66 6c 65 78 port a very flex
0470: 69 62 6c 65 20 6d 65 63 68 61 6e 69 73 6d 20 66 ible mechanism f
0480: 6f 72 20 65 78 70 6f 72 74 69 6e 67 20 61 20 66 or exporting a f
0490: 75 6c 6c 20 73 65 74 20 6f 66 20 47 65 6f 54 61 ull set of GeoTa
04a0: 62 6c 65 28 73 29 20 64 69 72 65 63 74 6c 79 20 ble(s) directly
04b0: 64 65 72 69 76 69 6e 67 20 66 72 6f 6d 20 61 20 deriving from a
04c0: 54 6f 70 6f 6c 6f 67 79 2e 0d 0a 3c 68 34 3e 61 Topology...<h4>a
04d0: 20 63 6f 6e 63 65 70 74 75 61 6c 20 72 65 66 65 conceptual refe
04e0: 72 65 6e 63 65 20 66 72 61 6d 65 77 6f 72 6b 3c rence framework<
04f0: 2f 68 34 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e /h4>..<ul>..<li>
0500: 61 6e 20 49 53 4f 20 54 6f 70 6f 6c 6f 67 79 20 an ISO Topology
0510: 69 73 20 6a 75 73 74 20 69 6e 74 65 6e 64 65 64 is just intended
0520: 20 74 6f 20 73 75 70 70 6f 72 74 20 61 20 63 6f to support a co
0530: 6e 73 69 73 74 65 6e 74 20 73 65 74 20 6f 66 20 nsistent set of
0540: 3c 62 3e 4e 6f 64 65 73 3c 2f 62 3e 2c 20 3c 62 <b>Nodes</b>, <b
0550: 3e 45 64 67 65 73 3c 2f 62 3e 20 61 6e 64 20 3c >Edges</b> and <
0560: 62 3e 46 61 63 65 73 3c 2f 62 3e 20 70 72 69 6d b>Faces</b> prim
0570: 69 74 69 76 65 73 20 66 75 6c 6c 79 20 63 6f 76 itives fully cov
0580: 65 72 69 6e 67 20 74 68 65 20 70 6c 61 6e 65 2e ering the plane.
0590: 0d 0a 54 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 ..Topology primi
05a0: 74 69 76 65 73 20 63 6f 72 72 65 73 70 6f 6e 64 tives correspond
05b0: 20 74 6f 20 70 75 72 65 20 67 65 6f 6d 65 74 72 to pure geometr
05c0: 69 65 73 2c 20 61 6e 64 20 63 61 6e 20 6e 65 76 ies, and can nev
05d0: 65 72 20 62 65 20 64 69 72 65 63 74 6c 79 20 20 er be directly
05e0: 61 73 73 6f 63 69 61 74 65 64 20 74 6f 20 61 20 associated to a
05f0: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 73 65 corresponding se
0600: 74 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e t of information
0610: 20 61 74 74 72 69 62 75 74 65 73 2e 0d 0a 42 6f attributes...Bo
0620: 74 68 20 4e 6f 64 65 20 61 6e 64 20 45 64 67 65 th Node and Edge
0630: 20 70 72 69 6d 69 74 69 76 65 73 20 64 69 72 65 primitives dire
0640: 63 74 6c 79 20 63 6f 72 72 65 73 70 6f 6e 64 20 ctly correspond
0650: 74 6f 20 61 20 3c 75 3e 3c 69 3e 72 65 61 6c 20 to a <u><i>real
0660: 67 65 6f 6d 65 74 72 79 3c 2f 69 3e 3c 2f 75 3e geometry</i></u>
0670: 2c 20 62 75 74 20 46 61 63 65 20 70 72 69 6d 69 , but Face primi
0680: 74 69 76 65 73 20 73 69 6d 70 6c 79 20 63 6f 72 tives simply cor
0690: 72 65 73 70 6f 6e 64 20 74 6f 20 61 20 3c 75 3e respond to a <u>
06a0: 3c 69 3e 76 69 72 74 75 61 6c 20 67 65 6f 6d 65 <i>virtual geome
06b0: 74 72 79 3c 2f 69 3e 3c 2f 75 3e 20 74 68 75 73 try</i></u> thus
06c0: 20 6e 65 63 65 73 73 61 72 69 6c 79 20 72 65 71 necessarily req
06d0: 75 69 72 69 6e 67 20 74 6f 20 62 65 20 64 79 6e uiring to be dyn
06e0: 61 6d 69 63 61 6c 6c 79 20 72 65 63 6f 6e 73 74 amically reconst
06f0: 72 75 63 74 65 64 20 65 76 65 72 79 20 74 69 6d ructed every tim
0700: 65 20 74 68 61 74 20 74 68 65 79 20 61 72 65 20 e that they are
0710: 72 65 66 65 72 65 6e 63 65 64 20 28 61 6e 64 20 referenced (and
0720: 74 68 69 73 20 63 6f 75 6c 64 20 65 61 73 69 6c this could easil
0730: 79 20 62 65 63 6f 6d 65 20 61 20 72 65 61 6c 20 y become a real
0740: 62 6f 74 74 6c 65 6e 65 63 6b 29 2e 3c 2f 6c 69 bottleneck).</li
0750: 3e 0d 0a 3c 6c 69 3e 6f 6e 20 74 68 65 20 6f 74 >..<li>on the ot
0760: 68 65 72 20 68 61 6e 64 20 61 20 47 65 6f 54 61 her hand a GeoTa
0770: 62 6c 65 20 28 61 6b 61 20 3c 75 3e 3c 69 3e 6c ble (aka <u><i>l
0780: 61 79 65 72 3c 2f 69 3e 3c 2f 75 3e 2c 20 61 73 ayer</i></u>, as
0790: 20 69 6e 20 74 68 65 20 63 6f 6d 6d 6f 6e 20 47 in the common G
07a0: 49 53 20 70 61 72 6c 61 6e 63 65 29 20 69 73 20 IS parlance) is
07b0: 61 6c 77 61 79 73 20 62 61 73 65 64 20 6f 6e 20 always based on
07c0: 6d 61 6e 79 20 64 69 73 74 69 6e 63 74 20 66 65 many distinct fe
07d0: 61 74 75 72 65 73 2c 20 61 6e 64 20 66 6f 72 20 atures, and for
07e0: 65 61 63 68 20 66 65 61 74 75 72 65 20 61 20 47 each feature a G
07f0: 65 6f 6d 65 74 72 79 20 61 6e 64 20 61 6e 20 61 eometry and an a
0800: 73 73 6f 63 69 61 74 65 64 20 73 65 74 20 6f 66 ssociated set of
0810: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 74 74 information att
0820: 72 69 62 75 74 65 73 20 61 72 65 20 65 78 70 65 ributes are expe
0830: 63 74 65 64 20 74 6f 20 62 65 20 64 65 63 6c 61 cted to be decla
0840: 72 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 red.</li>..<li>t
0850: 68 65 72 65 20 69 73 20 66 75 72 74 68 65 72 20 here is further
0860: 64 69 66 66 65 72 65 6e 63 65 20 74 6f 20 62 65 difference to be
0870: 20 74 61 6b 65 6e 20 69 6e 20 70 72 6f 70 65 72 taken in proper
0880: 20 61 63 63 6f 75 6e 74 3a 20 54 6f 70 6f 6c 6f account: Topolo
0890: 67 79 20 70 72 69 6d 69 74 69 76 65 73 20 6e 65 gy primitives ne
08a0: 63 65 73 73 61 72 69 6c 79 20 61 72 65 20 65 6c cessarily are el
08b0: 65 6d 65 6e 74 61 72 79 2e 20 46 65 61 74 75 72 ementary. Featur
08c0: 65 20 47 65 6f 6d 65 74 72 69 65 73 20 63 61 6e e Geometries can
08d0: 20 75 73 75 61 6c 6c 79 20 72 65 70 72 65 73 65 usually represe
08e0: 6e 74 20 73 6f 6d 65 20 63 6f 6d 70 6c 65 78 20 nt some complex
08f0: 74 79 70 65 3a 20 4d 55 4c 54 49 50 4f 49 4e 54 type: MULTIPOINT
0900: 2c 20 4d 55 4c 54 49 4c 49 4e 45 53 54 52 49 4e , MULTILINESTRIN
0910: 47 2c 20 4d 55 4c 54 49 50 4f 4c 59 47 4f 4e 20 G, MULTIPOLYGON
0920: 61 6e 64 2c 20 6d 61 79 20 62 65 2c 20 47 45 4f and, may be, GEO
0930: 4d 45 54 52 59 43 4f 4c 4c 45 43 54 49 4f 4e 2e METRYCOLLECTION.
0940: 20 53 6f 20 69 74 20 73 68 6f 75 6c 64 20 62 65 So it should be
0950: 20 61 62 73 6f 6c 75 74 65 6c 79 20 63 6c 65 61 absolutely clea
0960: 72 20 74 68 61 74 20 61 20 46 65 61 74 75 72 65 r that a Feature
0970: 20 47 65 6f 6d 65 74 72 79 20 64 6f 65 73 20 6e Geometry does n
0980: 6f 74 20 6e 65 63 65 73 73 61 72 69 6c 79 20 63 ot necessarily c
0990: 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 61 20 orresponds to a
09a0: 73 69 6e 67 6c 65 20 54 6f 70 6f 6c 6f 67 79 20 single Topology
09b0: 70 72 69 6d 69 74 69 76 65 20 3b 20 61 20 46 65 primitive ; a Fe
09c0: 61 74 75 72 65 20 47 65 6f 6d 65 74 72 79 20 63 ature Geometry c
09d0: 6f 75 6c 64 20 65 61 73 69 6c 79 20 62 65 20 64 ould easily be d
09e0: 65 72 69 76 65 64 20 66 72 6f 6d 20 61 67 67 72 erived from aggr
09f0: 65 67 61 74 69 6e 67 20 6d 61 6e 79 20 64 69 66 egating many dif
0a00: 66 65 72 65 6e 74 20 54 6f 70 6f 6c 6f 67 79 20 ferent Topology
0a10: 70 72 69 6d 69 74 69 76 65 73 2e 3c 2f 6c 69 3e primitives.</li>
0a20: 20 0d 0a 3c 6c 69 3e 74 68 61 74 27 73 20 6e 6f ..<li>that's no
0a30: 74 20 61 6c 6c 3a 20 6d 61 6e 79 20 64 69 66 66 t all: many diff
0a40: 65 72 65 6e 74 20 47 65 6f 54 61 62 6c 65 73 20 erent GeoTables
0a50: 63 6f 75 6c 64 20 65 76 65 6e 74 75 61 6c 6c 79 could eventually
0a60: 20 62 65 20 64 65 72 69 76 65 64 20 66 72 6f 6d be derived from
0a70: 20 61 20 73 69 6e 67 6c 65 20 54 6f 70 6f 6c 6f a single Topolo
0a80: 67 79 3b 20 61 6e 64 20 74 68 65 20 73 61 6d 65 gy; and the same
0a90: 20 54 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 Topology primit
0aa0: 69 76 65 20 63 6f 75 6c 64 20 70 6c 61 79 20 61 ive could play a
0ab0: 20 76 65 72 79 20 64 69 66 66 65 72 65 6e 74 20 very different
0ac0: 72 6f 6c 65 20 69 6e 20 65 76 65 72 79 6f 6e 65 role in everyone
0ad0: 20 6f 66 20 74 68 65 73 65 20 47 65 6f 54 61 62 of these GeoTab
0ae0: 6c 65 73 2e 3c 62 72 3e 0d 0a 4a 75 73 74 20 61 les.<br>..Just a
0af0: 20 62 61 73 69 63 61 6c 6c 79 20 73 69 6d 70 6c basically simpl
0b00: 65 20 65 78 61 6d 70 6c 65 3a 20 69 6d 61 67 69 e example: imagi
0b10: 6e 65 20 61 20 54 6f 70 6f 6c 6f 67 79 20 63 6f ne a Topology co
0b20: 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 73 rresponding to s
0b30: 6f 6d 65 20 6c 61 6e 64 20 72 65 67 69 73 74 72 ome land registr
0b40: 79 20 6d 61 70 2e 20 57 65 27 6c 6c 20 73 75 72 y map. We'll sur
0b50: 65 6c 79 20 68 61 76 65 20 6d 61 6e 79 20 70 6f ely have many po
0b60: 74 65 6e 74 69 61 6c 20 6c 61 79 65 72 73 3a 20 tential layers:
0b70: 62 75 69 6c 64 69 6e 67 73 2c 20 61 67 72 69 63 buildings, agric
0b80: 75 6c 74 75 72 61 6c 20 6c 61 6e 64 2c 20 70 6f ultural land, po
0b90: 70 75 6c 61 74 65 64 20 70 6c 61 63 65 73 2c 20 pulated places,
0ba0: 61 64 6d 69 6e 69 73 74 72 61 74 69 76 65 20 62 administrative b
0bb0: 6f 75 6e 64 61 72 69 65 73 2c 20 72 6f 61 64 73 oundaries, roads
0bc0: 2c 20 70 6f 6e 64 73 2c 20 72 69 76 65 72 73 2c , ponds, rivers,
0bd0: 20 66 65 6e 63 65 73 20 61 6e 64 20 73 6f 20 6f fences and so o
0be0: 6e 2e 3c 62 72 3e 0d 0a 49 6e 20 73 75 63 68 20 n.<br>..In such
0bf0: 61 20 63 6f 6e 74 65 78 74 20 61 20 66 65 6e 63 a context a fenc
0c00: 65 20 63 6f 75 6c 64 20 65 61 73 69 6c 79 20 63 e could easily c
0c10: 6f 72 72 65 73 70 6f 6e 64 20 74 6f 20 61 20 46 orrespond to a F
0c20: 65 61 74 75 72 65 20 77 69 74 68 69 6e 20 74 68 eature within th
0c30: 65 20 22 3c 69 3e 3c 62 3e 66 65 6e 63 65 73 3c e "<i><b>fences<
0c40: 2f 62 3e 3c 2f 69 3e 22 20 6c 61 79 65 72 2c 20 /b></i>" layer,
0c50: 63 6f 75 6c 64 20 70 72 6f 62 61 62 6c 79 20 64 could probably d
0c60: 65 6c 69 6d 69 74 20 74 77 6f 20 61 64 6a 61 63 elimit two adjac
0c70: 65 6e 74 20 61 67 72 69 63 75 6c 74 75 72 61 6c ent agricultural
0c80: 20 61 72 65 61 73 20 61 6e 64 20 63 6f 75 6c 64 areas and could
0c90: 20 65 76 65 6e 74 75 61 6c 6c 79 20 62 65 20 70 eventually be p
0ca0: 61 72 74 20 6f 66 20 73 6f 6d 65 20 61 64 6d 69 art of some admi
0cb0: 6e 69 73 74 72 61 74 69 76 65 20 62 6f 75 6e 64 nistrative bound
0cc0: 61 72 79 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c ary.</li>..<li><
0cd0: 62 3e 54 6f 70 6f 4c 61 79 65 72 73 3c 2f 62 3e b>TopoLayers</b>
0ce0: 20 61 6e 64 20 3c 62 3e 54 6f 70 6f 46 65 61 74 and <b>TopoFeat
0cf0: 75 72 65 73 3c 2f 62 3e 20 72 65 70 72 65 73 65 ures</b> represe
0d00: 6e 74 20 61 20 63 6f 6d 70 6c 65 78 20 61 6e 64 nt a complex and
0d10: 20 66 6c 65 78 69 62 6c 65 20 73 74 72 75 63 74 flexible struct
0d20: 75 72 65 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 ure intended to
0d30: 65 73 74 61 62 6c 69 73 68 20 70 65 72 6d 61 6e establish perman
0d40: 65 6e 74 20 65 78 70 6c 69 63 69 74 20 63 6f 72 ent explicit cor
0d50: 72 65 73 70 6f 6e 64 65 6e 63 65 73 20 62 65 74 respondences bet
0d60: 77 65 65 6e 20 54 6f 70 6f 6c 6f 67 79 20 50 72 ween Topology Pr
0d70: 69 6d 69 74 69 76 65 73 20 61 6e 64 20 47 65 6f imitives and Geo
0d80: 54 61 62 6c 65 20 46 65 61 74 75 72 65 73 2e 0d Table Features..
0d90: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 65 61 63 68 20 .<ul>..<li>each
0da0: 3c 62 3e 54 6f 70 6f 4c 61 79 65 72 3c 2f 62 3e <b>TopoLayer</b>
0db0: 20 69 73 20 75 6e 69 71 75 65 6c 79 20 69 64 65 is uniquely ide
0dc0: 6e 74 69 66 69 65 64 20 62 79 20 69 74 73 20 3c ntified by its <
0dd0: 62 3e 6e 61 6d 65 3c 2f 62 3e 20 61 6e 64 20 64 b>name</b> and d
0de0: 69 72 65 63 74 6c 79 20 63 6f 72 72 65 73 70 6f irectly correspo
0df0: 6e 64 73 20 74 6f 20 61 20 73 69 6e 67 6c 65 20 nds to a single
0e00: 47 65 6f 54 61 62 6c 65 20 74 6f 20 62 65 20 65 GeoTable to be e
0e10: 78 70 6f 72 74 65 64 20 66 72 6f 6d 20 74 68 65 xported from the
0e20: 20 54 6f 70 6f 6c 6f 67 79 3c 62 72 3e 0d 0a 41 Topology<br>..A
0e30: 6e 20 61 72 62 69 74 72 61 72 79 20 6e 75 6d 62 n arbitrary numb
0e40: 65 72 20 6f 66 20 54 6f 70 6f 4c 61 79 65 72 73 er of TopoLayers
0e50: 20 63 61 6e 20 62 65 20 63 72 65 61 74 65 64 20 can be created
0e60: 6f 6e 20 74 68 65 20 73 61 6d 65 20 54 6f 70 6f on the same Topo
0e70: 6c 6f 67 79 2c 20 61 6e 64 20 65 61 63 68 20 6f logy, and each o
0e80: 6e 65 20 6f 66 20 74 68 65 6d 20 77 69 6c 6c 20 ne of them will
0e90: 61 63 74 20 61 73 20 61 20 73 65 70 61 72 61 74 act as a separat
0ea0: 65 20 63 6f 6e 74 61 69 6e 65 72 2e 3c 2f 6c 69 e container.</li
0eb0: 3e 0d 0a 3c 6c 69 3e 65 61 63 68 20 3c 62 3e 54 >..<li>each <b>T
0ec0: 6f 70 6f 46 65 61 74 75 72 65 3c 2f 62 3e 20 69 opoFeature</b> i
0ed0: 73 20 75 6e 69 71 75 65 6c 79 20 69 64 65 6e 74 s uniquely ident
0ee0: 69 66 69 65 64 20 62 79 20 69 74 73 20 3c 62 3e ified by its <b>
0ef0: 66 69 64 3c 2f 62 3e 20 28 3c 69 3e 66 65 61 74 fid</b> (<i>feat
0f00: 75 72 65 2d 69 64 3c 2f 69 3e 29 20 61 6e 64 20 ure-id</i>) and
0f10: 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f 20 61 corresponds to a
0f20: 20 73 69 6e 67 6c 65 20 46 65 61 74 75 72 65 20 single Feature
0f30: 63 6f 6e 74 61 69 6e 69 6e 67 20 61 6e 20 69 6e containing an in
0f40: 64 69 76 69 64 75 61 6c 20 73 65 74 20 6f 66 20 dividual set of
0f50: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 74 74 72 information attr
0f60: 69 62 75 74 65 73 2e 3c 62 72 3e 0d 0a 54 68 65 ibutes.<br>..The
0f70: 20 47 65 6f 6d 65 74 72 79 20 66 6f 72 20 65 61 Geometry for ea
0f80: 63 68 20 54 6f 70 6f 46 65 61 74 75 72 65 20 69 ch TopoFeature i
0f90: 73 20 61 6c 77 61 79 73 20 69 6e 64 69 72 65 63 s always indirec
0fa0: 74 6c 79 20 64 65 66 69 6e 65 64 20 62 79 20 73 tly defined by s
0fb0: 70 65 63 69 66 79 69 6e 67 20 61 20 6c 69 73 74 pecifying a list
0fc0: 20 6f 66 20 54 6f 70 6f 6c 6f 67 79 20 70 72 69 of Topology pri
0fd0: 6d 69 74 69 76 65 73 20 69 6e 64 69 76 69 64 75 mitives individu
0fe0: 61 6c 6c 79 20 72 65 66 65 72 65 6e 63 65 64 20 ally referenced
0ff0: 62 79 20 74 68 65 69 72 20 49 44 73 2e 3c 62 72 by their IDs.<br
1000: 3e 0d 0a 53 75 63 68 20 61 20 67 65 6f 6d 65 74 >..Such a geomet
1010: 72 79 20 6f 62 76 69 6f 75 73 6c 79 20 69 73 20 ry obviously is
1020: 61 20 3c 75 3e 3c 69 3e 76 69 72 74 75 61 6c 3c a <u><i>virtual<
1030: 2f 69 3e 3c 2f 75 3e 20 6f 6e 65 2c 20 61 6e 64 /i></u> one, and
1040: 20 77 69 6c 6c 20 62 65 20 61 63 74 75 61 6c 6c will be actuall
1050: 79 20 6d 61 74 65 72 69 61 6c 69 7a 65 64 20 28 y materialized (
1060: 62 79 20 61 67 67 72 65 67 61 74 69 6e 67 20 61 by aggregating a
1070: 6c 6c 20 72 65 66 65 72 65 6e 63 65 64 20 54 6f ll referenced To
1080: 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 76 65 pology primitive
1090: 73 29 20 6f 6e 6c 79 20 77 68 65 6e 20 65 78 70 s) only when exp
10a0: 6f 72 74 69 6e 67 20 74 68 65 20 64 65 73 74 69 orting the desti
10b0: 6e 61 74 69 6f 6e 20 47 65 6f 54 61 62 6c 65 2e nation GeoTable.
10c0: 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 </li>..</ul></li
10d0: 3e 0d 0a 3c 6c 69 3e 54 68 65 20 54 6f 70 6f 4c >..<li>The TopoL
10e0: 61 79 65 72 73 20 2f 20 54 6f 70 6f 46 65 61 74 ayers / TopoFeat
10f0: 75 72 65 73 20 73 74 72 75 63 74 75 72 65 20 69 ures structure i
1100: 73 20 70 72 61 63 74 69 63 61 6c 6c 79 20 69 6d s practically im
1110: 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 61 20 73 plemented as a s
1120: 65 74 20 6f 66 20 73 65 76 65 72 61 6c 20 63 6c et of several cl
1130: 6f 73 65 6c 79 20 72 65 6c 61 74 65 64 20 44 42 osely related DB
1140: 2d 74 61 62 6c 65 73 20 29 77 65 27 6c 6c 20 65 -tables )we'll e
1150: 78 61 6d 69 6e 65 20 6c 61 74 65 72 20 74 68 65 xamine later the
1160: 69 72 20 72 65 73 70 65 63 74 69 76 65 20 6c 61 ir respective la
1170: 79 6f 75 74 73 20 69 6e 20 66 75 6c 6c 20 64 65 youts in full de
1180: 74 61 69 6c 29 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c tail):..<ul>..<l
1190: 69 3e 3c 62 3e 3c 3c 69 3e 74 6f 70 6f 2d 70 72 i><b><<i>topo-pr
11a0: 65 66 69 78 3c 2f 69 3e 3e 5f 74 6f 70 6f 6c 61 efix</i>>_topola
11b0: 79 65 72 73 3c 2f 62 3e 3a 20 74 68 69 73 20 66 yers</b>: this f
11c0: 69 72 73 74 20 74 61 62 6c 65 20 73 69 6d 70 6c irst table simpl
11d0: 79 20 69 73 20 61 20 63 61 74 61 6c 6f 67 20 6f y is a catalog o
11e0: 66 20 61 6c 6c 20 54 6f 70 6f 4c 61 79 65 72 73 f all TopoLayers
11f0: 20 73 75 70 70 6f 72 74 69 6e 67 20 74 68 65 20 supporting the
1200: 73 61 6d 65 20 54 6f 70 6f 6c 6f 67 79 2e 3c 62 same Topology.<b
1210: 72 3e 0d 0a 45 61 63 68 20 54 6f 70 6f 4c 61 79 r>..Each TopoLay
1220: 65 72 20 69 73 20 69 64 65 6e 74 69 66 69 65 64 er is identified
1230: 20 62 79 20 69 74 73 20 3c 62 3e 6e 61 6d 65 3c by its <b>name<
1240: 2f 62 3e 20 61 6e 64 20 62 79 20 69 74 73 20 3c /b> and by its <
1250: 62 3e 49 44 3c 2f 62 3e 3b 20 62 6f 74 68 20 69 b>ID</b>; both i
1260: 64 65 6e 74 69 66 69 65 72 73 20 61 72 65 20 67 dentifiers are g
1270: 72 61 6e 74 65 64 20 74 6f 20 62 65 20 3c 69 3e ranted to be <i>
1280: 3c 75 3e 75 6e 69 71 75 65 3c 2f 75 3e 3c 2f 69 <u>unique</u></i
1290: 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e >.</li>..<li><b>
12a0: 3c 3c 69 3e 74 6f 70 6f 2d 70 72 65 66 69 78 3c <<i>topo-prefix<
12b0: 2f 69 3e 3e 5f 74 6f 70 6f 66 65 61 74 75 72 65 /i>>_topofeature
12c0: 73 3c 2f 62 3e 3a 20 74 68 69 73 20 73 65 63 6f s</b>: this seco
12d0: 6e 64 20 74 61 62 6c 65 20 69 73 20 69 6e 74 65 nd table is inte
12e0: 6e 64 65 64 20 74 6f 20 70 65 72 6d 61 6e 65 6e nded to permanen
12f0: 74 6c 79 20 73 74 6f 72 65 20 61 6c 6c 20 63 72 tly store all cr
1300: 6f 73 73 2d 72 65 66 65 72 65 6e 63 65 73 20 65 oss-references e
1310: 78 69 73 74 69 6e 67 20 62 65 74 77 65 65 6e 20 xisting between
1320: 54 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 Topology primiti
1330: 76 65 73 20 61 6e 64 20 54 6f 70 6f 46 65 61 74 ves and TopoFeat
1340: 75 72 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e ures.</li>..<li>
1350: 3c 62 3e 3c 3c 69 3e 74 6f 70 6f 2d 70 72 65 66 <b><<i>topo-pref
1360: 69 78 3c 2f 69 3e 3e 5f 74 6f 70 6f 66 65 61 74 ix</i>>_topofeat
1370: 75 72 65 73 5f 3c 3c 69 3e 74 6f 70 6f 6c 61 79 ures_<<i>topolay
1380: 65 72 2d 69 64 3c 2f 69 3e 3e 3c 2f 62 3e 3a 20 er-id</i>></b>:
1390: 66 6f 72 20 65 61 63 68 20 73 69 6e 67 6c 65 20 for each single
13a0: 54 6f 70 6f 4c 61 79 65 72 20 61 20 73 65 70 61 TopoLayer a sepa
13b0: 72 61 74 65 20 74 61 62 6c 65 20 69 73 20 72 65 rate table is re
13c0: 71 75 69 72 65 64 2e 20 54 68 65 20 61 63 74 75 quired. The actu
13d0: 61 6c 20 63 6f 72 72 65 73 70 6f 6e 64 65 6e 63 al correspondenc
13e0: 65 20 69 73 20 65 73 74 61 62 6c 69 73 68 65 64 e is established
13f0: 20 76 69 61 20 74 68 65 20 3c 62 3e 54 6f 70 6f via the <b>Topo
1400: 4c 61 79 65 72 2d 49 44 3c 2f 62 3e 20 73 75 66 Layer-ID</b> suf
1410: 66 69 78 2e 3c 62 72 3e 0d 0a 41 6c 6c 20 74 68 fix.<br>..All th
1420: 65 73 65 20 74 61 62 6c 65 73 20 61 72 65 20 69 ese tables are i
1430: 6e 74 65 6e 64 65 64 20 74 6f 20 70 65 72 6d 61 ntended to perma
1440: 6e 65 6e 74 6c 79 20 73 74 6f 72 65 20 74 68 65 nently store the
1450: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 74 74 information att
1460: 72 69 62 75 74 65 73 20 66 6f 72 20 65 61 63 68 ributes for each
1470: 20 54 6f 70 6f 46 65 61 74 75 72 65 20 69 6e 20 TopoFeature in
1480: 74 68 65 20 73 61 6d 65 20 54 6f 70 6f 4c 61 79 the same TopoLay
1490: 65 72 2e 0d 0a 44 69 66 66 65 72 65 6e 74 20 54 er...Different T
14a0: 6f 70 6f 4c 61 79 65 72 73 20 77 69 6c 6c 20 6f opoLayers will o
14b0: 62 76 69 6f 75 73 6c 79 20 73 75 70 70 6f 72 74 bviously support
14c0: 20 61 20 64 69 66 66 65 72 65 6e 74 20 73 65 74 a different set
14d0: 20 6f 66 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 of information
14e0: 61 74 74 72 69 62 75 74 65 73 20 74 68 75 73 20 attributes thus
14f0: 72 65 71 75 69 72 69 6e 67 20 61 6e 20 69 6e 64 requiring an ind
1500: 69 76 69 64 75 61 6c 20 74 61 62 6c 65 20 6c 61 ividual table la
1510: 79 6f 75 74 2e 3c 62 72 3e 0d 0a 41 6e 79 77 61 yout.<br>..Anywa
1520: 79 20 61 6c 6c 20 74 68 65 73 65 20 74 61 62 6c y all these tabl
1530: 65 73 20 61 72 65 20 61 6c 77 61 79 73 20 65 78 es are always ex
1540: 70 65 63 74 65 64 20 74 6f 20 64 65 63 6c 61 72 pected to declar
1550: 65 20 61 20 3c 62 3e 50 72 69 6d 61 72 79 20 4b e a <b>Primary K
1560: 65 79 3c 2f 62 3e 20 6f 66 20 74 68 65 20 3c 62 ey</b> of the <b
1570: 3e 49 4e 54 45 47 45 52 3c 2f 62 3e 20 74 79 70 >INTEGER</b> typ
1580: 65 20 6e 61 6d 65 64 20 3c 62 3e 66 69 64 3c 2f e named <b>fid</
1590: 62 3e 20 61 6e 64 20 69 6e 74 65 6e 64 65 64 20 b> and intended
15a0: 74 6f 20 62 65 20 61 6e 20 75 6e 69 71 75 65 20 to be an unique
15b0: 69 64 65 6e 74 69 66 69 65 72 20 66 6f 72 20 65 identifier for e
15c0: 61 63 68 20 54 6f 70 6f 46 65 61 74 75 72 65 2e ach TopoFeature.
15d0: 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 </li>..</ul></li
15e0: 3e 0d 0a 3c 6c 69 3e 53 65 76 65 72 61 6c 20 53 >..<li>Several S
15f0: 51 4c 20 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 QL functions are
1600: 20 73 70 65 63 69 66 69 63 61 6c 6c 79 20 69 6e specifically in
1610: 74 65 6e 64 65 64 20 74 6f 20 73 75 70 70 6f 72 tended to suppor
1620: 74 20 70 72 6f 63 65 73 73 69 6e 67 20 6f 70 65 t processing ope
1630: 72 61 74 69 6f 6e 73 20 62 61 73 65 64 20 6f 6e rations based on
1640: 20 54 6f 70 6f 4c 61 79 65 72 73 20 61 6e 64 20 TopoLayers and
1650: 54 6f 70 6f 46 65 61 74 75 72 65 73 3b 20 77 65 TopoFeatures; we
1660: 27 6c 6c 20 65 78 61 6d 69 6e 65 20 6c 61 74 65 'll examine late
1670: 72 20 61 6c 6c 20 74 68 65 6d 20 69 6e 20 66 75 r all them in fu
1680: 6c 6c 20 64 65 74 61 69 6c 2e 3c 2f 6c 69 3e 0d ll detail.</li>.
1690: 0a 3c 2f 75 6c 3e 3c 62 72 3e 3c 62 72 3e 0d 0a .</ul><br><br>..
16a0: 3c 68 72 3e 0d 0a 3c 68 32 3e 61 20 71 75 69 63 <hr>..<h2>a quic
16b0: 6b 20 70 72 61 63 74 69 63 61 6c 20 65 78 65 72 k practical exer
16c0: 63 69 73 65 3c 2f 68 32 3e 0d 0a 50 72 65 72 65 cise</h2>..Prere
16d0: 71 75 69 73 69 74 65 73 3a 0d 0a 3c 6f 6c 3e 0d quisites:..<ol>.
16e0: 0a 3c 6c 69 3e 64 6f 77 6e 6c 6f 61 64 20 74 68 .<li>download th
16f0: 65 20 73 61 6d 70 6c 65 20 44 42 2d 66 69 6c 65 e sample DB-file
1700: 20 66 72 6f 6d 20 3c 61 20 68 72 65 66 3d 22 68 from <a href="h
1710: 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d ttps://www.gaia-
1720: 67 69 73 2e 69 74 2f 67 61 69 61 2d 73 69 6e 73 gis.it/gaia-sins
1730: 2f 74 6f 70 6f 73 61 6d 70 6c 65 73 2f 74 75 73 /toposamples/tus
1740: 63 61 6e 79 2d 63 65 6e 73 75 73 2d 32 30 31 31 cany-census-2011
1750: 2e 37 7a 22 3e 68 65 72 65 3c 2f 61 3e 3c 62 72 .7z">here</a><br
1760: 3e 0d 0a 49 74 20 63 6f 6e 74 61 69 6e 73 20 43 >..It contains C
1770: 65 6e 73 75 73 20 64 61 74 61 20 28 32 30 31 31 ensus data (2011
1780: 29 20 6b 69 6e 64 6c 79 20 72 65 6c 65 61 73 65 ) kindly release
1790: 64 20 62 79 20 49 53 54 41 54 20 75 6e 64 65 72 d by ISTAT under
17a0: 20 3c 62 3e 43 43 2d 42 59 3c 2f 62 3e 20 6c 69 <b>CC-BY</b> li
17b0: 63 65 6e 73 65 20 74 65 72 6d 73 2e 3c 62 72 3e cense terms.<br>
17c0: 0d 0a 54 68 65 20 6f 72 69 67 69 6e 61 6c 20 64 ..The original d
17d0: 61 74 61 73 65 74 73 20 68 61 76 65 20 62 65 65 atasets have bee
17e0: 6e 20 73 6c 69 67 68 74 6c 79 20 72 65 61 72 72 n slightly rearr
17f0: 61 6e 67 65 64 20 69 6e 20 61 20 6d 6f 72 65 20 anged in a more
1800: 63 6f 6e 76 65 6e 69 65 6e 74 20 66 6f 72 6d 2e convenient form.
1810: 0d 0a 41 6c 6c 20 67 65 6f 6d 65 74 72 69 65 73 ..All geometries
1820: 20 61 72 65 20 69 6e 20 74 68 65 20 3c 62 3e 53 are in the <b>S
1830: 52 49 44 20 33 32 36 33 32 3c 2f 62 3e 20 28 3c RID 32632</b> (<
1840: 69 3e 57 47 53 20 38 34 20 2f 20 55 54 4d 20 7a i>WGS 84 / UTM z
1850: 6f 6e 65 20 33 32 4e 3c 2f 69 3e 29 3a 0d 0a 3c one 32N</i>):..<
1860: 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 65 6e 73 ul>..<li><b>cens
1870: 75 73 5f 32 30 31 31 3c 2f 62 3e 3a 20 61 6c 6c us_2011</b>: all
1880: 20 43 65 6e 73 75 73 20 41 72 65 61 73 20 28 32 Census Areas (2
1890: 30 31 31 29 20 63 6f 76 65 72 69 6e 67 20 54 75 011) covering Tu
18a0: 73 63 61 6e 79 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e scany.<br>..<u>N
18b0: 6f 74 65 3a 3c 2f 75 3e 20 73 65 76 65 72 61 6c ote:</u> several
18c0: 20 43 65 6e 73 75 73 20 41 72 65 61 73 20 61 72 Census Areas ar
18d0: 65 20 63 6f 6d 70 6c 65 74 65 6c 79 20 75 6e 69 e completely uni
18e0: 6e 68 61 62 69 74 65 64 20 28 6c 61 6b 65 73 2c nhabited (lakes,
18f0: 20 6d 61 72 73 68 6c 61 6e 64 73 2c 20 68 69 67 marshlands, hig
1900: 68 20 6d 6f 75 6e 74 61 69 6e 73 20 61 6e 64 20 h mountains and
1910: 61 6c 69 6b 65 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c alike).</li>..<l
1920: 69 3e 3c 62 3e 70 70 6c 5f 32 30 31 31 3c 2f 62 i><b>ppl_2011</b
1930: 3e 3a 20 50 6f 70 75 6c 61 74 65 64 20 50 6c 61 >: Populated Pla
1940: 63 65 73 20 28 64 65 66 69 6e 65 64 20 61 73 20 ces (defined as
1950: 61 6e 20 61 67 67 72 65 67 61 74 69 6f 6e 20 6f an aggregation o
1960: 66 20 43 65 6e 73 75 73 20 41 72 65 61 73 29 2e f Census Areas).
1970: 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 <br>..<u>Note</u
1980: 3e 3a 20 6e 6f 74 20 61 6c 6c 20 43 65 6e 73 75 >: not all Censu
1990: 73 20 41 72 65 61 73 20 62 65 6c 6f 6e 67 20 74 s Areas belong t
19a0: 6f 20 61 20 50 6f 70 75 6c 61 74 65 64 20 50 6c o a Populated Pl
19b0: 61 63 65 3a 20 74 68 65 72 65 20 61 72 65 20 6d ace: there are m
19c0: 61 6e 79 20 73 65 6c 66 2d 73 74 61 6e 64 69 6e any self-standin
19d0: 67 20 64 69 73 70 65 72 73 65 64 20 72 75 72 61 g dispersed rura
19e0: 6c 20 61 72 65 61 73 2e 3c 2f 6c 69 3e 0d 0a 3c l areas.</li>..<
19f0: 6c 69 3e 3c 62 3e 63 6f 6d 5f 32 30 31 31 3c 2f li><b>com_2011</
1a00: 62 3e 3a 20 54 75 73 63 61 6e 79 20 4d 75 6e 69 b>: Tuscany Muni
1a10: 63 69 70 61 6c 69 74 69 65 73 20 2f 20 4c 6f 63 cipalities / Loc
1a20: 61 6c 20 43 6f 75 6e 63 69 6c 73 20 32 30 31 31 al Councils 2011
1a30: 20 28 64 65 66 69 6e 65 64 20 61 73 20 61 6e 20 (defined as an
1a40: 61 67 67 72 65 67 61 74 69 6f 6e 73 20 6f 66 20 aggregations of
1a50: 43 65 6e 73 75 73 20 41 72 65 61 73 29 2e 3c 2f Census Areas).</
1a60: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 6f 6d 5f li>..<li><b>com_
1a70: 32 30 31 34 5f 31 35 3c 2f 62 3e 3a 20 66 65 77 2014_15</b>: few
1a80: 20 6e 65 77 20 4d 75 6e 69 63 69 70 61 6c 69 74 new Municipalit
1a90: 69 65 73 20 63 72 65 61 74 65 64 20 64 75 72 69 ies created duri
1aa0: 6e 67 20 79 65 61 72 73 20 32 30 31 34 2f 31 35 ng years 2014/15
1ab0: 20 62 79 20 6d 65 72 67 69 6e 67 20 70 72 65 2d by merging pre-
1ac0: 65 78 69 73 74 69 6e 67 20 73 6d 61 6c 6c 65 72 existing smaller
1ad0: 20 4d 75 6e 69 63 69 70 61 6c 69 74 69 65 73 2e Municipalities.
1ae0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 70 72 </li>..<li><b>pr
1af0: 6f 76 5f 32 30 31 31 3c 2f 62 3e 3a 20 54 75 73 ov_2011</b>: Tus
1b00: 63 61 6e 79 20 50 72 6f 76 69 6e 63 65 73 20 2f cany Provinces /
1b10: 20 43 6f 75 6e 74 69 65 73 20 28 64 65 66 69 6e Counties (defin
1b20: 65 64 20 61 73 20 61 6e 20 61 67 67 72 65 67 61 ed as an aggrega
1b30: 74 69 6f 6e 20 6f 66 20 4d 75 6e 69 63 69 70 61 tion of Municipa
1b40: 6c 69 74 69 65 73 29 2e 3c 2f 6c 69 3e 0d 0a 3c lities).</li>..<
1b50: 6c 69 3e 3c 62 3e 72 65 67 5f 32 30 31 31 3c 2f li><b>reg_2011</
1b60: 62 3e 3a 20 54 75 73 63 61 6e 79 20 52 65 67 69 b>: Tuscany Regi
1b70: 6f 6e 20 28 64 65 66 69 6e 65 64 20 61 73 20 61 on (defined as a
1b80: 6e 20 61 67 67 72 65 67 61 74 69 6f 6e 20 6f 66 n aggregation of
1b90: 20 50 72 6f 76 69 6e 63 65 73 29 2e 3c 2f 6c 69 Provinces).</li
1ba0: 3e 0d 0a 3c 6c 69 3e 6a 75 73 74 20 3c 62 3e 63 >..<li>just <b>c
1bb0: 65 6e 73 75 73 5f 32 30 31 31 3c 2f 62 3e 20 61 ensus_2011</b> a
1bc0: 6c 6f 6e 65 20 73 75 70 70 6f 72 74 73 20 67 65 lone supports ge
1bd0: 6f 6d 65 74 72 69 65 73 3b 20 61 6e 79 20 6f 74 ometries; any ot
1be0: 68 65 72 20 61 64 6d 69 6e 69 73 74 72 61 74 69 her administrati
1bf0: 76 65 20 6c 65 76 65 6c 20 69 73 20 73 69 6d 70 ve level is simp
1c00: 6c 79 20 64 65 66 69 6e 65 64 20 62 79 20 72 65 ly defined by re
1c10: 6c 61 74 69 6f 6e 61 6c 20 63 6f 64 65 73 2e 3c lational codes.<
1c20: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e /li>..</ul></li>
1c30: 0d 0a 3c 6c 69 3e 75 6e 63 6f 6d 70 72 65 73 73 ..<li>uncompress
1c40: 20 74 68 65 20 64 6f 77 6e 6c 6f 61 64 65 64 20 the downloaded
1c50: 64 62 2d 66 69 6c 65 20 28 3c 62 3e 3c 69 3e 74 db-file (<b><i>t
1c60: 75 73 63 61 6e 79 2d 63 65 6e 73 75 73 2d 32 30 uscany-census-20
1c70: 31 31 2e 73 71 6c 69 74 65 3c 2f 69 3e 3c 2f 62 11.sqlite</i></b
1c80: 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 6e 6f >).</li>..<li>no
1c90: 77 20 79 6f 75 20 63 61 6e 20 66 69 6e 61 6c 6c w you can finall
1ca0: 79 20 73 74 61 72 74 20 61 20 53 70 61 74 69 61 y start a Spatia
1cb0: 4c 69 74 65 20 73 65 73 73 69 6f 6e 20 75 73 69 Lite session usi
1cc0: 6e 67 20 79 6f 75 72 20 70 72 65 66 65 72 72 65 ng your preferre
1cd0: 64 20 53 70 61 74 69 61 4c 69 74 65 20 66 72 6f d SpatiaLite fro
1ce0: 6e 74 20 65 6e 64 20 74 6f 6f 6c 3a 0d 0a 3c 75 nt end tool:..<u
1cf0: 6c 3e 0d 0a 3c 6c 69 3e 3c 75 3e 41 74 74 65 6e l>..<li><u>Atten
1d00: 74 69 6f 6e 3c 2f 75 3e 3a 20 79 6f 75 20 6d 75 tion</u>: you mu
1d10: 73 74 20 6e 6f 74 20 64 69 72 65 63 74 6c 79 20 st not directly
1d20: 63 6f 6e 6e 65 63 74 20 74 6f 20 3c 62 3e 3c 69 connect to <b><i
1d30: 3e 74 75 73 63 61 6e 79 2d 63 65 6e 73 75 73 2d >tuscany-census-
1d40: 32 30 31 31 2e 73 71 6c 69 74 65 3c 2f 69 3e 3c 2011.sqlite</i><
1d50: 2f 62 3e 3b 20 79 6f 75 20 61 72 65 20 65 78 70 /b>; you are exp
1d60: 65 63 74 65 64 20 69 6e 73 74 65 61 64 20 74 6f ected instead to
1d70: 20 63 6f 6e 6e 65 63 74 20 61 20 6e 65 77 20 28 connect a new (
1d80: 65 6d 70 74 79 29 20 44 42 2d 66 69 6c 65 20 6e empty) DB-file n
1d90: 61 6d 65 64 20 3c 62 3e 74 75 73 63 61 6e 79 2d amed <b>tuscany-
1da0: 74 6f 70 6f 2d 32 30 31 31 2e 73 71 6c 69 74 65 topo-2011.sqlite
1db0: 3c 2f 62 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e </b></li>..</ul>
1dc0: 3c 2f 6c 69 3e 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c 76 </li>..</ol>..<v
1dd0: 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 erbatim>..SELECT
1de0: 20 43 72 65 61 74 65 54 6f 70 6f 6c 6f 67 79 28 CreateTopology(
1df0: 27 63 65 6e 73 75 73 32 30 31 31 27 2c 20 33 32 'census2011', 32
1e00: 36 33 32 2c 20 30 2c 20 30 29 3b 0d 0a 31 0d 0a 632, 0, 0);..1..
1e10: 0d 0a 41 54 54 41 43 48 20 44 41 54 41 42 41 53 ..ATTACH DATABAS
1e20: 45 20 22 2e 2f 74 75 73 63 61 6e 79 2d 63 65 6e E "./tuscany-cen
1e30: 73 75 73 2d 32 30 31 31 2e 73 71 6c 69 74 65 22 sus-2011.sqlite"
1e40: 20 41 53 20 69 73 74 61 74 3b 0d 0a 0d 0a 53 45 AS istat;....SE
1e50: 4c 45 43 54 20 54 6f 70 6f 47 65 6f 5f 46 72 6f LECT TopoGeo_Fro
1e60: 6d 47 65 6f 54 61 62 6c 65 28 27 63 65 6e 73 75 mGeoTable('censu
1e70: 73 32 30 31 31 27 2c 20 27 69 73 74 61 74 27 2c s2011', 'istat',
1e80: 20 27 63 65 6e 73 75 73 5f 32 30 31 31 27 2c 20 'census_2011',
1e90: 4e 55 4c 4c 2c 20 30 2c 20 35 31 32 2c 20 2d 31 NULL, 0, 512, -1
1ea0: 29 3b 0d 0a 31 0d 0a 0d 0a 53 45 4c 45 43 54 20 );..1....SELECT
1eb0: 53 54 5f 56 61 6c 69 64 61 74 65 54 6f 70 6f 47 ST_ValidateTopoG
1ec0: 65 6f 28 27 63 65 6e 73 75 73 32 30 31 31 27 29 eo('census2011')
1ed0: 3b 0d 0a 4e 55 4c 4c 0d 0a 0d 0a 53 45 4c 45 43 ;..NULL....SELEC
1ee0: 54 20 2a 20 46 52 4f 4d 20 54 45 4d 50 2e 63 65 T * FROM TEMP.ce
1ef0: 6e 73 75 73 32 30 31 31 5f 76 61 6c 69 64 61 74 nsus2011_validat
1f00: 65 5f 74 6f 70 6f 67 65 6f 3b 0d 0a 0d 0a 53 45 e_topogeo;....SE
1f10: 4c 45 43 54 20 54 6f 70 6f 47 65 6f 5f 43 72 65 LECT TopoGeo_Cre
1f20: 61 74 65 54 6f 70 6f 4c 61 79 65 72 28 27 63 65 ateTopoLayer('ce
1f30: 6e 73 75 73 32 30 31 31 27 2c 20 27 69 73 74 61 nsus2011', 'ista
1f40: 74 27 2c 20 27 63 65 6e 73 75 73 5f 32 30 31 31 t', 'census_2011
1f50: 27 2c 20 4e 55 4c 4c 2c 20 27 63 65 6e 73 75 73 ', NULL, 'census
1f60: 5f 61 72 65 61 73 27 29 3b 0d 0a 31 0d 0a 0d 0a _areas');..1....
1f70: 53 45 4c 45 43 54 20 54 6f 70 6f 47 65 6f 5f 49 SELECT TopoGeo_I
1f80: 6e 69 74 54 6f 70 6f 4c 61 79 65 72 28 27 63 65 nitTopoLayer('ce
1f90: 6e 73 75 73 32 30 31 31 27 2c 20 27 69 73 74 61 nsus2011', 'ista
1fa0: 74 27 2c 20 27 70 6f 70 5f 70 70 6c 5f 32 30 31 t', 'pop_ppl_201
1fb0: 31 27 2c 20 27 70 70 6c 27 29 3b 0d 0a 31 0d 0a 1', 'ppl');..1..
1fc0: 0d 0a 53 45 4c 45 43 54 20 54 6f 70 6f 47 65 6f ..SELECT TopoGeo
1fd0: 5f 49 6e 69 74 54 6f 70 6f 4c 61 79 65 72 28 27 _InitTopoLayer('
1fe0: 63 65 6e 73 75 73 32 30 31 31 27 2c 20 27 69 73 census2011', 'is
1ff0: 74 61 74 27 2c 20 27 70 6f 70 5f 63 6f 6d 5f 32 tat', 'pop_com_2
2000: 30 31 31 27 2c 20 27 63 6f 6d 27 29 3b 0d 0a 31 011', 'com');..1
2010: 0d 0a 0d 0a 53 45 4c 45 43 54 20 54 6f 70 6f 47 ....SELECT TopoG
2020: 65 6f 5f 49 6e 69 74 54 6f 70 6f 4c 61 79 65 72 eo_InitTopoLayer
2030: 28 27 63 65 6e 73 75 73 32 30 31 31 27 2c 20 27 ('census2011', '
2040: 69 73 74 61 74 27 2c 20 27 70 6f 70 5f 70 72 6f istat', 'pop_pro
2050: 76 5f 32 30 31 31 27 2c 20 27 70 72 6f 76 27 29 v_2011', 'prov')
2060: 3b 0d 0a 31 0d 0a 0d 0a 53 45 4c 45 43 54 20 54 ;..1....SELECT T
2070: 6f 70 6f 47 65 6f 5f 49 6e 69 74 54 6f 70 6f 4c opoGeo_InitTopoL
2080: 61 79 65 72 28 27 63 65 6e 73 75 73 32 30 31 31 ayer('census2011
2090: 27 2c 20 27 69 73 74 61 74 27 2c 20 27 70 6f 70 ', 'istat', 'pop
20a0: 5f 72 65 67 5f 32 30 31 31 27 2c 20 27 72 65 67 _reg_2011', 'reg
20b0: 27 29 3b 0d 0a 31 0d 0a 0d 0a 44 45 54 41 43 48 ');..1....DETACH
20c0: 20 44 41 54 41 42 41 53 45 20 69 73 74 61 74 3b DATABASE istat;
20d0: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 57 ..</verbatim>..W
20e0: 65 27 6c 6c 20 73 74 61 72 74 20 74 68 69 73 20 e'll start this
20f0: 70 72 61 63 74 69 63 61 6c 20 74 75 74 6f 72 69 practical tutori
2100: 61 6c 20 62 79 20 64 75 6c 79 20 72 65 70 6c 69 al by duly repli
2110: 63 61 74 69 6e 67 20 74 68 65 20 73 61 6d 65 20 cating the same
2120: 73 74 65 70 73 20 77 65 27 76 65 20 61 6c 72 65 steps we've alre
2130: 61 64 79 20 65 78 61 6d 69 6e 65 64 20 69 6e 20 ady examined in
2140: 74 68 65 20 69 6e 74 65 72 6d 65 64 69 61 74 65 the intermediate
2150: 20 74 75 74 6f 72 69 61 6c 3a 0d 0a 3c 75 6c 3e tutorial:..<ul>
2160: 0d 0a 3c 6c 69 3e 77 65 27 6c 6c 20 63 72 65 61 ..<li>we'll crea
2170: 74 65 20 61 20 6e 65 77 20 32 44 20 54 6f 70 6f te a new 2D Topo
2180: 6c 6f 67 79 20 6e 61 6d 65 64 20 3c 62 3e 63 65 logy named <b>ce
2190: 6e 73 75 73 32 30 31 31 3c 2f 62 3e 20 61 6e 64 nsus2011</b> and
21a0: 20 6c 6f 63 61 74 65 64 20 69 6e 74 6f 20 3c 62 located into <b
21b0: 3e 53 52 49 44 20 33 32 36 33 32 3c 2f 62 3e 2e >SRID 32632</b>.
21c0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 6e 20 </li>..<li>then
21d0: 77 65 27 6c 6c 20 3c 69 3e 61 74 74 61 63 68 3c we'll <i>attach<
21e0: 2f 69 3e 20 74 68 65 20 3c 62 3e 74 75 73 63 61 /i> the <b>tusca
21f0: 6e 79 2d 74 6f 70 6f 2d 32 30 31 31 2e 73 71 6c ny-topo-2011.sql
2200: 69 74 65 3c 2f 62 3e 20 65 78 74 65 72 6e 61 6c ite</b> external
2210: 20 44 42 2d 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a DB-file.</li>..
2220: 3c 6c 69 3e 6e 6f 77 20 77 65 27 6c 6c 20 70 6f <li>now we'll po
2230: 70 75 6c 61 74 65 20 74 68 65 20 3c 62 3e 63 65 pulate the <b>ce
2240: 6e 73 75 73 32 30 31 31 3c 2f 62 3e 20 54 6f 70 nsus2011</b> Top
2250: 6f 6c 6f 67 79 20 62 79 20 69 6d 70 6f 72 74 69 ology by importi
2260: 6e 67 20 74 68 65 20 3c 62 3e 69 73 74 61 74 2e ng the <b>istat.
2270: 63 65 6e 73 75 73 5f 32 30 31 31 3c 2f 62 3e 20 census_2011</b>
2280: 47 65 6f 54 61 62 6c 65 2c 20 61 6e 64 20 74 68 GeoTable, and th
2290: 65 6e 20 77 65 27 6c 6c 20 69 6d 6d 65 64 69 61 en we'll immedia
22a0: 74 65 6c 79 20 63 68 65 63 6b 20 69 66 20 74 68 tely check if th
22b0: 69 73 20 54 6f 70 6f 6c 6f 67 79 20 69 73 20 66 is Topology is f
22c0: 75 6c 6c 79 20 76 61 6c 69 64 2e 3c 2f 6c 69 3e ully valid.</li>
22d0: 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 4e 6f 77 ..</ul><br>..Now
22e0: 20 77 65 20 61 72 65 20 66 69 6e 61 6c 6c 79 20 we are finally
22f0: 72 65 61 64 79 20 74 6f 20 73 74 61 72 74 20 64 ready to start d
2300: 65 66 69 6e 69 6e 67 20 61 6c 6c 20 3c 62 3e 54 efining all <b>T
2310: 6f 70 6f 4c 61 79 65 72 73 3c 2f 62 3e 20 62 61 opoLayers</b> ba
2320: 73 65 64 20 6f 6e 20 74 68 65 20 3c 62 3e 63 65 sed on the <b>ce
2330: 6e 73 75 73 32 30 31 31 3c 2f 62 3e 20 54 6f 70 nsus2011</b> Top
2340: 6f 6c 6f 67 79 3b 20 65 61 63 68 20 73 69 6e 67 ology; each sing
2350: 6c 65 20 54 6f 70 6f 4c 61 79 65 72 20 77 69 6c le TopoLayer wil
2360: 6c 20 70 72 65 63 69 73 65 6c 79 20 72 65 70 72 l precisely repr
2370: 65 73 65 6e 74 20 73 6f 6d 65 20 61 64 6d 69 6e esent some admin
2380: 69 73 74 72 61 74 69 76 65 20 6c 65 76 65 6c 2c istrative level,
2390: 20 61 6e 64 20 61 6c 6c 20 54 6f 70 6f 4c 61 79 and all TopoLay
23a0: 65 72 73 20 61 6c 74 6f 67 65 74 68 65 72 20 77 ers altogether w
23b0: 69 6c 6c 20 63 6f 6d 70 6c 65 74 65 6c 79 20 72 ill completely r
23c0: 65 70 72 65 73 65 6e 74 20 74 68 65 20 77 68 6f epresent the who
23d0: 6c 65 20 54 75 73 63 61 6e 20 61 64 6d 69 6e 69 le Tuscan admini
23e0: 73 74 72 61 74 69 76 65 20 68 69 65 72 61 72 63 strative hierarc
23f0: 68 79 2e 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e 73 hy...<ol>..<li>s
2400: 6f 20 77 65 27 6c 6c 20 64 75 6c 79 20 69 6e 76 o we'll duly inv
2410: 6f 6b 65 20 3c 62 3e 54 6f 70 6f 47 65 6f 5f 43 oke <b>TopoGeo_C
2420: 72 65 61 74 65 54 6f 70 6f 4c 61 79 65 72 28 29 reateTopoLayer()
2430: 3c 2f 62 3e 20 69 6e 20 6f 72 64 65 72 20 74 6f </b> in order to
2440: 20 63 6f 6d 70 6c 65 74 65 6c 79 20 64 65 66 69 completely defi
2450: 6e 65 20 61 20 66 69 72 73 74 20 54 6f 70 6f 4c ne a first TopoL
2460: 61 79 65 72 20 72 65 70 72 65 73 65 6e 74 69 6e ayer representin
2470: 67 20 3c 62 3e 43 65 6e 73 75 73 20 41 72 65 61 g <b>Census Area
2480: 73 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 3c 75 3e 52 s</b>.<br>..<u>R
2490: 65 63 61 6c 6c 3c 2f 75 3e 3a 20 74 68 65 20 3c ecall</u>: the <
24a0: 62 3e 69 73 74 61 74 2e 63 65 6e 73 75 73 5f 32 b>istat.census_2
24b0: 30 31 31 3c 2f 62 3e 20 69 73 20 74 68 65 20 75 011</b> is the u
24c0: 6e 69 71 75 65 20 72 65 61 6c 20 47 65 6f 54 61 nique real GeoTa
24d0: 62 6c 65 20 77 65 20 68 61 76 65 20 69 6e 20 6f ble we have in o
24e0: 75 72 20 69 6e 69 74 69 61 6c 20 64 61 74 61 73 ur initial datas
24f0: 65 74 2c 20 62 65 63 61 75 73 65 20 69 74 20 63 et, because it c
2500: 6f 6e 74 61 69 6e 73 20 62 6f 74 68 20 69 6e 66 ontains both inf
2510: 6f 72 6d 61 74 69 6f 6e 20 61 74 74 72 69 62 75 ormation attribu
2520: 74 65 73 20 61 6e 64 20 67 65 6f 6d 65 74 72 69 tes and geometri
2530: 65 73 3b 20 61 6e 64 20 65 61 63 68 20 43 65 6e es; and each Cen
2540: 73 75 73 20 41 72 65 61 20 69 73 20 65 78 70 65 sus Area is expe
2550: 63 74 65 64 20 74 6f 20 64 69 72 65 63 74 6c 79 cted to directly
2560: 20 63 6f 72 72 65 73 70 6f 6e 64 20 74 6f 20 61 correspond to a
2570: 20 73 69 6e 67 6c 65 20 54 6f 70 6f 6c 6f 67 79 single Topology
2580: 20 46 61 63 65 2e 20 28 3c 69 3e 77 65 27 6c 6c Face. (<i>we'll
2590: 20 65 78 61 6d 69 6e 65 20 6c 61 74 65 72 20 69 examine later i
25a0: 6e 20 6d 6f 72 65 20 64 65 70 74 68 20 68 6f 77 n more depth how
25b0: 20 54 6f 70 6f 4c 61 79 65 72 20 2f 20 54 6f 70 TopoLayer / Top
25c0: 6f 46 65 61 74 75 72 65 20 72 65 6c 61 74 69 6f oFeature relatio
25d0: 6e 73 68 69 70 73 20 68 61 76 65 20 62 65 65 6e nships have been
25e0: 20 61 63 74 75 61 6c 6c 79 20 64 65 66 69 6e 65 actually define
25f0: 64 3c 2f 69 3e 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c d</i>).</li>..<l
2600: 69 3e 74 68 65 6e 20 77 65 27 6c 6c 20 63 6f 6e i>then we'll con
2610: 74 69 6e 75 65 20 62 79 20 64 65 66 69 6e 69 6e tinue by definin
2620: 67 20 73 65 76 65 72 61 6c 20 66 75 72 74 68 65 g several furthe
2630: 72 20 54 6f 70 6f 4c 61 79 65 72 73 20 72 65 73 r TopoLayers res
2640: 70 65 63 74 69 76 65 6c 79 20 63 6f 72 72 65 73 pectively corres
2650: 70 6f 6e 64 69 6e 67 20 74 6f 20 3c 62 3e 50 6f ponding to <b>Po
2660: 70 75 6c 61 74 65 64 20 50 6c 61 63 65 73 3c 2f pulated Places</
2670: 62 3e 2c 20 3c 62 3e 4d 75 6e 69 63 69 70 61 6c b>, <b>Municipal
2680: 69 74 69 65 73 3c 2f 62 3e 2c 20 3c 62 3e 50 72 ities</b>, <b>Pr
2690: 6f 76 69 6e 63 65 73 3c 2f 62 3e 20 61 6e 64 20 ovinces</b> and
26a0: 3c 62 3e 52 65 67 69 6f 6e 3c 2f 62 3e 20 61 64 <b>Region</b> ad
26b0: 6d 69 6e 69 73 74 72 61 74 69 76 65 20 6c 65 76 ministrative lev
26c0: 65 6c 73 2e 3c 62 72 3e 0d 0a 3c 75 3e 52 65 63 els.<br>..<u>Rec
26d0: 61 6c 6c 3c 2f 75 3e 3a 20 61 6c 6c 20 74 68 65 all</u>: all the
26e0: 73 65 20 61 64 6d 69 6e 69 73 74 72 61 74 69 76 se administrativ
26f0: 65 20 6c 65 76 65 6c 73 20 69 6e 20 74 68 65 20 e levels in the
2700: 69 6e 69 74 69 61 6c 20 64 61 74 61 73 65 74 20 initial dataset
2710: 61 72 65 20 73 69 6d 70 6c 79 20 64 65 66 69 6e are simply defin
2720: 65 64 20 62 79 20 72 65 6c 61 74 69 6f 6e 61 6c ed by relational
2730: 20 63 6f 64 65 73 20 69 6e 74 65 6e 64 65 64 20 codes intended
2740: 74 6f 20 61 67 67 72 65 67 61 74 65 20 6c 6f 77 to aggregate low
2750: 65 72 20 6c 65 76 65 6c 20 65 6e 74 69 74 69 65 er level entitie
2760: 73 3b 20 69 6e 20 74 68 69 73 20 63 61 73 65 20 s; in this case
2770: 74 68 65 72 65 20 61 72 65 20 6e 6f 20 65 78 70 there are no exp
2780: 6c 69 63 69 74 20 67 65 6f 6d 65 74 72 69 65 73 licit geometries
2790: 20 61 74 20 61 6c 6c 2e 20 53 6f 20 61 72 65 20 at all. So are
27a0: 61 72 65 20 6e 6f 74 20 64 69 72 65 63 74 6c 79 are not directly
27b0: 20 61 6c 6c 6f 77 65 64 20 74 6f 20 63 72 65 61 allowed to crea
27c0: 74 65 20 61 20 66 75 6c 6c 79 20 64 65 66 69 6e te a fully defin
27d0: 65 64 20 54 6f 70 6f 4c 61 79 65 72 2c 20 61 6e ed TopoLayer, an
27e0: 64 20 63 61 6c 6c 69 6e 67 20 3c 62 3e 54 6f 70 d calling <b>Top
27f0: 6f 47 65 6f 5f 43 72 65 61 74 65 54 6f 70 6f 6c oGeo_CreateTopol
2800: 61 79 65 72 28 29 3c 2f 62 3e 20 69 73 20 6a 75 ayer()</b> is ju
2810: 73 74 20 69 6d 70 6f 73 73 69 62 6c 65 20 62 65 st impossible be
2820: 63 61 75 73 65 20 77 65 20 6c 61 63 6b 20 61 6e cause we lack an
2830: 79 20 61 70 70 72 6f 70 72 69 61 74 65 20 47 65 y appropriate Ge
2840: 6f 6d 65 74 72 79 20 63 6f 6c 75 6d 6e 2e 3c 62 ometry column.<b
2850: 72 3e 0d 0a 41 6e 79 77 61 79 20 77 65 20 63 61 r>..Anyway we ca
2860: 6e 20 69 6e 76 6f 6b 65 20 3c 62 3e 54 6f 70 6f n invoke <b>Topo
2870: 47 65 6f 5f 49 6e 69 74 54 6f 70 6f 4c 61 79 65 Geo_InitTopoLaye
2880: 72 28 29 3c 2f 62 3e 3b 20 74 68 69 73 20 77 69 r()</b>; this wi
2890: 6c 6c 20 69 6e 69 74 69 61 6c 69 7a 65 20 61 6e ll initialize an
28a0: 20 6f 6e 6c 79 20 70 61 72 74 69 61 6c 6c 79 20 only partially
28b0: 64 65 66 69 6e 65 64 20 54 6f 70 6f 4c 61 79 65 defined TopoLaye
28c0: 72 2c 20 62 75 74 20 77 65 20 63 61 6e 20 65 61 r, but we can ea
28d0: 73 69 6c 79 20 63 6f 6d 70 6c 65 74 65 20 69 6e sily complete in
28e0: 20 61 20 73 65 63 6f 6e 64 20 74 69 6d 65 20 61 a second time a
28f0: 6e 79 20 6d 69 73 73 69 6e 67 20 69 6e 66 6f 72 ny missing infor
2900: 6d 61 74 69 6f 6e 20 73 6f 20 74 6f 20 67 65 74 mation so to get
2910: 20 61 20 70 72 6f 70 65 72 6c 79 20 77 6f 72 6b a properly work
2920: 69 6e 67 20 54 6f 70 6f 4c 61 79 65 72 20 28 3c ing TopoLayer (<
2930: 69 3e 61 73 20 77 65 27 6c 6c 20 73 65 65 20 6c i>as we'll see l
2940: 61 74 65 72 20 69 6e 20 66 75 6c 6c 20 64 65 74 ater in full det
2950: 61 69 6c 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e ail).</li>..<li>
2960: 66 69 6e 61 6c 6c 79 20 77 65 27 6c 6c 20 3c 69 finally we'll <i
2970: 3e 64 65 74 61 63 68 3c 2f 69 3e 20 74 68 65 20 >detach</i> the
2980: 6e 6f 77 20 75 73 65 6c 65 73 73 20 65 78 74 65 now useless exte
2990: 72 6e 61 6c 20 64 62 2d 66 69 6c 65 2e 3c 2f 6c rnal db-file.</l
29a0: 69 3e 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c 68 72 3e 0d i>..</ol>..<hr>.
29b0: 0a 3c 68 33 3e 54 6f 70 6f 4c 61 79 65 72 73 20 .<h3>TopoLayers
29c0: 2f 20 54 6f 70 6f 46 65 61 74 75 72 65 73 3a 20 / TopoFeatures:
29d0: 6c 61 79 6f 75 74 20 6f 66 20 44 42 20 54 61 62 layout of DB Tab
29e0: 6c 65 73 20 61 6e 64 20 63 6f 72 72 65 73 70 6f les and correspo
29f0: 6e 64 69 6e 67 20 72 65 6c 61 74 69 6f 6e 73 68 nding relationsh
2a00: 69 70 73 3c 2f 68 33 3e 0d 0a 3c 74 61 62 6c 65 ips</h3>..<table
2a10: 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 36 22 cellpadding="6"
2a20: 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 38 22 cellspacing="8"
2a30: 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e >..<tr><td>..<b>
2a40: 3c 3c 69 3e 74 6f 70 6f 2d 70 72 65 66 69 78 3c <<i>topo-prefix<
2a50: 2f 69 3e 3e 5f 74 6f 70 6f 6c 61 79 65 72 73 3c /i>>_topolayers<
2a60: 2f 62 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d /b>..<verbatim>.
2a70: 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 63 .SELECT * FROM c
2a80: 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 6c 61 ensus2011_topola
2a90: 79 65 72 73 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 yers;..</verbati
2aa0: 6d 3e 0d 0a 54 68 65 20 3c 62 3e 54 6f 70 6f 4c m>..The <b>TopoL
2ab0: 61 79 65 72 73 3c 2f 62 3e 20 74 61 62 6c 65 20 ayers</b> table
2ac0: 63 6f 6e 74 61 69 6e 73 20 61 20 64 69 73 74 69 contains a disti
2ad0: 6e 63 74 20 72 6f 77 20 66 6f 72 20 65 76 65 72 nct row for ever
2ae0: 79 20 54 6f 70 6f 4c 61 79 65 72 20 64 65 66 69 y TopoLayer defi
2af0: 6e 65 64 20 6f 6e 20 74 68 65 20 63 75 72 72 65 ned on the curre
2b00: 6e 74 20 54 6f 70 6f 6c 6f 67 79 2e 3c 62 72 3e nt Topology.<br>
2b10: 3c 62 72 3e 0d 0a 45 61 63 68 20 54 6f 70 6f 4c <br>..Each TopoL
2b20: 61 79 65 72 20 69 73 20 69 64 65 6e 74 69 66 69 ayer is identifi
2b30: 65 64 20 62 79 20 61 6e 20 3c 62 3e 69 64 3c 2f ed by an <b>id</
2b40: 62 3e 20 61 6e 64 20 62 79 20 61 20 3c 62 3e 6e b> and by a <b>n
2b50: 61 6d 65 3c 2f 62 3e 3b 20 62 6f 74 68 20 61 72 ame</b>; both ar
2b60: 65 20 72 65 71 75 69 72 65 64 20 74 6f 20 62 65 e required to be
2b70: 20 75 6e 69 71 75 65 20 76 61 6c 75 65 73 2e 0d unique values..
2b80: 0a 3c 2f 74 64 3e 3c 74 64 3e 0d 0a 22 3c 69 3e .</td><td>.."<i>
2b90: 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 6c census2011_topol
2ba0: 61 79 65 72 73 3c 2f 69 3e 22 0d 0a 3c 74 61 62 ayers</i>"..<tab
2bb0: 6c 65 20 63 65 6c 6c 73 70 61 6e 3d 22 34 22 20 le cellspan="4"
2bc0: 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 36 22 20 cellpadding="6"
2bd0: 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66 38 66 30 bgcolor="#f8f8f0
2be0: 22 20 62 6f 72 64 65 72 3d 22 31 22 3e 0d 0a 3c " border="1">..<
2bf0: 74 72 3e 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 tr><td bgcolor="
2c00: 23 66 30 66 30 66 38 22 3e 3c 62 3e 74 6f 70 6f #f0f0f8"><b>topo
2c10: 6c 61 79 65 72 5f 69 64 3c 2f 62 3e 3c 2f 74 64 layer_id</b></td
2c20: 3e 0d 0a 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 >..<td bgcolor="
2c30: 23 66 30 66 30 66 38 22 3e 3c 62 3e 74 6f 70 6f #f0f0f8"><b>topo
2c40: 6c 61 79 65 72 5f 6e 61 6d 65 3c 2f 62 3e 3c 2f layer_name</b></
2c50: 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 td></tr>..<tr><t
2c60: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e d align="right">
2c70: 31 3c 2f 74 64 3e 3c 74 64 3e 63 65 6e 73 75 73 1</td><td>census
2c80: 5f 61 72 65 61 73 3c 2f 74 64 3e 3c 2f 74 72 3e _areas</td></tr>
2c90: 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d ..<tr><td align=
2ca0: 22 72 69 67 68 74 22 3e 32 3c 2f 74 64 3e 3c 74 "right">2</td><t
2cb0: 64 3e 70 70 6c 3c 2f 74 64 3e 3c 2f 74 72 3e 0d d>ppl</td></tr>.
2cc0: 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 .<tr><td align="
2cd0: 72 69 67 68 74 22 3e 33 3c 2f 74 64 3e 3c 74 64 right">3</td><td
2ce0: 3e 63 6f 6d 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a >com</td></tr>..
2cf0: 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 <tr><td align="r
2d00: 69 67 68 74 22 3e 34 3c 2f 74 64 3e 3c 74 64 3e ight">4</td><td>
2d10: 70 72 6f 76 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a prov</td></tr>..
2d20: 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 <tr><td align="r
2d30: 69 67 68 74 22 3e 35 3c 2f 74 64 3e 3c 74 64 3e ight">5</td><td>
2d40: 72 65 67 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c reg</td></tr>..<
2d50: 2f 74 61 62 6c 65 3e 0d 0a 3c 2f 74 64 3e 3c 2f /table>..</td></
2d60: 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c tr>..<tr><td>..<
2d70: 62 3e 3c 3c 69 3e 74 6f 70 6f 2d 70 72 65 66 69 b><<i>topo-prefi
2d80: 78 3c 2f 69 3e 3e 5f 74 6f 70 6f 66 65 61 74 75 x</i>>_topofeatu
2d90: 72 65 73 5f 3c 3c 69 3e 74 6f 70 6f 6c 61 79 65 res_<<i>topolaye
2da0: 72 2d 69 64 3c 2f 69 3e 3e 3c 2f 62 3e 0d 0a 3c r-id</i>></b>..<
2db0: 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 verbatim>..SELEC
2dc0: 54 20 2a 20 46 52 4f 4d 20 63 65 6e 73 75 73 32 T * FROM census2
2dd0: 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 011_topofeatures
2de0: 5f 32 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 2a 20 _2;....SELECT *
2df0: 46 52 4f 4d 20 63 65 6e 73 75 73 32 30 31 31 5f FROM census2011_
2e00: 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 34 3b 0d topofeatures_4;.
2e10: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 54 68 .</verbatim>..Th
2e20: 65 20 73 61 6d 65 20 54 6f 70 6f 6c 6f 67 79 20 e same Topology
2e30: 63 61 6e 20 63 6f 6e 74 61 69 6e 20 6d 6f 72 65 can contain more
2e40: 20 74 68 61 6e 20 61 20 73 69 6e 67 6c 65 20 3c than a single <
2e50: 62 3e 54 6f 70 6f 46 65 61 74 75 72 65 73 3c 2f b>TopoFeatures</
2e60: 62 3e 20 74 61 62 6c 65 2c 20 61 6e 64 20 65 61 b> table, and ea
2e70: 63 68 20 54 6f 70 6f 46 65 61 74 75 72 65 73 20 ch TopoFeatures
2e80: 74 61 62 6c 65 20 63 6f 72 72 65 73 70 6f 6e 64 table correspond
2e90: 73 20 74 6f 20 61 20 73 69 6e 67 6c 65 20 54 6f s to a single To
2ea0: 70 6f 4c 61 79 65 72 2e 3c 62 72 3e 0d 0a 45 76 poLayer.<br>..Ev
2eb0: 65 72 79 20 74 61 62 6c 65 20 63 61 6e 20 68 61 ery table can ha
2ec0: 76 65 20 61 20 73 70 65 63 69 66 69 63 20 6c 61 ve a specific la
2ed0: 79 6f 75 74 20 6f 6e 20 69 74 73 20 6f 77 6e 20 yout on its own
2ee0: 28 73 74 72 69 63 74 6c 79 20 72 65 66 6c 65 63 (strictly reflec
2ef0: 74 69 6e 67 20 74 68 65 20 69 6e 66 6f 72 6d 61 ting the informa
2f00: 74 69 6f 6e 20 61 74 74 72 69 62 75 74 65 73 20 tion attributes
2f10: 66 6f 72 20 65 61 63 68 20 6c 61 79 65 72 29 2c for each layer),
2f20: 20 61 6e 79 77 61 79 20 61 6c 6c 20 74 68 65 6d anyway all them
2f30: 20 77 69 6c 6c 20 68 61 76 65 20 61 20 3c 62 3e will have a <b>
2f40: 75 6e 69 71 75 65 20 54 6f 70 6f 46 65 61 74 75 unique TopoFeatu
2f50: 72 65 20 69 64 65 6e 74 69 66 69 65 72 3c 2f 62 re identifier</b
2f60: 3e 20 28 3c 62 3e 3c 69 3e 66 69 64 3c 2f 69 3e > (<b><i>fid</i>
2f70: 3c 2f 62 3e 29 20 61 63 74 69 6e 67 20 69 6e 20 </b>) acting in
2f80: 74 68 65 20 50 72 69 6d 61 72 79 20 4b 65 79 20 the Primary Key
2f90: 72 6f 6c 65 2e 3c 62 72 3e 0d 0a 54 68 65 20 72 role.<br>..The r
2fa0: 65 6c 61 74 69 6f 6e 73 68 69 70 20 62 65 74 77 elationship betw
2fb0: 65 65 6e 20 74 61 62 6c 65 20 6e 61 6d 65 73 20 een table names
2fc0: 61 6e 64 20 54 6f 70 6f 4c 61 79 65 72 73 20 69 and TopoLayers i
2fd0: 73 20 65 73 74 61 62 6c 69 73 68 65 64 20 62 79 s established by
2fe0: 20 61 70 70 65 6e 64 69 6e 67 20 61 20 6e 75 6d appending a num
2ff0: 65 72 69 63 20 73 75 66 66 69 78 20 74 6f 20 74 eric suffix to t
3000: 68 65 20 63 6f 6d 6d 6f 6e 20 6e 61 6d 65 20 74 he common name t
3010: 68 61 74 20 6d 75 73 74 20 65 78 61 63 74 6c 79 hat must exactly
3020: 20 6d 61 74 63 68 20 74 68 65 20 3c 62 3e 74 6f match the <b>to
3030: 70 6f 6c 61 79 65 72 5f 69 64 3c 2f 62 3e 20 76 polayer_id</b> v
3040: 61 6c 75 65 20 64 65 63 6c 61 72 65 64 20 69 6e alue declared in
3050: 20 74 68 65 20 3c 62 3e 54 6f 70 6f 4c 61 79 65 the <b>TopoLaye
3060: 72 73 3c 2f 62 3e 20 6d 61 69 6e 20 74 61 62 6c rs</b> main tabl
3070: 65 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 41 73 20 69 e.<br><br>..As i
3080: 73 20 73 68 6f 77 6e 20 69 6e 20 74 68 69 73 20 s shown in this
3090: 65 78 61 6d 70 6c 65 20 74 68 65 20 66 69 72 73 example the firs
30a0: 74 20 74 61 62 6c 65 20 3c 62 3e 63 65 6e 73 75 t table <b>censu
30b0: 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 s2011_topofeatur
30c0: 65 73 5f 32 3c 2f 62 3e 20 28 3c 69 3e 74 6f 70 es_2</b> (<i>top
30d0: 6f 6c 61 79 65 72 5f 69 64 3c 2f 69 3e 3d 3c 69 olayer_id</i>=<i
30e0: 3e 32 3c 2f 69 3e 29 20 63 6f 6e 74 61 69 6e 73 >2</i>) contains
30f0: 20 61 6c 6c 20 54 6f 70 6f 46 65 61 74 75 72 65 all TopoFeature
3100: 73 20 61 73 73 6f 63 69 61 74 65 64 20 74 6f 20 s associated to
3110: 74 68 65 20 54 6f 70 6f 4c 61 79 65 72 20 3c 62 the TopoLayer <b
3120: 3e 70 70 6c 3c 2f 62 3e 20 28 3c 69 3e 50 6f 70 >ppl</b> (<i>Pop
3130: 75 6c 61 74 65 64 20 50 6c 61 63 65 73 3c 2f 69 ulated Places</i
3140: 3e 29 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68 65 >).<br><br>..The
3150: 20 73 65 63 6f 6e 64 20 74 61 62 6c 65 20 3c 62 second table <b
3160: 3e 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f >census2011_topo
3170: 66 65 61 74 75 72 65 73 5f 34 3c 2f 62 3e 20 28 features_4</b> (
3180: 3c 69 3e 74 6f 70 6f 6c 61 79 65 72 5f 69 64 3c <i>topolayer_id<
3190: 2f 69 3e 3d 3c 69 3e 34 3c 2f 69 3e 29 20 63 6f /i>=<i>4</i>) co
31a0: 6e 74 61 69 6e 73 20 61 6c 6c 20 54 6f 70 6f 46 ntains all TopoF
31b0: 65 61 74 75 72 65 73 20 61 73 73 6f 63 69 61 74 eatures associat
31c0: 65 64 20 74 6f 20 74 68 65 20 54 6f 70 6f 4c 61 ed to the TopoLa
31d0: 79 65 72 20 3c 62 3e 70 72 6f 76 3c 2f 62 3e 20 yer <b>prov</b>
31e0: 28 3c 69 3e 50 72 6f 76 69 6e 63 65 73 3c 2f 69 (<i>Provinces</i
31f0: 3e 29 2e 0d 0a 3c 2f 74 64 3e 3c 74 64 3e 0d 0a >)...</td><td>..
3200: 22 3c 69 3e 63 65 6e 73 75 73 32 30 31 31 5f 74 "<i>census2011_t
3210: 6f 70 6f 66 65 61 74 75 72 65 73 5f 32 3c 2f 69 opofeatures_2</i
3220: 3e 22 0d 0a 3c 74 61 62 6c 65 20 63 65 6c 6c 73 >"..<table cells
3230: 70 61 6e 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 pan="4" cellpadd
3240: 69 6e 67 3d 22 36 22 20 62 67 63 6f 6c 6f 72 3d ing="6" bgcolor=
3250: 22 23 66 38 66 38 66 30 22 20 62 6f 72 64 65 72 "#f8f8f0" border
3260: 3d 22 31 22 3e 0d 0a 3c 74 72 3e 3c 74 64 20 62 ="1">..<tr><td b
3270: 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 22 gcolor="#f0f0f8"
3280: 3e 3c 62 3e 66 69 64 3c 2f 62 3e 3c 2f 74 64 3e ><b>fid</b></td>
3290: 0d 0a 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 ..<td bgcolor="#
32a0: 66 30 66 30 66 38 22 3e 3c 62 3e 63 6f 64 5f 70 f0f0f8"><b>cod_p
32b0: 70 6c 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 pl</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 63 6f 6d 3c 2f 62 8"><b>cod_com</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 6e 61 6d 65 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a >name</b></td>..
3310: 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 <td bgcolor="#f0
3320: 66 30 66 38 22 3e 3c 62 3e 70 6f 70 5f 32 30 31 f0f8"><b>pop_201
3330: 31 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 1</b></td>..<td
3340: 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 bgcolor="#f0f0f8
3350: 22 3e 3c 62 3e 6d 5f 32 30 31 31 3c 2f 62 3e 3c "><b>m_2011</b><
3360: 2f 74 64 3e 0d 0a 3c 74 64 20 62 67 63 6f 6c 6f /td>..<td bgcolo
3370: 72 3d 22 23 66 30 66 30 66 38 22 3e 3c 62 3e 66 r="#f0f0f8"><b>f
3380: 5f 32 30 31 31 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f _2011</b></td></
3390: 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 tr>..<tr><td ali
33a0: 67 6e 3d 22 72 69 67 68 74 22 3e 31 3c 2f 74 64 gn="right">1</td
33b0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
33c0: 74 22 3e 32 30 35 31 34 32 37 30 35 3c 2f 74 64 t">205142705</td
33d0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
33e0: 74 22 3e 34 35 30 30 31 3c 2f 74 64 3e 3c 74 64 t">45001</td><td
33f0: 3e 41 6c 62 69 61 6e 6f 20 4d 61 67 72 61 3c 2f >Albiano Magra</
3400: 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 td><td align="ri
3410: 67 68 74 22 3e 31 39 30 37 3c 2f 74 64 3e 3c 74 ght">1907</td><t
3420: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e d align="right">
3430: 39 31 39 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 919</td><td alig
3440: 6e 3d 22 72 69 67 68 74 22 3e 39 38 38 3c 2f 74 n="right">988</t
3450: 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 d></tr>..<tr><td
3460: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 align="right">2
3470: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 </td><td align="
3480: 72 69 67 68 74 22 3e 32 30 35 31 34 32 37 30 36 right">205142706
3490: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 </td><td align="
34a0: 72 69 67 68 74 22 3e 34 35 30 30 31 3c 2f 74 64 right">45001</td
34b0: 3e 3c 74 64 3e 41 75 6c 6c 61 3c 2f 74 64 3e 3c ><td>Aulla</td><
34c0: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 td align="right"
34d0: 3e 34 33 32 31 3c 2f 74 64 3e 3c 74 64 20 61 6c >4321</td><td al
34e0: 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 30 34 36 ign="right">2046
34f0: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 </td><td align="
3500: 72 69 67 68 74 22 3e 32 32 37 35 3c 2f 74 64 3e right">2275</td>
3510: 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 </tr>..<tr><td a
3520: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 33 3c 2f lign="right">3</
3530: 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 td><td align="ri
3540: 67 68 74 22 3e 32 30 35 31 34 32 37 31 30 3c 2f ght">205142710</
3550: 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 td><td align="ri
3560: 67 68 74 22 3e 34 35 30 30 31 3c 2f 74 64 3e 3c ght">45001</td><
3570: 74 64 3e 43 61 70 72 69 67 6c 69 6f 6c 61 3c 2f td>Caprigliola</
3580: 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 td><td align="ri
3590: 67 68 74 22 3e 34 38 32 3c 2f 74 64 3e 3c 74 64 ght">482</td><td
35a0: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 align="right">2
35b0: 32 36 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 26</td><td align
35c0: 3d 22 72 69 67 68 74 22 3e 32 35 36 3c 2f 74 64 ="right">256</td
35d0: 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 ></tr>..<tr><td
35e0: 63 6f 6c 73 70 61 6e 3d 22 37 22 20 61 6c 69 67 colspan="7" alig
35f0: 6e 3d 22 63 65 6e 74 65 72 22 3e 3c 68 72 3e 3c n="center"><hr><
3600: 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c /td></tr>..<tr><
3610: 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 td align="right"
3620: 3e 31 30 31 38 3c 2f 74 64 3e 3c 74 64 20 61 6c >1018</td><td al
3630: 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 34 31 30 ign="right">1410
3640: 37 37 35 34 31 35 3c 2f 74 64 3e 3c 74 64 20 61 775415</td><td a
3650: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 30 30 lign="right">100
3660: 30 30 37 3c 2f 74 64 3e 3c 74 64 3e 53 61 73 73 007</td><td>Sass
3670: 65 74 61 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 eta</td><td alig
3680: 6e 3d 22 72 69 67 68 74 22 3e 32 38 35 3c 2f 74 n="right">285</t
3690: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 d><td align="rig
36a0: 68 74 22 3e 31 33 37 3c 2f 74 64 3e 3c 74 64 20 ht">137</td><td
36b0: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 34 align="right">14
36c0: 38 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 8</td></tr>..<tr
36d0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
36e0: 74 22 3e 31 30 31 39 3c 2f 74 64 3e 3c 74 64 20 t">1019</td><td
36f0: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 34 align="right">14
3700: 31 30 37 38 35 34 31 35 3c 2f 74 64 3e 3c 74 64 10785415</td><td
3710: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 align="right">1
3720: 30 30 30 30 37 3c 2f 74 64 3e 3c 74 64 3e 54 65 00007</td><td>Te
3730: 72 72 69 67 6f 6c 69 3c 2f 74 64 3e 3c 74 64 20 rrigoli</td><td
3740: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 35 33 align="right">53
3750: 37 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 7</td><td align=
3760: 22 72 69 67 68 74 22 3e 32 36 34 3c 2f 74 64 3e "right">264</td>
3770: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 <td align="right
3780: 22 3e 32 37 33 3c 2f 74 64 3e 3c 2f 74 72 3e 0d ">273</td></tr>.
3790: 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 3e 0d .</table>..<br>.
37a0: 0a 22 3c 69 3e 63 65 6e 73 75 73 32 30 31 31 5f ."<i>census2011_
37b0: 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 34 3c 2f topofeatures_4</
37c0: 69 3e 22 0d 0a 3c 74 61 62 6c 65 20 63 65 6c 6c i>"..<table cell
37d0: 73 70 61 6e 3d 22 34 22 20 63 65 6c 6c 70 61 64 span="4" cellpad
37e0: 64 69 6e 67 3d 22 36 22 20 62 67 63 6f 6c 6f 72 ding="6" bgcolor
37f0: 3d 22 23 66 38 66 38 66 30 22 20 62 6f 72 64 65 ="#f8f8f0" borde
3800: 72 3d 22 31 22 3e 0d 0a 3c 74 72 3e 3c 74 64 20 r="1">..<tr><td
3810: 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 bgcolor="#f0f0f8
3820: 22 3e 3c 62 3e 66 69 64 3c 2f 62 3e 3c 2f 74 64 "><b>fid</b></td
3830: 3e 0d 0a 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 >..<td bgcolor="
3840: 23 66 30 66 30 66 38 22 3e 3c 62 3e 63 6f 64 5f #f0f0f8"><b>cod_
3850: 70 72 6f 76 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c prov</b></td>..<
3860: 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 td bgcolor="#f0f
3870: 30 66 38 22 3e 3c 62 3e 63 6f 64 5f 72 65 67 3c 0f8"><b>cod_reg<
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 6e 61 6d 65 3c 2f 62 3e 3c 2f 74 64 3e <b>name</b></td>
38b0: 0d 0a 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 ..<td bgcolor="#
38c0: 66 30 66 30 66 38 22 3e 3c 62 3e 61 62 62 72 65 f0f0f8"><b>abbre
38d0: 76 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 v</b></td>..<td
38e0: 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 38 bgcolor="#f0f0f8
38f0: 22 3e 3c 62 3e 70 6f 70 5f 32 30 31 31 3c 2f 62 "><b>pop_2011</b
3900: 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20 62 67 63 6f ></td>..<td bgco
3910: 6c 6f 72 3d 22 23 66 30 66 30 66 38 22 3e 3c 62 lor="#f0f0f8"><b
3920: 3e 6d 5f 32 30 31 31 3c 2f 62 3e 3c 2f 74 64 3e >m_2011</b></td>
3930: 0d 0a 3c 74 64 20 62 67 63 6f 6c 6f 72 3d 22 23 ..<td bgcolor="#
3940: 66 30 66 30 66 38 22 3e 3c 62 3e 66 5f 32 30 31 f0f0f8"><b>f_201
3950: 31 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 1</b></td></tr>.
3960: 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 .<tr><td align="
3970: 72 69 67 68 74 22 3e 31 3c 2f 74 64 3e 3c 74 64 right">1</td><td
3980: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 34 align="right">4
3990: 35 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 5</td><td align=
39a0: 22 72 69 67 68 74 22 3e 39 3c 2f 74 64 3e 3c 74 "right">9</td><t
39b0: 64 3e 4d 61 73 73 61 26 6e 62 73 70 3b 43 61 72 d>Massa Car
39c0: 72 61 72 61 3c 2f 74 64 3e 3c 74 64 3e 4d 53 3c rara</td><td>MS<
39d0: 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 /td><td align="r
39e0: 69 67 68 74 22 3e 31 39 39 36 35 30 3c 2f 74 64 ight">199650</td
39f0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
3a00: 74 22 3e 39 35 37 35 34 3c 2f 74 64 3e 3c 74 64 t">95754</td><td
3a10: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 align="right">1
3a20: 30 33 38 39 36 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 03896</td></tr>.
3a30: 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 .<tr><td align="
3a40: 72 69 67 68 74 22 3e 32 3c 2f 74 64 3e 3c 74 64 right">2</td><td
3a50: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 34 align="right">4
3a60: 36 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 6</td><td align=
3a70: 22 72 69 67 68 74 22 3e 39 3c 2f 74 64 3e 3c 74 "right">9</td><t
3a80: 64 3e 4c 75 63 63 61 3c 2f 74 64 3e 3c 74 64 3e d>Lucca</td><td>
3a90: 4c 55 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e LU</td><td align
3aa0: 3d 22 72 69 67 68 74 22 3e 33 38 38 33 32 37 3c ="right">388327<
3ab0: 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 /td><td align="r
3ac0: 69 67 68 74 22 3e 31 38 36 31 38 33 3c 2f 74 64 ight">186183</td
3ad0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
3ae0: 74 22 3e 32 30 32 31 34 34 3c 2f 74 64 3e 3c 2f t">202144</td></
3af0: 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 tr>..<tr><td ali
3b00: 67 6e 3d 22 72 69 67 68 74 22 3e 33 3c 2f 74 64 gn="right">3</td
3b10: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
3b20: 74 22 3e 34 37 3c 2f 74 64 3e 3c 74 64 20 61 6c t">47</td><td al
3b30: 69 67 6e 3d 22 72 69 67 68 74 22 3e 39 3c 2f 74 ign="right">9</t
3b40: 64 3e 3c 74 64 3e 50 69 73 74 6f 69 61 3c 2f 74 d><td>Pistoia</t
3b50: 64 3e 3c 74 64 3e 50 54 3c 2f 74 64 3e 3c 74 64 d><td>PT</td><td
3b60: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 align="right">2
3b70: 38 37 38 36 36 3c 2f 74 64 3e 3c 74 64 20 61 6c 87866</td><td al
3b80: 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 33 38 30 ign="right">1380
3b90: 35 34 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 54</td><td align
3ba0: 3d 22 72 69 67 68 74 22 3e 31 34 39 38 31 32 3c ="right">149812<
3bb0: 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c /td></tr>..<tr><
3bc0: 74 64 20 63 6f 6c 73 70 61 6e 3d 22 38 22 20 61 td colspan="8" a
3bd0: 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 3c 68 lign="center"><h
3be0: 72 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 r></td></tr>..<t
3bf0: 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 r><td align="rig
3c00: 68 74 22 3e 39 3c 2f 74 64 3e 3c 74 64 20 61 6c ht">9</td><td al
3c10: 69 67 6e 3d 22 72 69 67 68 74 22 3e 35 33 3c 2f ign="right">53</
3c20: 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 td><td align="ri
3c30: 67 68 74 22 3e 39 3c 2f 74 64 3e 3c 74 64 3e 47 ght">9</td><td>G
3c40: 72 6f 73 73 65 74 6f 3c 2f 74 64 3e 3c 74 64 3e rosseto</td><td>
3c50: 47 52 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e GR</td><td align
3c60: 3d 22 72 69 67 68 74 22 3e 32 32 30 35 36 34 3c ="right">220564<
3c70: 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 /td><td align="r
3c80: 69 67 68 74 22 3e 31 30 35 35 38 35 3c 2f 74 64 ight">105585</td
3c90: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
3ca0: 74 22 3e 31 31 34 39 37 39 3c 2f 74 64 3e 3c 2f t">114979</td></
3cb0: 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 tr>..<tr><td ali
3cc0: 67 6e 3d 22 72 69 67 68 74 22 3e 31 30 3c 2f 74 gn="right">10</t
3cd0: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 d><td align="rig
3ce0: 68 74 22 3e 31 30 30 3c 2f 74 64 3e 3c 74 64 20 ht">100</td><td
3cf0: 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 39 3c align="right">9<
3d00: 2f 74 64 3e 3c 74 64 3e 50 72 61 74 6f 3c 2f 74 /td><td>Prato</t
3d10: 64 3e 3c 74 64 3e 50 4f 3c 2f 74 64 3e 3c 74 64 d><td>PO</td><td
3d20: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 align="right">2
3d30: 34 35 39 31 36 3c 2f 74 64 3e 3c 74 64 20 61 6c 45916</td><td al
3d40: 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 31 39 30 ign="right">1190
3d50: 38 38 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 88</td><td align
3d60: 3d 22 72 69 67 68 74 22 3e 31 32 36 38 32 38 3c ="right">126828<
3d70: 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 /td></tr>..</tab
3d80: 6c 65 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d le>..</td></tr>.
3d90: 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 3c 3c .<tr><td>..<b><<
3da0: 69 3e 74 6f 70 6f 2d 70 72 65 66 69 78 3c 2f 69 i>topo-prefix</i
3db0: 3e 3e 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 3c >>_topofeatures<
3dc0: 2f 62 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d /b>..<verbatim>.
3dd0: 0a 53 45 4c 45 43 54 20 2a 20 46 52 4f 4d 20 63 .SELECT * FROM c
3de0: 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 ensus2011_topofe
3df0: 61 74 75 72 65 73 3b 0d 0a 3c 2f 76 65 72 62 61 atures;..</verba
3e00: 74 69 6d 3e 0d 0a 54 68 65 20 3c 62 3e 54 6f 70 tim>..The <b>Top
3e10: 6f 46 65 61 74 75 72 65 73 2d 67 65 6f 6d 65 74 oFeatures-geomet
3e20: 72 69 65 73 3c 2f 62 3e 20 74 61 62 6c 65 20 69 ries</b> table i
3e30: 73 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 70 65 s intended to pe
3e40: 72 6d 61 6e 65 6e 74 6c 79 20 73 74 6f 72 65 20 rmanently store
3e50: 61 6c 6c 20 72 65 6c 61 74 69 6f 6e 73 20 62 65 all relations be
3e60: 74 77 65 65 6e 20 54 6f 70 6f 46 65 61 74 75 72 tween TopoFeatur
3e70: 65 73 20 61 6e 64 20 54 6f 70 6f 6c 6f 67 79 20 es and Topology
3e80: 70 72 69 6d 69 74 69 76 65 73 20 72 65 71 75 69 primitives requi
3e90: 72 65 64 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 red in order to
3ea0: 63 6f 72 72 65 63 74 6c 79 20 62 75 69 6c 64 20 correctly build
3eb0: 74 68 65 20 65 78 70 65 63 74 65 64 20 6f 75 74 the expected out
3ec0: 70 75 74 20 47 65 6f 6d 65 74 72 79 20 66 6f 72 put Geometry for
3ed0: 20 65 61 63 68 20 54 6f 70 6f 46 65 61 74 75 72 each TopoFeatur
3ee0: 65 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 e...<ul>..<li><b
3ef0: 3e 75 69 64 3c 2f 62 3e 20 69 73 20 74 68 65 20 >uid</b> is the
3f00: 50 72 69 6d 61 72 79 20 4b 65 79 2c 20 61 6e 64 Primary Key, and
3f10: 20 69 73 20 73 69 6d 70 6c 79 20 69 6e 74 65 6e is simply inten
3f20: 64 65 64 20 74 6f 20 62 65 20 61 6e 20 75 6e 69 ded to be an uni
3f30: 71 75 65 20 69 64 65 6e 74 69 66 69 65 72 20 66 que identifier f
3f40: 6f 72 20 65 61 63 68 20 72 6f 77 20 62 75 74 20 or each row but
3f50: 64 6f 65 73 6e 27 74 20 69 6e 74 65 6e 64 20 74 doesn't intend t
3f60: 6f 20 68 61 76 65 20 61 6e 79 20 73 70 65 63 69 o have any speci
3f70: 61 6c 20 6d 65 61 6e 69 6e 67 2e 3c 2f 6c 69 3e al meaning.</li>
3f80: 0d 0a 3c 6c 69 3e 3c 62 3e 6e 6f 64 65 5f 69 64 ..<li><b>node_id
3f90: 3c 2f 62 3e 2c 20 3c 62 3e 65 64 67 65 5f 69 64 </b>, <b>edge_id
3fa0: 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 66 61 63 65 </b> and <b>face
3fb0: 5f 69 64 3c 2f 62 3e 20 61 72 65 20 46 6f 72 65 _id</b> are Fore
3fc0: 69 67 6e 20 4b 65 79 73 20 64 69 72 65 63 74 6c ign Keys directl
3fd0: 79 20 72 65 66 65 72 65 6e 63 69 6e 67 20 61 20 y referencing a
3fe0: 54 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 Topology primiti
3ff0: 76 65 3b 20 74 77 6f 20 6f 66 20 74 68 65 73 65 ve; two of these
4000: 20 76 61 6c 75 65 73 20 61 72 65 20 61 6c 77 61 values are alwa
4010: 79 73 20 65 78 70 65 63 74 65 64 20 74 6f 20 62 ys expected to b
4020: 65 20 4e 55 4c 4c 2c 20 61 6e 64 20 6f 6e 6c 79 e NULL, and only
4030: 20 6f 6e 65 20 69 73 20 65 78 70 65 63 74 65 64 one is expected
4040: 20 74 6f 20 65 66 66 65 63 74 69 76 65 6c 79 20 to effectively
4050: 72 65 66 65 72 65 6e 63 65 20 61 20 54 6f 70 6f reference a Topo
4060: 6c 6f 67 79 20 70 72 69 6d 69 74 69 76 65 20 64 logy primitive d
4070: 65 70 65 6e 64 69 6e 67 20 6f 6e 20 69 74 73 20 epending on its
4080: 74 79 70 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e type.</li>..<li>
4090: 3c 62 3e 74 6f 70 6f 6c 61 79 65 72 5f 69 64 3c <b>topolayer_id<
40a0: 2f 62 3e 20 61 6e 64 20 3c 62 3e 66 69 64 3c 2f /b> and <b>fid</
40b0: 62 3e 20 74 6f 67 65 74 68 65 72 20 61 72 65 20 b> together are
40c0: 69 6e 74 65 6e 64 65 64 20 74 6f 20 65 73 74 61 intended to esta
40d0: 62 6c 69 73 68 20 61 20 72 65 6c 61 74 69 6f 6e blish a relation
40e0: 61 6c 20 72 65 66 65 72 65 6e 63 65 20 74 6f 20 al reference to
40f0: 73 6f 6d 65 20 73 70 65 63 69 66 69 63 20 54 6f some specific To
4100: 70 6f 46 65 61 74 75 72 65 2e 3c 2f 6c 69 3e 0d poFeature.</li>.
4110: 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d 0a 3c 75 .</ul>..<br>..<u
4120: 3e 45 78 61 6d 70 6c 65 20 23 31 3c 2f 75 3e 3a >Example #1</u>:
4130: 20 61 6c 6c 20 54 6f 70 6f 6c 6f 67 79 20 70 72 all Topology pr
4140: 69 6d 69 74 69 76 65 73 20 64 69 72 65 63 74 6c imitives directl
4150: 79 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 y referenced by
4160: 72 6f 77 73 20 64 65 63 6c 61 72 69 6e 67 20 3c rows declaring <
4170: 62 3e 74 6f 70 6f 6c 61 79 65 72 5f 69 64 3d 32 b>topolayer_id=2
4180: 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 66 69 64 3d </b> and <b>fid=
4190: 33 3c 2f 62 3e 20 6d 75 73 74 20 62 65 20 61 67 3</b> must be ag
41a0: 67 72 65 67 61 74 65 64 20 69 6e 20 6f 72 64 65 gregated in orde
41b0: 72 20 74 6f 20 62 75 69 6c 64 20 74 68 65 20 6f r to build the o
41c0: 75 74 70 75 74 20 47 65 6f 6d 65 74 72 79 20 63 utput Geometry c
41d0: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 orresponding to
41e0: 74 68 65 20 50 6f 70 75 6c 61 74 65 64 20 50 6c the Populated Pl
41f0: 61 63 65 20 6f 66 20 3c 62 3e 43 61 70 72 69 67 ace of <b>Caprig
4200: 6c 69 6f 6c 61 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a liola</b>.<br>..
4210: 3c 75 3e 45 78 61 6d 70 6c 65 20 23 32 3c 2f 75 <u>Example #2</u
4220: 3e 3a 20 61 6c 6c 20 70 72 69 6d 69 74 69 76 65 >: all primitive
4230: 73 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 s referenced by
4240: 72 6f 77 73 20 64 65 63 6c 61 72 69 6e 67 20 3c rows declaring <
4250: 62 3e 74 6f 70 6f 6c 61 79 65 72 5f 69 64 3d 34 b>topolayer_id=4
4260: 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 66 69 64 3d </b> and <b>fid=
4270: 39 3c 2f 62 3e 20 6d 75 73 74 20 62 65 20 61 67 9</b> must be ag
4280: 67 72 65 67 61 74 65 64 20 69 6e 20 6f 72 64 65 gregated in orde
4290: 72 20 74 6f 20 62 75 69 6c 64 20 74 68 65 20 6f r to build the o
42a0: 75 74 70 75 74 20 47 65 6f 6d 65 74 72 79 20 63 utput Geometry c
42b0: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 orresponding to
42c0: 74 68 65 20 50 72 6f 76 69 6e 63 65 20 6f 66 20 the Province of
42d0: 3c 62 3e 47 72 6f 73 73 65 74 6f 3c 2f 62 3e 2e <b>Grosseto</b>.
42e0: 0d 0a 3c 2f 74 64 3e 3c 74 64 3e 0d 0a 22 3c 69 ..</td><td>.."<i
42f0: 3e 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f >census2011_topo
4300: 66 65 61 74 75 72 65 73 3c 2f 69 3e 22 0d 0a 3c features</i>"..<
4310: 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 6e 3d 22 table cellspan="
4320: 34 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 4" cellpadding="
4330: 36 22 20 62 67 63 6f 6c 6f 72 3d 22 23 66 38 66 6" bgcolor="#f8f
4340: 38 66 30 22 20 62 6f 72 64 65 72 3d 22 31 22 3e 8f0" border="1">
4350: 0d 0a 3c 74 72 3e 3c 74 64 20 62 67 63 6f 6c 6f ..<tr><td bgcolo
4360: 72 3d 22 23 66 30 66 30 66 38 22 3e 3c 62 3e 75 r="#f0f0f8"><b>u
4370: 69 64 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 id</b></td>..<td
4380: 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 66 bgcolor="#f0f0f
4390: 38 22 3e 3c 62 3e 6e 6f 64 65 5f 69 64 3c 2f 62 8"><b>node_id</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 65 64 67 65 5f 69 64 3c 2f 62 3e 3c 2f 74 64 >edge_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 66 61 63 65 #f0f0f8"><b>face
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 74 6f 70 6f 6c 61 79 65 72 f8"><b>topolayer
4420: 5f 69 64 3c 2f 62 3e 3c 2f 74 64 3e 0d 0a 3c 74 _id</b></td>..<t
4430: 64 20 62 67 63 6f 6c 6f 72 3d 22 23 66 30 66 30 d bgcolor="#f0f0
4440: 66 38 22 3e 3c 62 3e 66 69 64 3c 2f 62 3e 3c 2f f8"><b>fid</b></
4450: 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 td></tr>..<tr><t
4460: 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e d align="right">
4470: 31 3c 2f 74 64 3e 3c 74 64 3e 4e 55 4c 4c 3c 2f 1</td><td>NULL</
4480: 74 64 3e 3c 74 64 3e 4e 55 4c 4c 3c 2f 74 64 3e td><td>NULL</td>
4490: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 <td align="right
44a0: 22 3e 31 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 ">1</td><td alig
44b0: 6e 3d 22 72 69 67 68 74 22 3e 31 3c 2f 74 64 3e n="right">1</td>
44c0: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 <td align="right
44d0: 22 3e 31 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c ">1</td></tr>..<
44e0: 74 72 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 tr><td align="ri
44f0: 67 68 74 22 3e 32 3c 2f 74 64 3e 3c 74 64 3e 4e ght">2</td><td>N
4500: 55 4c 4c 3c 2f 74 64 3e 3c 74 64 3e 4e 55 4c 4c ULL</td><td>NULL
4510: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 </td><td align="
4520: 72 69 67 68 74 22 3e 32 3c 2f 74 64 3e 3c 74 64 right">2</td><td
4530: 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 31 align="right">1
4540: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 </td><td align="
4550: 72 69 67 68 74 22 3e 32 3c 2f 74 64 3e 3c 2f 74 right">2</td></t
4560: 72 3e 0d 0a 3c 74 72 3e 3c 74 64 20 61 6c 69 67 r>..<tr><td alig
4570: 6e 3d 22 72 69 67 68 74 22 3e 33 3c 2f 74 64 3e n="right">3</td>
4580: 3c 74 64 3e 4e 55 4c 4c 3c 2f 74 64 3e 3c 74 64 <td>NULL</td><td
4590: 3e 4e 55 4c 4c 3c 2f 74 64 3e 3c 74 64 20 61 6c >NULL</td><td al
45a0: 69 67 6e 3d 22 72 69 67 68 74 22 3e 33 3c 2f 74 ign="right">3</t
45b0: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 d><td align="rig
45c0: 68 74 22 3e 31 3c 2f 74 64 3e 3c 74 64 20 61 6c ht">1</td><td al
45d0: 69 67 6e 3d 22 72 69 67 68 74 22 3e 33 3c 2f 74 ign="right">3</t
45e0: 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 d></tr>..<tr><td
45f0: 20 63 6f 6c 73 70 61 6e 3d 22 36 22 20 61 6c 69 colspan="6" ali
4600: 67 6e 3d 22 63 65 6e 74 65 72 22 3e 3c 68 72 3e gn="center"><hr>
4610: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e </td></tr>..<tr>
4620: 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 74 <td align="right
4630: 22 3e 32 38 38 37 30 3c 2f 74 64 3e 3c 74 64 3e ">28870</td><td>
4640: 4e 55 4c 4c 3c 2f 74 64 3e 3c 74 64 3e 4e 55 4c NULL</td><td>NUL
4650: 4c 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d L</td><td align=
4660: 22 72 69 67 68 74 22 3e 32 38 38 36 34 3c 2f 74 "right">28864</t
4670: 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 d><td align="rig
4680: 68 74 22 3e 31 3c 2f 74 64 3e 3c 74 64 20 61 6c ht">1</td><td al
4690: 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 38 38 36 ign="right">2886
46a0: 37 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 7</td></tr>..<tr
46b0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 67 68 ><td align="righ
46c0: 74 22 3e 32 38 38 37 31 3c 2f 74 64 3e 3c 74 64 t">28871</td><td
46d0: 3e 4e 55 4c 4c 3c 2f 74 64 3e 3c 74 64 3e 4e 55 >NULL</td><td>NU
46e0: 4c 4c 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e LL</td><td align
46f0: 3d 22 72 69 67 68 74 22 3e 32 38 38 36 38 3c 2f ="right">28868</
4700: 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 72 69 td><td align="ri
4710: 67 68 74 22 3e 31 3c 2f 74 64 3e 3c 74 64 20 61 ght">1</td><td a
4720: 6c 69 67 6e 3d 22 72 69 67 68 74 22 3e 32 38 38 lign="right">288
4730: 36 38 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 68</td></tr>..</
4740: 74 61 62 6c 65 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 table>..</td></t
4750: 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 74 r>..</table>..<t
4760: 61 62 6c 65 20 63 65 6c 6c 70 61 64 64 69 6e 67 able cellpadding
4770: 3d 22 38 22 20 62 67 63 6f 6c 6f 72 3d 22 23 64 ="8" bgcolor="#d
4780: 30 66 66 62 30 22 3e 0d 0a 3c 74 72 3e 3c 74 64 0ffb0">..<tr><td
4790: 3e 0d 0a 3c 68 33 3e 46 69 6e 61 6c 20 72 65 6d >..<h3>Final rem
47a0: 61 72 6b 73 3c 2f 68 33 3e 0d 0a 3c 6f 6c 3e 0d arks</h3>..<ol>.
47b0: 0a 3c 6c 69 3e 62 6f 74 68 20 3c 62 3e 54 6f 70 .<li>both <b>Top
47c0: 6f 47 65 6f 5f 43 72 65 61 74 65 54 6f 70 6f 4c oGeo_CreateTopoL
47d0: 61 79 65 72 28 29 3c 2f 62 3e 20 61 6e 64 20 3c ayer()</b> and <
47e0: 62 3e 54 6f 70 6f 47 65 6f 5f 49 6e 69 74 54 6f b>TopoGeo_InitTo
47f0: 70 6f 4c 61 79 65 72 28 29 3c 2f 62 3e 20 77 69 poLayer()</b> wi
4800: 6c 6c 20 72 65 67 69 73 74 65 72 20 74 68 65 20 ll register the
4810: 54 6f 70 6f 4c 61 79 65 72 20 69 6e 74 6f 20 74 TopoLayer into t
4820: 68 65 20 3c 62 3e 54 6f 70 6f 4c 61 79 65 72 73 he <b>TopoLayers
4830: 3c 2f 62 3e 20 74 61 62 6c 65 2c 20 61 6e 64 20 </b> table, and
4840: 77 69 6c 6c 20 63 72 65 61 74 65 20 61 6e 64 20 will create and
4850: 70 6f 70 75 6c 61 74 65 20 74 68 65 20 63 6f 72 populate the cor
4860: 72 65 73 70 6f 6e 64 69 6e 67 20 3c 62 3e 54 6f responding <b>To
4870: 70 6f 46 65 61 74 75 72 65 73 3c 2f 62 3e 20 74 poFeatures</b> t
4880: 61 62 6c 65 20 62 79 20 69 6d 70 6f 72 74 69 6e able by importin
4890: 67 20 61 6c 6c 20 69 6e 66 6f 72 6d 61 74 69 6f g all informatio
48a0: 6e 20 61 74 74 72 69 62 75 74 65 73 20 66 6f 72 n attributes for
48b0: 20 65 61 63 68 20 46 65 61 74 75 72 65 20 64 65 each Feature de
48c0: 66 69 6e 65 64 20 62 79 20 74 68 65 20 72 65 66 fined by the ref
48d0: 65 72 65 6e 63 65 20 74 61 62 6c 65 20 28 6f 72 erence table (or
48e0: 20 72 65 66 65 72 65 6e 63 65 20 76 69 65 77 29 reference view)
48f0: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 6f 6e 6c 79 .</li>..<li>only
4900: 20 3c 62 3e 54 6f 70 6f 47 65 6f 5f 43 72 65 61 <b>TopoGeo_Crea
4910: 74 65 54 6f 70 6f 4c 61 79 65 72 28 29 3c 2f 62 teTopoLayer()</b
4920: 3e 20 77 69 6c 6c 20 61 75 74 6f 6d 61 74 69 63 > will automatic
4930: 61 6c 6c 79 20 70 6f 70 75 6c 61 74 65 20 74 68 ally populate th
4940: 65 20 3c 62 3e 54 6f 70 6f 46 65 61 74 75 72 65 e <b>TopoFeature
4950: 73 2d 67 65 6f 6d 65 74 72 79 3c 2f 62 3e 20 74 s-geometry</b> t
4960: 61 62 6c 65 2c 20 61 6e 64 20 77 68 69 6c 65 20 able, and while
4970: 64 6f 69 6e 67 20 73 6f 2c 20 69 64 65 6e 74 69 doing so, identi
4980: 66 79 20 61 6c 6c 20 72 65 6c 61 74 69 6f 6e 73 fy all relations
4990: 68 69 70 73 20 65 78 69 73 74 69 6e 67 20 62 65 hips existing be
49a0: 74 77 65 65 6e 20 74 68 65 20 47 65 6f 6d 65 74 tween the Geomet
49b0: 72 69 65 73 20 66 6f 75 6e 64 20 69 6e 74 6f 20 ries found into
49c0: 74 68 65 20 72 65 66 65 72 65 6e 63 65 20 74 61 the reference ta
49d0: 62 6c 65 20 6f 72 20 76 69 65 77 20 61 6e 64 20 ble or view and
49e0: 74 68 65 20 54 6f 70 6f 6c 6f 67 79 20 70 72 69 the Topology pri
49f0: 6d 69 74 69 76 65 73 20 62 61 73 65 64 20 6f 6e mitives based on
4a00: 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 74 the values of t
4a10: 68 65 20 3c 62 3e 54 6f 70 6f 53 65 65 64 73 3c he <b>TopoSeeds<
4a20: 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 /b>.</li>..<li>a
4a30: 73 20 61 70 70 6f 73 65 64 20 74 6f 20 3c 62 3e s apposed to <b>
4a40: 54 6f 70 6f 47 65 6f 5f 49 6e 69 74 54 6f 70 6f TopoGeo_InitTopo
4a50: 4c 61 79 65 72 28 29 3c 2f 62 3e 2c 20 77 68 69 Layer()</b>, whi
4a60: 63 68 20 77 69 6c 6c 20 6e 65 76 65 72 20 61 74 ch will never at
4a70: 74 65 6d 70 74 20 74 6f 20 69 64 65 6e 74 69 66 tempt to identif
4a80: 79 20 74 68 65 20 72 65 6c 61 74 69 6f 6e 73 68 y the relationsh
4a90: 69 70 73 20 69 6e 74 65 72 63 75 72 72 69 6e 67 ips intercurring
4aa0: 20 62 65 74 77 65 65 6e 20 6f 75 74 70 75 74 20 between output
4ab0: 47 65 6f 6d 65 74 72 69 65 73 20 61 6e 64 20 54 Geometries and T
4ac0: 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 69 76 opology primitiv
4ad0: 65 73 2e 20 54 68 69 73 20 74 61 73 6b 20 77 69 es. This task wi
4ae0: 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 64 65 66 ll always be def
4af0: 65 72 72 65 64 20 66 6f 72 20 74 68 65 20 75 73 erred for the us
4b00: 65 72 20 74 6f 20 64 65 61 6c 20 77 69 74 68 20 er to deal with
4b10: 6c 61 74 65 72 2e 3c 62 72 3e 0d 0a 59 6f 75 20 later.<br>..You
4b20: 63 6f 75 6c 64 2c 20 66 6f 72 20 65 78 61 6d 70 could, for examp
4b30: 6c 65 2c 20 6d 61 6e 75 61 6c 6c 79 20 73 65 6c le, manually sel
4b40: 65 63 74 20 61 6c 6c 20 54 6f 70 6f 6c 6f 67 79 ect all Topology
4b50: 20 70 72 69 6d 69 74 69 76 65 73 20 63 6f 72 72 primitives corr
4b60: 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 61 20 73 esponding to a s
4b70: 69 6e 67 6c 65 20 54 6f 70 6f 46 65 61 74 75 72 ingle TopoFeatur
4b80: 65 3b 20 6f 72 20 6d 6f 72 65 20 70 72 6f 62 61 e; or more proba
4b90: 62 6c 79 20 79 6f 75 20 63 6f 75 6c 64 20 70 65 bly you could pe
4ba0: 72 66 6f 72 6d 20 74 68 69 73 20 74 61 73 6b 20 rform this task
4bb0: 69 6e 20 61 20 73 65 63 6f 6e 64 20 72 6f 75 6e in a second roun
4bc0: 64 20 62 79 20 65 78 65 63 75 74 69 6e 67 20 73 d by executing s
4bd0: 6f 6d 65 20 61 70 70 72 6f 70 72 69 61 74 65 20 ome appropriate
4be0: 53 51 4c 20 73 74 61 74 65 6d 65 6e 74 20 28 3c SQL statement (<
4bf0: 69 3e 61 73 20 77 65 27 6c 6c 20 73 65 65 6e 20 i>as we'll seen
4c00: 73 6f 6f 6e 20 69 6e 20 74 68 65 20 6e 65 78 74 soon in the next
4c10: 20 65 78 61 6d 70 6c 65 3c 2f 69 3e 29 2e 20 0d example</i>). .
4c20: 0a 3c 2f 6f 6c 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 .</ol>..</td></t
4c30: 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 3c 62 72 3e r>..</table><br>
4c40: 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 54 6f 70 6f ..<hr>..<h3>Topo
4c50: 47 65 6f 5f 45 78 70 6f 72 74 54 6f 70 6f 4c 61 Geo_ExportTopoLa
4c60: 79 65 72 3a 20 65 78 70 6f 72 74 69 6e 67 20 61 yer: exporting a
4c70: 20 66 75 6c 6c 20 54 6f 70 6f 4c 61 79 65 72 20 full TopoLayer
4c80: 69 6e 74 6f 20 61 20 47 65 6f 54 61 62 6c 65 3c into a GeoTable<
4c90: 2f 68 33 3e 0d 0a 3c 74 61 62 6c 65 20 77 69 64 /h3>..<table wid
4ca0: 74 68 3d 22 31 30 30 25 22 20 20 63 65 6c 6c 73 th="100%" cells
4cb0: 70 61 6e 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 pan="4" cellpadd
4cc0: 69 6e 67 3d 22 36 22 20 62 67 63 6f 6c 6f 72 3d ing="6" bgcolor=
4cd0: 22 23 66 38 66 38 66 30 22 20 62 6f 72 64 65 72 "#f8f8f0" border
4ce0: 3d 22 31 22 3e 0d 0a 3c 74 72 3e 3c 74 64 20 63 ="1">..<tr><td c
4cf0: 6f 6c 73 70 61 6e 3d 22 32 22 20 61 6c 69 67 6e olspan="2" align
4d00: 3d 22 63 65 6e 74 65 72 22 3e 3c 62 3e 65 78 70 ="center"><b>exp
4d10: 6f 72 74 69 6e 67 20 74 68 65 20 43 65 6e 73 75 orting the Censu
4d20: 73 20 41 72 65 61 73 20 54 6f 70 6f 4c 61 79 65 s Areas TopoLaye
4d30: 72 3c 2f 62 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d r</b></td></tr>.
4d40: 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 57 65 27 6c 6c .<tr><td>..We'll
4d50: 20 73 74 61 72 74 20 62 79 20 65 78 70 6f 72 74 start by export
4d60: 69 6e 67 20 66 69 72 73 74 20 74 68 65 20 6f 6e ing first the on
4d70: 6c 79 20 63 6f 6d 70 6c 65 74 65 6c 79 20 64 65 ly completely de
4d80: 66 69 6e 65 64 20 54 6f 70 6f 4c 61 79 65 72 20 fined TopoLayer
4d90: 77 65 20 68 61 76 65 20 61 74 20 74 68 69 73 20 we have at this
4da0: 70 6f 69 6e 74 20 69 6e 20 74 68 65 20 74 65 73 point in the tes
4db0: 74 20 44 42 2d 66 69 6c 65 2c 20 69 2e 65 2e 20 t DB-file, i.e.
4dc0: 3c 62 3e 63 65 6e 73 75 73 5f 61 72 65 61 73 3c <b>census_areas<
4dd0: 2f 62 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d /b>..<verbatim>.
4de0: 0a 53 45 4c 45 43 54 20 54 6f 70 6f 47 65 6f 5f .SELECT TopoGeo_
4df0: 45 78 70 6f 72 74 54 6f 70 6f 4c 61 79 65 72 28 ExportTopoLayer(
4e00: 27 63 65 6e 73 75 73 32 30 31 31 27 2c 20 27 63 'census2011', 'c
4e10: 65 6e 73 75 73 5f 61 72 65 61 73 27 2c 20 27 6f ensus_areas', 'o
4e20: 75 74 5f 63 65 6e 73 75 73 5f 32 30 31 31 27 2c ut_census_2011',
4e30: 20 31 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 1);..</verbatim
4e40: 3e 0d 0a 41 73 20 79 6f 75 20 63 61 6e 20 65 61 >..As you can ea
4e50: 73 69 6c 79 20 63 68 65 63 6b 20 62 79 20 79 6f sily check by yo
4e60: 75 72 73 65 6c 66 20 61 20 6e 65 77 20 47 65 6f urself a new Geo
4e70: 54 61 62 6c 65 20 6e 61 6d 65 64 20 3c 62 3e 6f Table named <b>o
4e80: 75 74 5f 63 65 6e 73 75 73 5f 32 30 31 31 3c 2f ut_census_2011</
4e90: 62 3e 20 68 61 73 20 62 65 65 6e 20 63 72 65 61 b> has been crea
4ea0: 74 65 64 20 62 79 20 3c 62 3e 54 6f 70 6f 47 65 ted by <b>TopoGe
4eb0: 6f 5f 45 78 70 6f 72 74 54 6f 70 6f 4c 61 79 65 o_ExportTopoLaye
4ec0: 72 28 29 3c 2f 62 3e 3a 0d 0a 3c 75 6c 3e 0d 0a r()</b>:..<ul>..
4ed0: 3c 6c 69 3e 74 68 69 73 20 47 65 6f 54 61 62 6c <li>this GeoTabl
4ee0: 65 20 63 6f 6e 74 61 69 6e 73 20 61 6c 6c 20 54 e contains all T
4ef0: 6f 70 6f 46 65 61 74 75 72 65 73 20 64 65 66 69 opoFeatures defi
4f00: 6e 65 64 20 69 6e 74 6f 20 74 68 65 20 54 6f 70 ned into the Top
4f10: 6f 4c 61 79 65 72 2e 3c 2f 6c 69 3e 0d 0a 3c 6c oLayer.</li>..<l
4f20: 69 3e 65 61 63 68 20 54 6f 70 6f 46 65 61 74 75 i>each TopoFeatu
4f30: 72 65 20 66 61 69 74 68 66 75 6c 6c 79 20 70 72 re faithfully pr
4f40: 65 73 65 72 76 65 73 20 69 74 73 20 69 6e 69 74 eserves its init
4f50: 69 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 ial information
4f60: 61 74 74 72 69 62 75 74 65 73 2e 3c 2f 6c 69 3e attributes.</li>
4f70: 0d 0a 3c 6c 69 3e 61 6c 6c 20 47 65 6f 6d 65 74 ..<li>all Geomet
4f80: 72 69 65 73 20 61 72 65 20 70 72 65 63 69 73 65 ries are precise
4f90: 6c 79 20 62 75 69 6c 74 20 62 79 20 61 67 67 72 ly built by aggr
4fa0: 65 67 61 74 69 6e 67 20 74 68 65 20 63 6f 72 72 egating the corr
4fb0: 65 73 70 6f 6e 64 69 6e 67 20 54 6f 70 6f 6c 6f esponding Topolo
4fc0: 67 79 20 70 72 69 6d 69 74 69 76 65 73 20 61 73 gy primitives as
4fd0: 20 73 70 65 63 69 66 69 65 64 20 62 79 20 54 6f specified by To
4fe0: 70 6f 4c 61 79 65 72 20 2f 20 54 6f 70 6f 46 65 poLayer / TopoFe
4ff0: 61 74 75 72 65 73 20 72 65 6c 61 74 69 6f 6e 73 atures relations
5000: 68 69 70 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c hips.</li>..</ul
5010: 3e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68 65 20 69 ><br><br>..The i
5020: 6d 61 67 65 20 65 78 61 6d 70 6c 69 66 69 65 73 mage examplifies
5030: 20 61 20 63 68 6f 72 6f 70 6c 65 74 68 20 63 65 a choropleth ce
5040: 6e 74 65 72 65 64 20 61 72 6f 75 6e 64 20 74 68 ntered around th
5050: 65 20 49 73 6c 61 6e 64 20 6f 66 20 45 6c 62 61 e Island of Elba
5060: 20 61 6e 64 20 62 61 73 65 64 20 6f 6e 20 74 68 and based on th
5070: 65 20 3c 62 3e 6f 75 74 5f 63 65 6e 73 75 73 5f e <b>out_census_
5080: 32 30 31 31 3c 2f 62 3e 20 47 65 6f 54 61 62 6c 2011</b> GeoTabl
5090: 65 3a 20 61 6c 6c 20 43 65 6e 73 75 73 20 41 72 e: all Census Ar
50a0: 65 61 73 20 61 72 65 20 64 69 73 70 6c 61 79 65 eas are displaye
50b0: 64 20 62 79 20 61 64 6f 70 74 69 6e 67 20 61 20 d by adopting a
50c0: 63 6f 6c 6f 75 72 20 64 69 72 65 63 74 6c 79 20 colour directly
50d0: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f corresponding to
50e0: 20 74 68 65 69 72 20 70 6f 70 75 6c 61 74 69 6f their populatio
50f0: 6e 20 64 65 6e 73 69 74 79 2e 0d 0a 3c 2f 74 64 n density...</td
5100: 3e 3c 74 64 3e 0d 0a 3c 69 6d 67 20 73 72 63 3d ><td>..<img src=
5110: 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 "https://www.gai
5120: 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d 73 69 a-gis.it/gaia-si
5130: 6e 73 2f 74 6f 70 6f 66 69 67 73 2f 65 6c 62 61 ns/topofigs/elba
5140: 2d 63 68 6f 72 6f 70 6c 65 74 68 2e 70 6e 67 22 -choropleth.png"
5150: 20 61 6c 74 3d 22 65 6c 62 61 2d 63 68 6f 72 6f alt="elba-choro
5160: 70 6c 65 74 68 22 3e 0d 0a 3c 2f 74 64 3e 3c 2f pleth">..</td></
5170: 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 3c 62 72 tr>..</table><br
5180: 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 42 75 69 >..<hr>..<h3>Bui
5190: 6c 64 69 6e 67 20 61 20 66 75 6c 6c 20 68 69 65 lding a full hie
51a0: 72 61 72 63 68 79 20 6f 66 20 41 64 6d 69 6e 69 rarchy of Admini
51b0: 73 74 72 61 74 69 76 65 20 4c 65 76 65 6c 73 20 strative Levels
51c0: 62 79 20 53 51 4c 20 73 74 61 74 65 6d 65 6e 74 by SQL statement
51d0: 73 3c 2f 68 33 3e 0d 0a 41 73 20 77 65 27 76 65 s</h3>..As we've
51e0: 20 61 6c 72 65 61 64 79 20 73 65 65 6e 20 62 65 already seen be
51f0: 66 6f 72 65 20 77 65 20 61 72 65 20 6e 6f 77 20 fore we are now
5200: 65 78 70 65 63 74 65 64 20 74 6f 20 63 6f 6d 70 expected to comp
5210: 6c 65 74 65 20 73 6f 6d 65 77 61 79 20 74 68 65 lete someway the
5220: 20 54 6f 70 6f 46 65 61 74 75 72 65 73 20 64 65 TopoFeatures de
5230: 66 69 6e 69 74 69 6f 6e 73 20 73 75 70 70 6f 72 finitions suppor
5240: 74 69 6e 67 20 74 68 65 20 3c 62 3e 50 6f 70 75 ting the <b>Popu
5250: 6c 61 74 65 64 20 50 6c 61 63 65 73 3c 2f 62 3e lated Places</b>
5260: 2c 20 3c 62 3e 4d 75 6e 69 63 69 70 61 6c 69 74 , <b>Municipalit
5270: 69 65 73 3c 2f 62 3e 2c 20 3c 62 3e 50 72 6f 76 ies</b>, <b>Prov
5280: 69 6e 63 65 73 3c 2f 62 3e 20 61 6e 64 20 3c 62 inces</b> and <b
5290: 3e 52 65 67 69 6f 6e 3c 2f 62 3e 20 54 6f 70 6f >Region</b> Topo
52a0: 4c 61 79 65 72 73 20 77 65 27 76 65 20 70 72 65 Layers we've pre
52b0: 76 69 6f 75 73 6c 79 20 63 72 65 61 74 65 64 20 viously created
52c0: 62 79 20 63 61 6c 6c 69 6e 67 20 3c 62 3e 54 6f by calling <b>To
52d0: 70 6f 47 65 6f 5f 49 6e 69 74 54 6f 70 6f 4c 61 poGeo_InitTopoLa
52e0: 79 65 72 28 29 3c 2f 62 3e 2e 3c 62 72 3e 3c 62 yer()</b>.<br><b
52f0: 72 3e 0d 0a 48 61 70 70 69 6c 79 20 65 6e 6f 75 r>..Happily enou
5300: 67 68 20 61 6c 6c 20 74 68 65 73 65 20 61 64 6d gh all these adm
5310: 69 6e 69 73 74 72 61 74 69 76 65 20 6c 65 76 65 inistrative leve
5320: 6c 73 20 61 72 65 20 73 69 6d 70 6c 79 20 62 61 ls are simply ba
5330: 73 65 64 20 6f 6e 20 64 69 72 65 63 74 20 61 67 sed on direct ag
5340: 67 72 65 67 61 74 69 6f 6e 73 20 6f 66 20 3c 62 gregations of <b
5350: 3e 43 65 6e 73 75 73 20 41 72 65 61 73 3c 2f 62 >Census Areas</b
5360: 3e 2c 20 73 6f 20 77 65 20 6a 75 73 74 20 68 61 >, so we just ha
5370: 76 65 20 74 6f 20 65 78 65 63 75 74 65 20 66 65 ve to execute fe
5380: 77 20 61 70 70 72 6f 70 72 69 61 74 65 20 53 51 w appropriate SQ
5390: 4c 20 73 74 61 74 65 6d 65 6e 74 73 2e 0d 0a 3c L statements...<
53a0: 76 65 72 62 61 74 69 6d 3e 0d 0a 49 4e 53 45 52 verbatim>..INSER
53b0: 54 20 49 4e 54 4f 20 63 65 6e 73 75 73 32 30 31 T INTO census201
53c0: 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 0d 0a 1_topofeatures..
53d0: 53 45 4c 45 43 54 20 4e 55 4c 4c 2c 20 63 2e 6e SELECT NULL, c.n
53e0: 6f 64 65 5f 69 64 2c 20 63 2e 65 64 67 65 5f 69 ode_id, c.edge_i
53f0: 64 2c 20 63 2e 66 61 63 65 5f 69 64 2c 20 32 2c d, c.face_id, 2,
5400: 20 61 2e 66 69 64 0d 0a 46 52 4f 4d 20 63 65 6e a.fid..FROM cen
5410: 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 sus2011_topofeat
5420: 75 72 65 73 5f 32 20 41 53 20 61 0d 0a 4a 4f 49 ures_2 AS a..JOI
5430: 4e 20 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 N census2011_top
5440: 6f 66 65 61 74 75 72 65 73 5f 31 20 41 53 20 62 ofeatures_1 AS b
5450: 20 4f 4e 20 28 62 2e 63 6f 64 5f 70 70 6c 20 3d ON (b.cod_ppl =
5460: 20 61 2e 63 6f 64 5f 70 70 6c 29 0d 0a 4a 4f 49 a.cod_ppl)..JOI
5470: 4e 20 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 N census2011_top
5480: 6f 66 65 61 74 75 72 65 73 20 41 53 20 63 20 4f ofeatures AS c O
5490: 4e 20 28 63 2e 74 6f 70 6f 6c 61 79 65 72 5f 69 N (c.topolayer_i
54a0: 64 20 3d 20 31 20 41 4e 44 20 63 2e 66 69 64 20 d = 1 AND c.fid
54b0: 3d 20 62 2e 66 69 64 29 3b 0d 0a 3c 2f 76 65 72 = b.fid);..</ver
54c0: 62 61 74 69 6d 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c batim>..<ul>..<l
54d0: 69 3e 3c 62 3e 63 65 6e 73 75 73 32 30 31 31 5f i><b>census2011_
54e0: 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 31 3c 2f topofeatures_1</
54f0: 62 3e 20 69 73 20 74 68 65 20 54 6f 70 6f 46 65 b> is the TopoFe
5500: 61 74 75 72 65 73 20 74 61 62 6c 65 20 63 6f 72 atures table cor
5510: 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 3c 62 responding to <b
5520: 3e 43 65 6e 73 75 73 20 41 72 65 61 73 3c 2f 62 >Census Areas</b
5530: 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e >.</li>..<li><b>
5540: 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 census2011_topof
5550: 65 61 74 75 72 65 73 5f 32 3c 2f 62 3e 20 69 73 eatures_2</b> is
5560: 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 73 the corresponds
5570: 20 74 6f 20 3c 62 3e 50 6f 70 75 6c 61 74 65 64 to <b>Populated
5580: 20 50 6c 61 63 65 73 3c 2f 62 3e 3b 20 74 68 65 Places</b>; the
5590: 20 63 6c 61 75 73 65 20 3c 62 3e 62 2e 63 6f 64 clause <b>b.cod
55a0: 5f 70 70 6c 20 3d 20 61 2e 63 6f 64 5f 70 70 6c _ppl = a.cod_ppl
55b0: 3c 2f 62 3e 20 77 69 6c 6c 20 72 65 6c 61 74 69 </b> will relati
55c0: 6f 6e 61 6c 6c 79 20 6a 6f 69 6e 20 65 61 63 68 onally join each
55d0: 20 50 6f 70 75 6c 61 74 65 64 20 50 6c 61 63 65 Populated Place
55e0: 20 74 6f 20 69 74 73 20 75 6e 64 65 72 6c 61 79 to its underlay
55f0: 69 6e 67 20 43 65 6e 73 75 73 20 41 72 65 61 73 ing Census Areas
5600: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 73 6f 20 77 .</li>..<li>so w
5610: 65 20 63 61 6e 20 64 75 6c 79 20 69 6e 73 65 72 e can duly inser
5620: 74 20 69 6e 74 6f 20 74 68 65 20 3c 62 3e 54 6f t into the <b>To
5630: 70 6f 46 65 61 74 75 72 65 73 2d 67 65 6f 6d 65 poFeatures-geome
5640: 74 72 79 3c 2f 62 3e 20 74 61 62 6c 65 20 28 69 try</b> table (i
5650: 2e 65 2e 20 3c 69 3e 63 65 6e 73 75 73 32 30 31 .e. <i>census201
5660: 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 3c 2f 1_topofeatures</
5670: 69 3e 29 20 61 20 6e 65 77 20 6c 65 76 65 6c 20 i>) a new level
5680: 6f 66 20 72 65 66 65 72 65 6e 63 65 73 20 74 6f of references to
5690: 20 54 6f 70 6f 6c 6f 67 79 20 70 72 69 6d 69 74 Topology primit
56a0: 69 76 65 73 20 62 79 20 73 69 6d 70 6c 79 20 63 ives by simply c
56b0: 6f 70 79 69 6e 67 20 61 6c 6c 20 64 65 66 69 6e opying all defin
56c0: 69 74 69 6f 6e 73 20 61 6c 72 65 61 64 79 20 73 itions already s
56d0: 74 6f 72 65 64 20 69 6e 74 6f 20 74 68 65 20 70 tored into the p
56e0: 72 65 76 69 6f 75 73 20 68 69 65 72 61 72 63 68 revious hierarch
56f0: 69 63 61 6c 20 6c 65 76 65 6c 2e 3c 62 72 3e 0d ical level.<br>.
5700: 0a 41 6e 64 20 74 6f 20 64 6f 20 73 75 63 68 20 .And to do such
5710: 61 20 74 68 69 6e 67 20 77 65 20 73 69 6d 70 6c a thing we simpl
5720: 79 20 68 61 76 65 20 74 6f 20 72 65 61 64 20 66 y have to read f
5730: 72 6f 6d 20 3c 62 3e 74 6f 70 6f 6c 61 79 65 72 rom <b>topolayer
5740: 3d 31 3c 2f 62 3e 20 74 68 65 6e 20 69 6e 73 65 =1</b> then inse
5750: 72 74 69 6e 67 20 69 6e 74 6f 20 3c 62 3e 74 6f rting into <b>to
5760: 70 6f 6c 61 79 65 72 3d 32 3c 2f 62 3e 20 61 66 polayer=2</b> af
5770: 74 65 72 20 73 65 74 74 69 6e 67 20 74 68 65 20 ter setting the
5780: 61 70 70 72 6f 70 72 69 61 74 65 20 3c 62 3e 66 appropriate <b>f
5790: 69 64 3c 2f 62 3e 20 76 61 6c 75 65 73 2e 3c 62 id</b> values.<b
57a0: 72 3e 0d 0a 52 65 61 6c 6c 79 20 6e 6f 74 20 61 r>..Really not a
57b0: 20 64 69 66 66 69 63 75 6c 74 20 74 61 73 6b 2e difficult task.
57c0: 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 76 </li>..</ul>..<v
57d0: 65 72 62 61 74 69 6d 3e 0d 0a 49 4e 53 45 52 54 erbatim>..INSERT
57e0: 20 49 4e 54 4f 20 63 65 6e 73 75 73 32 30 31 31 INTO census2011
57f0: 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 0d 0a 53 _topofeatures..S
5800: 45 4c 45 43 54 20 4e 55 4c 4c 2c 20 63 2e 6e 6f ELECT NULL, c.no
5810: 64 65 5f 69 64 2c 20 63 2e 65 64 67 65 5f 69 64 de_id, c.edge_id
5820: 2c 20 63 2e 66 61 63 65 5f 69 64 2c 20 33 2c 20 , c.face_id, 3,
5830: 61 2e 66 69 64 0d 0a 46 52 4f 4d 20 63 65 6e 73 a.fid..FROM cens
5840: 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 us2011_topofeatu
5850: 72 65 73 5f 33 20 41 53 20 61 0d 0a 4a 4f 49 4e res_3 AS a..JOIN
5860: 20 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f census2011_topo
5870: 66 65 61 74 75 72 65 73 5f 31 20 41 53 20 62 20 features_1 AS b
5880: 4f 4e 20 28 62 2e 63 6f 64 5f 63 6f 6d 20 3d 20 ON (b.cod_com =
5890: 61 2e 63 6f 64 5f 63 6f 6d 29 0d 0a 4a 4f 49 4e a.cod_com)..JOIN
58a0: 20 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f census2011_topo
58b0: 66 65 61 74 75 72 65 73 20 41 53 20 63 20 4f 4e features AS c ON
58c0: 20 28 63 2e 74 6f 70 6f 6c 61 79 65 72 5f 69 64 (c.topolayer_id
58d0: 20 3d 20 31 20 41 4e 44 20 63 2e 66 69 64 20 3d = 1 AND c.fid =
58e0: 20 62 2e 66 69 64 29 3b 0d 0a 3c 2f 76 65 72 62 b.fid);..</verb
58f0: 61 74 69 6d 3e 0d 0a 57 65 20 63 61 6e 20 61 64 atim>..We can ad
5900: 6f 70 74 20 65 78 61 63 74 6c 79 20 74 68 65 20 opt exactly the
5910: 73 61 6d 65 20 69 64 65 6e 74 69 63 61 6c 20 61 same identical a
5920: 70 70 72 6f 61 63 68 20 69 6e 20 6f 72 64 65 72 pproach in order
5930: 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 3c 62 3e to complete <b>
5940: 74 6f 70 6f 6c 61 79 65 72 3d 33 3c 2f 62 3e 20 topolayer=3</b>
5950: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f corresponding to
5960: 20 3c 62 3e 4d 75 6e 69 63 69 70 61 6c 69 74 69 <b>Municipaliti
5970: 65 73 3c 2f 62 3e 2e 0d 0a 3c 76 65 72 62 61 74 es</b>...<verbat
5980: 69 6d 3e 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f im>..INSERT INTO
5990: 20 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f census2011_topo
59a0: 66 65 61 74 75 72 65 73 0d 0a 53 45 4c 45 43 54 features..SELECT
59b0: 20 4e 55 4c 4c 2c 20 63 2e 6e 6f 64 65 5f 69 64 NULL, c.node_id
59c0: 2c 20 63 2e 65 64 67 65 5f 69 64 2c 20 63 2e 66 , c.edge_id, c.f
59d0: 61 63 65 5f 69 64 2c 20 34 2c 20 61 2e 66 69 64 ace_id, 4, a.fid
59e0: 0d 0a 46 52 4f 4d 20 63 65 6e 73 75 73 32 30 31 ..FROM census201
59f0: 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 34 1_topofeatures_4
5a00: 20 41 53 20 61 0d 0a 4a 4f 49 4e 20 63 65 6e 73 AS a..JOIN cens
5a10: 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 us2011_topofeatu
5a20: 72 65 73 5f 33 20 41 53 20 62 20 4f 4e 20 28 62 res_3 AS b ON (b
5a30: 2e 63 6f 64 5f 70 72 6f 76 20 3d 20 61 2e 63 6f .cod_prov = a.co
5a40: 64 5f 70 72 6f 76 29 0d 0a 4a 4f 49 4e 20 63 65 d_prov)..JOIN ce
5a50: 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 nsus2011_topofea
5a60: 74 75 72 65 73 20 41 53 20 63 20 4f 4e 20 28 63 tures AS c ON (c
5a70: 2e 74 6f 70 6f 6c 61 79 65 72 5f 69 64 20 3d 20 .topolayer_id =
5a80: 33 20 41 4e 44 20 63 2e 66 69 64 20 3d 20 62 2e 3 AND c.fid = b.
5a90: 66 69 64 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 fid);..</verbati
5aa0: 6d 3e 0d 0a 4d 6f 72 65 20 6f 72 20 6c 65 73 73 m>..More or less
5ab0: 20 74 68 65 20 73 61 6d 65 20 69 73 20 66 6f 72 the same is for
5ac0: 20 64 65 72 69 76 69 6e 67 20 3c 62 3e 74 6f 70 deriving <b>top
5ad0: 6f 6c 61 79 65 72 3d 34 3c 2f 62 3e 20 63 6f 72 olayer=4</b> cor
5ae0: 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 3c 62 responding to <b
5af0: 3e 50 72 6f 76 69 6e 63 65 73 3c 2f 62 3e 3b 20 >Provinces</b>;
5b00: 74 68 69 73 20 74 69 6d 65 20 77 65 27 6c 6c 20 this time we'll
5b10: 73 69 6d 70 6c 79 20 61 67 67 72 65 67 61 74 65 simply aggregate
5b20: 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 the underlying
5b30: 4d 75 6e 69 63 69 70 61 6c 69 74 69 65 73 20 66 Municipalities f
5b40: 72 6f 6d 20 3c 62 3e 74 6f 70 6f 6c 61 79 65 72 rom <b>topolayer
5b50: 3d 33 3c 2f 62 3e 2e 0d 0a 3c 2f 76 65 72 62 61 =3</b>...</verba
5b60: 74 69 6d 3e 0d 0a 57 65 20 63 61 6e 20 61 64 6f tim>..We can ado
5b70: 70 74 20 65 78 61 63 74 6c 79 20 74 68 65 20 73 pt exactly the s
5b80: 61 6d 65 20 69 64 65 6e 74 69 63 61 6c 20 61 70 ame identical ap
5b90: 70 72 6f 61 63 68 20 69 6e 20 6f 72 64 65 72 20 proach in order
5ba0: 74 6f 20 63 6f 6d 70 6c 65 74 65 20 3c 62 3e 74 to complete <b>t
5bb0: 6f 70 6f 6c 61 79 65 72 3d 33 3c 2f 62 3e 20 63 opolayer=3</b> c
5bc0: 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 orresponding to
5bd0: 3c 62 3e 4d 75 6e 69 63 69 70 61 6c 69 74 69 65 <b>Municipalitie
5be0: 73 3c 2f 62 3e 2e 0d 0a 3c 76 65 72 62 61 74 69 s</b>...<verbati
5bf0: 6d 3e 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 m>..INSERT INTO
5c00: 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 census2011_topof
5c10: 65 61 74 75 72 65 73 0d 0a 53 45 4c 45 43 54 20 eatures..SELECT
5c20: 4e 55 4c 4c 2c 20 63 2e 6e 6f 64 65 5f 69 64 2c NULL, c.node_id,
5c30: 20 63 2e 65 64 67 65 5f 69 64 2c 20 63 2e 66 61 c.edge_id, c.fa
5c40: 63 65 5f 69 64 2c 20 35 2c 20 61 2e 66 69 64 0d ce_id, 5, a.fid.
5c50: 0a 46 52 4f 4d 20 63 65 6e 73 75 73 32 30 31 31 .FROM census2011
5c60: 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 5f 35 20 _topofeatures_5
5c70: 41 53 20 61 0d 0a 4a 4f 49 4e 20 63 65 6e 73 75 AS a..JOIN censu
5c80: 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 s2011_topofeatur
5c90: 65 73 5f 34 20 41 53 20 62 20 4f 4e 20 28 62 2e es_4 AS b ON (b.
5ca0: 63 6f 64 5f 72 65 67 20 3d 20 61 2e 63 6f 64 5f cod_reg = a.cod_
5cb0: 72 65 67 29 0d 0a 4a 4f 49 4e 20 63 65 6e 73 75 reg)..JOIN censu
5cc0: 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 s2011_topofeatur
5cd0: 65 73 20 41 53 20 63 20 4f 4e 20 28 63 2e 74 6f es AS c ON (c.to
5ce0: 70 6f 6c 61 79 65 72 5f 69 64 20 3d 20 34 20 41 polayer_id = 4 A
5cf0: 4e 44 20 63 2e 66 69 64 20 3d 20 62 2e 66 69 64 ND c.fid = b.fid
5d00: 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d );..</verbatim>.
5d10: 0a 41 6e 64 20 66 69 6e 61 6c 6c 79 20 77 65 20 .And finally we
5d20: 63 61 6e 20 64 65 72 69 76 65 20 3c 62 3e 74 6f can derive <b>to
5d30: 70 6f 6c 61 79 65 72 3d 35 3c 2f 62 3e 20 63 6f polayer=5</b> co
5d40: 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 3c rresponding to <
5d50: 62 3e 52 65 67 69 6f 6e 73 3c 2f 62 3e 20 62 79 b>Regions</b> by
5d60: 20 64 69 72 65 63 74 6c 79 20 61 67 67 72 65 67 directly aggreg
5d70: 61 74 69 6e 67 20 74 68 65 20 75 6e 64 65 72 6c ating the underl
5d80: 79 69 6e 67 20 50 72 6f 76 69 6e 63 65 73 20 66 ying Provinces f
5d90: 72 6f 6d 20 3c 62 3e 74 6f 70 6f 6c 61 79 65 72 rom <b>topolayer
5da0: 3d 34 3c 2f 62 3e 2e 0d 0a 3c 62 72 3e 3c 62 72 =4</b>...<br><br
5db0: 3e 0d 0a 3c 74 61 62 6c 65 20 77 69 64 74 68 3d >..<table width=
5dc0: 22 31 30 30 25 22 20 20 63 65 6c 6c 73 70 61 6e "100%" cellspan
5dd0: 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 ="4" cellpadding
5de0: 3d 22 36 22 20 62 67 63 6f 6c 6f 72 3d 22 23 66 ="6" bgcolor="#f
5df0: 38 66 38 66 30 22 20 62 6f 72 64 65 72 3d 22 31 8f8f0" border="1
5e00: 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62 ">..<tr><td>..<b
5e10: 3e 73 74 65 70 20 23 31 3a 20 65 78 70 6f 72 74 >step #1: export
5e20: 69 6e 67 20 74 68 65 20 52 65 67 69 6f 6e 20 54 ing the Region T
5e30: 6f 70 6f 4c 61 79 65 72 3c 2f 62 3e 0d 0a 3c 76 opoLayer</b>..<v
5e40: 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 erbatim>..SELECT
5e50: 20 54 6f 70 6f 47 65 6f 5f 45 78 70 6f 72 74 54 TopoGeo_ExportT
5e60: 6f 70 6f 4c 61 79 65 72 28 27 63 65 6e 73 75 73 opoLayer('census
5e70: 32 30 31 31 27 2c 20 27 72 65 67 27 2c 20 27 6f 2011', 'reg', 'o
5e80: 75 74 5f 72 65 67 5f 32 30 31 31 27 2c 20 31 29 ut_reg_2011', 1)
5e90: 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a ;..</verbatim>..
5ea0: 57 65 20 61 72 65 20 6e 6f 77 20 64 65 66 69 6e We are now defin
5eb0: 69 74 65 6c 79 20 72 65 61 64 79 20 74 6f 20 65 itely ready to e
5ec0: 78 70 6f 72 74 20 61 6e 79 20 6f 74 68 65 72 20 xport any other
5ed0: 41 64 6d 69 6e 69 73 74 72 61 74 69 76 65 20 4c Administrative L
5ee0: 65 76 65 6c 2e 3c 62 72 3e 0d 0a 46 6f 72 20 74 evel.<br>..For t
5ef0: 68 65 20 73 61 6b 65 20 6f 66 20 63 6c 61 72 69 he sake of clari
5f00: 74 79 20 77 65 27 6c 6c 20 66 6f 6c 6c 6f 77 20 ty we'll follow
5f10: 61 20 74 6f 70 2d 62 6f 74 74 6f 6d 20 6f 72 64 a top-bottom ord
5f20: 65 72 2c 20 73 6f 20 77 65 27 6c 6c 20 73 74 61 er, so we'll sta
5f30: 72 74 20 62 79 20 65 78 70 6f 72 74 69 6e 67 20 rt by exporting
5f40: 66 69 72 73 74 20 74 68 65 20 77 68 6f 6c 65 20 first the whole
5f50: 54 75 73 63 61 6e 79 2e 0d 0a 3c 2f 74 64 3e 3c Tuscany...</td><
5f60: 74 64 3e 0d 0a 3c 69 6d 67 20 73 72 63 3d 22 68 td>..<img src="h
5f70: 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d ttps://www.gaia-
5f80: 67 69 73 2e 69 74 2f 67 61 69 61 2d 73 69 6e 73 gis.it/gaia-sins
5f90: 2f 74 6f 70 6f 66 69 67 73 2f 74 6f 70 6f 6c 61 /topofigs/topola
5fa0: 79 65 72 2d 72 65 67 69 6f 6e 2e 70 6e 67 22 20 yer-region.png"
5fb0: 61 6c 74 3d 22 74 6f 70 6f 6c 61 79 65 72 2d 72 alt="topolayer-r
5fc0: 65 67 69 6f 6e 22 3e 0d 0a 3c 2f 74 64 3e 3c 2f egion">..</td></
5fd0: 74 72 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c tr>..<tr><td>..<
5fe0: 62 3e 73 74 65 70 20 23 32 3a 20 65 78 70 6f 72 b>step #2: expor
5ff0: 74 69 6e 67 20 74 68 65 20 50 72 6f 76 69 6e 63 ting the Provinc
6000: 65 73 20 54 6f 70 6f 4c 61 79 65 72 3c 2f 62 3e es TopoLayer</b>
6010: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 ..<verbatim>..SE
6020: 4c 45 43 54 20 54 6f 70 6f 47 65 6f 5f 45 78 70 LECT TopoGeo_Exp
6030: 6f 72 74 54 6f 70 6f 4c 61 79 65 72 28 27 63 65 ortTopoLayer('ce
6040: 6e 73 75 73 32 30 31 31 27 2c 20 27 70 72 6f 76 nsus2011', 'prov
6050: 27 2c 20 27 6f 75 74 5f 70 72 6f 76 5f 32 30 31 ', 'out_prov_201
6060: 31 27 2c 20 31 29 3b 0d 0a 3c 2f 76 65 72 62 61 1', 1);..</verba
6070: 74 69 6d 3e 0d 0a 57 65 27 6c 6c 20 63 6f 6e 74 tim>..We'll cont
6080: 69 6e 75 65 20 62 79 20 65 78 70 6f 72 74 69 6e inue by exportin
6090: 67 20 61 6c 6c 20 74 68 65 20 54 75 73 63 61 6e g all the Tuscan
60a0: 79 20 50 72 6f 76 69 6e 63 65 73 2e 0d 0a 3c 2f y Provinces...</
60b0: 74 64 3e 3c 74 64 3e 0d 0a 3c 69 6d 67 20 73 72 td><td>..<img sr
60c0: 63 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 c="https://www.g
60d0: 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d aia-gis.it/gaia-
60e0: 73 69 6e 73 2f 74 6f 70 6f 66 69 67 73 2f 74 6f sins/topofigs/to
60f0: 70 6f 6c 61 79 65 72 2d 70 72 6f 76 69 6e 63 65 polayer-province
6100: 73 2e 70 6e 67 22 20 61 6c 74 3d 22 74 6f 70 6f s.png" alt="topo
6110: 6c 61 79 65 72 2d 70 72 6f 76 69 6e 63 65 73 22 layer-provinces"
6120: 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c >..</td></tr>..<
6130: 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 73 74 65 70 tr><td>..<b>step
6140: 20 23 33 3a 20 65 78 70 6f 72 74 69 6e 67 20 74 #3: exporting t
6150: 68 65 20 4d 75 6e 69 63 69 70 61 6c 69 74 69 65 he Municipalitie
6160: 73 20 54 6f 70 6f 4c 61 79 65 72 3c 2f 62 3e 0d s TopoLayer</b>.
6170: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c .<verbatim>..SEL
6180: 45 43 54 20 54 6f 70 6f 47 65 6f 5f 45 78 70 6f ECT TopoGeo_Expo
6190: 72 74 54 6f 70 6f 4c 61 79 65 72 28 27 63 65 6e rtTopoLayer('cen
61a0: 73 75 73 32 30 31 31 27 2c 20 27 63 6f 6d 27 2c sus2011', 'com',
61b0: 20 27 6f 75 74 5f 63 6f 6d 5f 32 30 31 31 27 2c 'out_com_2011',
61c0: 20 31 29 3b 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 1);..</verbatim
61d0: 3e 0d 0a 54 68 65 6e 20 77 65 27 6c 6c 20 65 78 >..Then we'll ex
61e0: 70 6f 72 74 20 61 6c 6c 20 74 68 65 20 54 75 73 port all the Tus
61f0: 63 61 6e 79 20 4d 75 6e 69 63 69 70 61 6c 69 74 cany Municipalit
6200: 69 65 73 2e 3c 62 72 3e 0d 0a 46 6f 72 20 62 65 ies.<br>..For be
6210: 74 74 65 72 20 63 6c 61 72 69 74 79 20 74 68 65 tter clarity the
6220: 20 66 69 67 75 72 65 20 73 68 6f 77 73 20 61 20 figure shows a
6230: 6d 61 67 6e 69 66 69 65 64 20 64 65 74 61 69 6c magnified detail
6240: 20 63 65 6e 74 65 72 65 64 20 61 72 6f 75 6e 64 centered around
6250: 20 74 68 65 20 49 73 6c 61 6e 64 20 6f 66 20 45 the Island of E
6260: 6c 62 61 2e 0d 0a 3c 2f 74 64 3e 3c 74 64 3e 0d lba...</td><td>.
6270: 0a 3c 69 6d 67 20 73 72 63 3d 22 68 74 74 70 73 .<img src="https
6280: 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e ://www.gaia-gis.
6290: 69 74 2f 67 61 69 61 2d 73 69 6e 73 2f 74 6f 70 it/gaia-sins/top
62a0: 6f 66 69 67 73 2f 74 6f 70 6f 6c 61 79 65 72 2d ofigs/topolayer-
62b0: 6d 75 6e 69 63 69 70 61 6c 69 74 69 65 73 2e 70 municipalities.p
62c0: 6e 67 22 20 61 6c 74 3d 22 74 6f 70 6f 6c 61 79 ng" alt="topolay
62d0: 65 72 2d 6d 75 6e 69 63 69 70 61 6c 69 74 69 65 er-municipalitie
62e0: 73 22 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d s">..</td></tr>.
62f0: 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 62 3e 73 74 .<tr><td>..<b>st
6300: 65 70 20 23 34 3a 20 65 78 70 6f 72 74 69 6e 67 ep #4: exporting
6310: 20 74 68 65 20 50 6f 70 75 6c 61 74 65 64 20 50 the Populated P
6320: 6c 61 63 65 73 20 54 6f 70 6f 4c 61 79 65 72 3c laces TopoLayer<
6330: 2f 62 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d /b>..<verbatim>.
6340: 0a 53 45 4c 45 43 54 20 54 6f 70 6f 47 65 6f 5f .SELECT TopoGeo_
6350: 45 78 70 6f 72 74 54 6f 70 6f 4c 61 79 65 72 28 ExportTopoLayer(
6360: 27 63 65 6e 73 75 73 32 30 31 31 27 2c 20 27 70 'census2011', 'p
6370: 70 6c 27 2c 20 27 6f 75 74 5f 70 70 6c 5f 32 30 pl', 'out_ppl_20
6380: 31 31 27 2c 20 31 29 3b 0d 0a 3c 2f 76 65 72 62 11', 1);..</verb
6390: 61 74 69 6d 3e 0d 0a 41 6e 64 20 77 65 27 6c 6c atim>..And we'll
63a0: 20 66 69 6e 61 6c 6c 79 20 65 78 70 6f 72 74 20 finally export
63b0: 61 6c 6c 20 50 6f 70 75 6c 61 74 65 64 20 50 6c all Populated Pl
63c0: 61 63 65 73 2e 3c 62 72 3e 3c 62 72 3e 3c 62 72 aces.<br><br><br
63d0: 3e 3c 62 72 3e 0d 0a 3c 75 3e 43 6f 6e 63 6c 75 ><br>..<u>Conclu
63e0: 73 69 6f 6e 3c 2f 75 3e 3a 20 77 65 20 73 74 61 sion</u>: we sta
63f0: 72 74 65 64 20 74 68 69 73 20 61 64 76 61 6e 63 rted this advanc
6400: 65 64 20 74 75 74 6f 72 69 61 6c 20 62 79 20 69 ed tutorial by i
6410: 6d 70 6f 72 74 69 6e 67 20 69 6e 74 6f 20 61 20 mporting into a
6420: 54 6f 70 6f 6c 6f 67 79 20 6a 75 73 74 20 61 20 Topology just a
6430: 73 69 6e 67 6c 65 20 6c 61 79 65 72 20 28 43 65 single layer (Ce
6440: 6e 73 75 73 20 41 72 65 61 73 29 20 61 6e 64 20 nsus Areas) and
6450: 6e 6f 77 20 77 65 27 76 65 20 66 69 6e 69 73 68 now we've finish
6460: 65 64 20 62 79 20 70 72 6f 64 75 63 69 6e 67 20 ed by producing
6470: 61 20 63 6f 6d 70 6c 65 74 65 20 73 65 74 20 6f a complete set o
6480: 66 20 61 64 6d 69 6e 69 73 74 72 61 74 69 76 65 f administrative
6490: 20 62 6f 75 6e 64 61 72 69 65 73 20 61 74 20 64 boundaries at d
64a0: 69 66 66 65 72 65 6e 74 20 68 69 65 72 61 72 63 ifferent hierarc
64b0: 68 69 63 61 6c 20 6c 65 76 65 6c 73 3a 0d 0a 3c hical levels:..<
64c0: 75 6c 3e 0d 0a 3c 6c 69 3e 50 6f 70 75 6c 61 74 ul>..<li>Populat
64d0: 65 64 20 50 6c 61 63 65 73 3c 2f 6c 69 3e 0d 0a ed Places</li>..
64e0: 3c 6c 69 3e 4d 75 6e 69 63 69 70 61 6c 69 74 69 <li>Municipaliti
64f0: 65 73 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 72 6f es</li>..<li>Pro
6500: 76 69 6e 63 65 73 3c 2f 6c 69 3e 0d 0a 3c 6c 69 vinces</li>..<li
6510: 3e 52 65 67 69 6f 6e 3c 2f 6c 69 3e 0d 0a 3c 2f >Region</li>..</
6520: 75 6c 3e 0d 0a 3c 2f 74 64 3e 3c 74 64 3e 0d 0a ul>..</td><td>..
6530: 3c 69 6d 67 20 73 72 63 3d 22 68 74 74 70 73 3a <img src="https:
6540: 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 //www.gaia-gis.i
6550: 74 2f 67 61 69 61 2d 73 69 6e 73 2f 74 6f 70 6f t/gaia-sins/topo
6560: 66 69 67 73 2f 74 6f 70 6f 6c 61 79 65 72 2d 70 figs/topolayer-p
6570: 6f 70 75 6c 61 74 65 64 2d 70 6c 61 63 65 73 2e opulated-places.
6580: 70 6e 67 22 20 61 6c 74 3d 22 74 6f 70 6f 6c 61 png" alt="topola
6590: 79 65 72 2d 70 6f 70 75 6c 61 74 65 64 2d 70 6c yer-populated-pl
65a0: 61 63 65 73 22 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 aces">..</td></t
65b0: 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 3c 62 72 3e r>..</table><br>
65c0: 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 74 6f 20 62 ..<hr>..<h3>to b
65d0: 65 20 64 6f 6e 65 3c 2f 68 33 3e 0d 0a 3c 76 65 e done</h3>..<ve
65e0: 72 62 61 74 69 6d 3e 0d 0a 41 54 54 41 43 48 20 rbatim>..ATTACH
65f0: 44 41 54 41 42 41 53 45 20 22 2e 2f 74 75 73 63 DATABASE "./tusc
6600: 61 6e 79 2d 63 65 6e 73 75 73 2d 32 30 31 31 2e any-census-2011.
6610: 73 71 6c 69 74 65 22 20 41 53 20 69 73 74 61 74 sqlite" AS istat
6620: 3b 0d 0a 0d 0a 43 52 45 41 54 45 20 54 41 42 4c ;....CREATE TABL
6630: 45 20 63 6f 6d 32 30 31 35 20 41 53 0d 0a 53 45 E com2015 AS..SE
6640: 4c 45 43 54 20 2a 20 46 52 4f 4d 20 69 73 74 61 LECT * FROM ista
6650: 74 2e 70 6f 70 5f 63 6f 6d 5f 32 30 31 31 3b 0d t.pop_com_2011;.
6660: 0a 0d 0a 49 4e 53 45 52 54 20 49 4e 54 4f 20 63 ...INSERT INTO c
6670: 6f 6d 32 30 31 35 0d 0a 53 45 4c 45 43 54 20 61 om2015..SELECT a
6680: 2e 63 6f 64 5f 63 6f 6d 2c 20 61 2e 63 6f 64 5f .cod_com, a.cod_
6690: 70 72 6f 76 2c 20 61 2e 63 6f 64 5f 69 73 74 61 prov, a.cod_ista
66a0: 74 2c 20 61 2e 63 6f 64 5f 63 61 64 72 61 73 74 t, a.cod_cadrast
66b0: 72 65 2c 20 61 2e 6e 61 6d 65 2c 20 61 2e 74 6f re, a.name, a.to
66c0: 77 6e 68 61 6c 6c 5f 61 64 64 72 2c 0d 0a 20 20 wnhall_addr,..
66d0: 20 20 53 75 6d 28 62 2e 70 6f 70 5f 32 30 31 31 Sum(b.pop_2011
66e0: 29 2c 20 53 75 6d 28 62 2e 6d 5f 32 30 31 31 29 ), Sum(b.m_2011)
66f0: 2c 20 53 75 6d 28 62 2e 66 5f 32 30 31 31 29 0d , Sum(b.f_2011).
6700: 0a 46 52 4f 4d 20 69 73 74 61 74 2e 63 6f 6d 5f .FROM istat.com_
6710: 32 30 31 34 5f 31 35 20 41 53 20 61 0d 0a 4a 4f 2014_15 AS a..JO
6720: 49 4e 20 69 73 74 61 74 2e 70 6f 70 5f 63 6f 6d IN istat.pop_com
6730: 5f 32 30 31 31 20 41 53 20 62 20 4f 4e 20 28 62 _2011 AS b ON (b
6740: 2e 63 6f 64 5f 63 6f 6d 20 49 4e 20 28 61 2e 6f .cod_com IN (a.o
6750: 6c 64 5f 63 6f 64 5f 63 6f 6d 5f 31 2c 20 61 2e ld_cod_com_1, a.
6760: 6f 6c 64 5f 63 6f 64 5f 63 6f 6d 5f 32 29 29 0d old_cod_com_2)).
6770: 0a 47 52 4f 55 50 20 42 59 20 61 2e 63 6f 64 5f .GROUP BY a.cod_
6780: 63 6f 6d 3b 0d 0a 0d 0a 44 45 54 41 43 48 20 44 com;....DETACH D
6790: 41 54 41 42 41 53 45 20 69 73 74 61 74 3b 0d 0a ATABASE istat;..
67a0: 0d 0a 53 45 4c 45 43 54 20 54 6f 70 6f 47 65 6f ..SELECT TopoGeo
67b0: 5f 49 6e 69 74 54 6f 70 6f 4c 61 79 65 72 28 27 _InitTopoLayer('
67c0: 63 65 6e 73 75 73 32 30 31 31 27 2c 20 4e 55 4c census2011', NUL
67d0: 4c 2c 20 27 63 6f 6d 32 30 31 35 27 2c 20 27 63 L, 'com2015', 'c
67e0: 6f 6d 32 30 31 35 27 29 3b 0d 0a 0d 0a 49 4e 53 om2015');....INS
67f0: 45 52 54 20 49 4e 54 4f 20 63 65 6e 73 75 73 32 ERT INTO census2
6800: 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 011_topofeatures
6810: 0d 0a 53 45 4c 45 43 54 20 4e 55 4c 4c 2c 20 61 ..SELECT NULL, a
6820: 2e 6e 6f 64 65 5f 69 64 2c 20 61 2e 65 64 67 65 .node_id, a.edge
6830: 5f 69 64 2c 20 61 2e 66 61 63 65 5f 69 64 2c 20 _id, a.face_id,
6840: 36 2c 20 61 2e 66 69 64 0d 0a 46 52 4f 4d 20 63 6, a.fid..FROM c
6850: 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 ensus2011_topofe
6860: 61 74 75 72 65 73 20 41 53 20 61 0d 0a 4a 4f 49 atures AS a..JOI
6870: 4e 20 63 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 N census2011_top
6880: 6f 66 65 61 74 75 72 65 73 5f 33 20 41 53 20 62 ofeatures_3 AS b
6890: 20 4f 4e 20 28 61 2e 74 6f 70 6f 6c 61 79 65 72 ON (a.topolayer
68a0: 5f 69 64 20 3d 20 33 20 41 4e 44 20 61 2e 66 69 _id = 3 AND a.fi
68b0: 64 20 3d 20 62 2e 66 69 64 29 3b 0d 0a 0d 0a 55 d = b.fid);....U
68c0: 50 44 41 54 45 20 63 65 6e 73 75 73 32 30 31 31 PDATE census2011
68d0: 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 0d 0a 53 _topofeatures..S
68e0: 45 54 20 66 69 64 20 3d 20 28 53 45 4c 45 43 54 ET fid = (SELECT
68f0: 20 66 69 64 20 46 52 4f 4d 20 63 65 6e 73 75 73 fid FROM census
6900: 32 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 2011_topofeature
6910: 73 5f 36 20 57 48 45 52 45 20 63 6f 64 5f 63 6f s_6 WHERE cod_co
6920: 6d 20 3d 20 35 31 30 34 30 29 0d 0a 57 48 45 52 m = 51040)..WHER
6930: 45 20 74 6f 70 6f 6c 61 79 65 72 5f 69 64 20 3d E topolayer_id =
6940: 20 36 20 41 4e 44 20 66 69 64 20 49 4e 20 28 53 6 AND fid IN (S
6950: 45 4c 45 43 54 20 66 69 64 20 46 52 4f 4d 20 63 ELECT fid FROM c
6960: 65 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 ensus2011_topofe
6970: 61 74 75 72 65 73 5f 36 20 57 48 45 52 45 20 63 atures_6 WHERE c
6980: 6f 64 5f 63 6f 6d 20 69 6e 20 28 35 31 30 30 39 od_com in (51009
6990: 2c 20 35 31 30 32 39 29 29 3b 0d 0a 0d 0a 55 50 , 51029));....UP
69a0: 44 41 54 45 20 63 65 6e 73 75 73 32 30 31 31 5f DATE census2011_
69b0: 74 6f 70 6f 66 65 61 74 75 72 65 73 0d 0a 53 45 topofeatures..SE
69c0: 54 20 66 69 64 20 3d 20 28 53 45 4c 45 43 54 20 T fid = (SELECT
69d0: 66 69 64 20 46 52 4f 4d 20 63 65 6e 73 75 73 32 fid FROM census2
69e0: 30 31 31 5f 74 6f 70 6f 66 65 61 74 75 72 65 73 011_topofeatures
69f0: 5f 36 20 57 48 45 52 45 20 63 6f 64 5f 63 6f 6d _6 WHERE cod_com
6a00: 20 3d 20 35 31 30 34 31 29 0d 0a 57 48 45 52 45 = 51041)..WHERE
6a10: 20 74 6f 70 6f 6c 61 79 65 72 5f 69 64 20 3d 20 topolayer_id =
6a20: 36 20 41 4e 44 20 66 69 64 20 49 4e 20 28 53 45 6 AND fid IN (SE
6a30: 4c 45 43 54 20 66 69 64 20 46 52 4f 4d 20 63 65 LECT fid FROM ce
6a40: 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 nsus2011_topofea
6a50: 74 75 72 65 73 5f 36 20 57 48 45 52 45 20 63 6f tures_6 WHERE co
6a60: 64 5f 63 6f 6d 20 69 6e 20 28 35 31 30 33 32 2c d_com in (51032,
6a70: 20 35 31 30 33 36 29 29 3b 0d 0a 0d 0a 53 45 4c 51036));....SEL
6a80: 45 43 54 20 54 6f 70 6f 47 65 6f 5f 45 78 70 6f ECT TopoGeo_Expo
6a90: 72 74 54 6f 70 6f 4c 61 79 65 72 28 27 63 65 6e rtTopoLayer('cen
6aa0: 73 75 73 32 30 31 31 27 2c 20 27 63 6f 6d 32 30 sus2011', 'com20
6ab0: 31 35 27 2c 20 27 6f 75 74 5f 63 6f 6d 5f 32 30 15', 'out_com_20
6ac0: 31 35 27 2c 20 31 2c 20 31 29 3b 0d 0a 0d 0a 53 15', 1, 1);....S
6ad0: 45 4c 45 43 54 20 54 6f 70 6f 47 65 6f 5f 49 6e ELECT TopoGeo_In
6ae0: 73 65 72 74 46 65 61 74 75 72 65 46 72 6f 6d 54 sertFeatureFromT
6af0: 6f 70 6f 4c 61 79 65 72 20 28 27 63 65 6e 73 75 opoLayer ('censu
6b00: 73 32 30 31 31 27 2c 20 27 63 6f 6d 32 30 31 35 s2011', 'com2015
6b10: 27 2c 20 27 6f 75 74 5f 63 6f 6d 5f 32 30 31 35 ', 'out_com_2015
6b20: 27 2c 20 66 69 64 29 0d 0a 46 52 4f 4d 20 63 65 ', fid)..FROM ce
6b30: 6e 73 75 73 32 30 31 31 5f 74 6f 70 6f 66 65 61 nsus2011_topofea
6b40: 74 75 72 65 73 5f 38 0d 0a 57 48 45 52 45 20 63 tures_8..WHERE c
6b50: 6f 64 5f 70 72 6f 76 20 3d 20 35 31 20 41 4e 44 od_prov = 51 AND
6b60: 20 63 6f 64 5f 63 6f 6d 20 4e 4f 54 20 49 4e 20 cod_com NOT IN
6b70: 28 35 31 30 30 39 2c 20 35 31 30 32 39 2c 20 35 (51009, 51029, 5
6b80: 31 30 33 32 2c 20 35 31 30 33 36 29 3b 0d 0a 3c 1032, 51036);..<
6b90: 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 74 61 62 /verbatim>..<tab
6ba0: 6c 65 20 77 69 64 74 68 3d 22 31 30 30 25 22 20 le width="100%"
6bb0: 20 63 65 6c 6c 73 70 61 6e 3d 22 34 22 20 63 65 cellspan="4" ce
6bc0: 6c 6c 70 61 64 64 69 6e 67 3d 22 36 22 20 62 67 llpadding="6" bg
6bd0: 63 6f 6c 6f 72 3d 22 23 66 38 66 38 66 30 22 20 color="#f8f8f0"
6be0: 62 6f 72 64 65 72 3d 22 31 22 3e 0d 0a 3c 74 72 border="1">..<tr
6bf0: 3e 3c 74 64 3e 0d 0a 41 52 20 32 30 31 31 0d 0a ><td>..AR 2011..
6c00: 3c 2f 74 64 3e 3c 74 64 3e 0d 0a 3c 69 6d 67 20 </td><td>..<img
6c10: 73 72 63 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 src="https://www
6c20: 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 .gaia-gis.it/gai
6c30: 61 2d 73 69 6e 73 2f 74 6f 70 6f 66 69 67 73 2f a-sins/topofigs/
6c40: 74 6f 70 6f 2d 61 72 2d 32 30 31 31 2e 70 6e 67 topo-ar-2011.png
6c50: 22 20 61 6c 74 3d 22 74 6f 70 6f 2d 61 72 2d 32 " alt="topo-ar-2
6c60: 30 31 31 22 3e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 011">..</td></tr
6c70: 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 41 52 20 >..<tr><td>..AR
6c80: 32 30 31 35 0d 0a 3c 2f 74 64 3e 3c 74 64 3e 0d 2015..</td><td>.
6c90: 0a 3c 69 6d 67 20 73 72 63 3d 22 68 74 74 70 73 .<img src="https
6ca0: 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e ://www.gaia-gis.
6cb0: 69 74 2f 67 61 69 61 2d 73 69 6e 73 2f 74 6f 70 it/gaia-sins/top
6cc0: 6f 66 69 67 73 2f 74 6f 70 6f 2d 61 72 2d 32 30 ofigs/topo-ar-20
6cd0: 31 35 2e 70 6e 67 22 20 61 6c 74 3d 22 74 6f 70 15.png" alt="top
6ce0: 6f 2d 61 72 2d 32 30 31 35 22 3e 0d 0a 3c 2f 74 o-ar-2015">..</t
6cf0: 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 d></tr>..</table
6d00: 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 74 61 ><br>..<hr>..<ta
6d10: 62 6c 65 20 77 69 64 74 68 3d 22 31 30 30 25 22 ble width="100%"
6d20: 3e 3c 74 72 3e 0d 0a 3c 74 64 20 77 69 64 74 68 ><tr>..<td width
6d30: 3d 22 33 33 25 22 20 61 6c 69 67 6e 3d 22 6c 65 ="33%" align="le
6d40: 66 74 22 3e 3c 61 20 68 72 65 66 3d 22 68 74 74 ft"><a href="htt
6d50: 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 ps://www.gaia-gi
6d60: 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 s.it/fossil/libs
6d70: 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e patialite/wiki?n
6d80: 61 6d 65 3d 74 6f 70 6f 2d 69 6e 74 65 72 6d 65 ame=topo-interme
6d90: 64 69 61 74 65 22 3e 70 72 65 76 69 6f 75 73 20 diate">previous
6da0: 70 61 67 65 3c 2f 61 3e 3c 2f 74 64 3e 0d 0a 3c page</a></td>..<
6db0: 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 td align="center
6dc0: 22 3e 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 "><a href="https
6dd0: 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e ://www.gaia-gis.
6de0: 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 61 it/fossil/libspa
6df0: 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 6d tialite/wiki?nam
6e00: 65 3d 6d 69 73 63 2d 64 6f 63 73 22 3e 62 61 63 e=misc-docs">bac
6e10: 6b 20 74 6f 20 69 6e 64 65 78 3c 2f 61 3e 3c 2f k to index</a></
6e20: 74 64 3e 0d 0a 3c 74 64 20 77 69 64 74 68 3d 22 td>..<td width="
6e30: 33 33 25 22 20 61 6c 69 67 6e 3d 22 72 69 67 68 33%" align="righ
6e40: 74 22 3e 3c 61 20 68 72 65 66 3d 22 68 74 74 70 t"><a href="http
6e50: 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 s://www.gaia-gis
6e60: 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 .it/fossil/libsp
6e70: 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 atialite/wiki?na
6e80: 6d 65 3d 74 6f 70 6f 2d 61 64 76 61 6e 63 65 64 me=topo-advanced
6e90: 22 3e 6e 65 78 74 20 70 61 67 65 3c 2f 61 3e 3c ">next page</a><
6ea0: 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 3c 2f 74 61 62 /td>..</tr></tab
6eb0: 6c 65 3e 0a 5a 20 34 38 36 61 64 39 36 61 37 33 le>.Z 486ad96a73
6ec0: 31 65 37 31 36 66 62 37 32 63 38 66 30 64 31 66 1e716fb72c8f0d1f
6ed0: 38 34 30 38 66 33 0a 8408f3.