Artifact
64df71ad6734f958727608ce4e1f6c3dd10bb7d4:
Wiki page
[ZippedSHP] by
sandro
2020-05-08 09:16:14.
0000: 44 20 32 30 32 30 2d 30 35 2d 30 38 54 30 39 3a D 2020-05-08T09:
0010: 31 36 3a 31 34 2e 38 32 36 0a 4c 20 5a 69 70 70 16:14.826.L Zipp
0020: 65 64 53 48 50 0a 50 20 64 31 66 39 35 33 63 66 edSHP.P d1f953cf
0030: 36 33 33 33 30 37 31 34 39 34 31 66 65 30 36 35 63330714941fe065
0040: 35 36 62 35 35 65 30 30 39 39 36 66 38 63 64 31 56b55e00996f8cd1
0050: 0a 55 20 73 61 6e 64 72 6f 0a 57 20 34 35 37 36 .U sandro.W 4576
0060: 0a 42 61 63 6b 20 74 6f 20 3c 61 20 68 72 65 66 .Back to <a href
0070: 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 ="https://www.ga
0080: 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c ia-gis.it/fossil
0090: 2f 6c 69 62 73 70 61 74 69 61 6c 69 74 65 2f 77 /libspatialite/w
00a0: 69 6b 69 3f 6e 61 6d 65 3d 35 2e 30 2e 30 2d 64 iki?name=5.0.0-d
00b0: 6f 63 22 3e 6d 61 69 6e 20 53 70 61 74 69 61 4c oc">main SpatiaL
00c0: 69 74 65 20 70 61 67 65 3c 2f 61 3e 0d 0a 3c 68 ite page</a>..<h
00d0: 32 3e 52 65 61 64 69 6e 67 20 53 48 50 20 61 6e 2>Reading SHP an
00e0: 64 20 44 42 46 20 66 69 6c 65 73 20 64 69 72 65 d DBF files dire
00f0: 63 74 6c 79 20 66 72 6f 6d 20 77 69 74 68 69 6e ctly from within
0100: 20 61 20 5a 69 70 66 69 6c 65 3c 2f 68 32 3e 0d a Zipfile</h2>.
0110: 0a 53 74 61 72 74 69 6e 67 20 73 69 6e 63 65 20 .Starting since
0120: 76 65 72 73 69 6f 6e 20 3c 62 3e 35 2e 30 2e 30 version <b>5.0.0
0130: 3c 2f 62 3e 20 53 70 61 74 69 61 4c 69 74 65 20 </b> SpatiaLite
0140: 68 61 73 20 74 68 65 20 63 61 70 61 62 69 6c 69 has the capabili
0150: 74 79 20 74 6f 20 64 69 72 65 63 74 6c 79 20 72 ty to directly r
0160: 65 61 64 20 61 6e 79 20 3c 62 3e 53 68 61 70 65 ead any <b>Shape
0170: 66 69 6c 65 3c 2f 62 3e 20 28 6f 72 20 3c 62 3e file</b> (or <b>
0180: 44 42 46 3c 2f 62 3e 20 66 69 6c 65 29 20 63 6f DBF</b> file) co
0190: 6e 74 61 69 6e 65 64 20 77 69 74 68 69 6e 20 61 ntained within a
01a0: 20 63 6f 6d 70 72 65 73 73 65 64 20 3c 62 3e 5a compressed <b>Z
01b0: 69 70 66 69 6c 65 3c 2f 62 3e 2e 3c 62 72 3e 0d ipfile</b>.<br>.
01c0: 0a 53 65 76 65 72 61 6c 20 63 6c 6f 73 65 6c 79 .Several closely
01d0: 20 72 65 6c 61 74 65 64 20 53 51 4c 20 66 75 6e related SQL fun
01e0: 63 74 69 6f 6e 73 20 68 61 76 65 20 62 65 65 6e ctions have been
01f0: 20 69 6e 74 72 6f 64 75 63 65 64 20 61 73 20 77 introduced as w
0200: 65 6c 6c 2e 0d 0a 3c 68 33 3e 41 63 63 65 73 73 ell...<h3>Access
0210: 69 6e 67 20 61 20 5a 69 70 70 65 64 20 53 48 50 ing a Zipped SHP
0220: 3c 2f 68 33 3e 0d 0a 41 6c 6c 20 74 68 65 73 65 </h3>..All these
0230: 20 6e 65 77 20 53 51 4c 20 66 75 6e 63 74 69 6f new SQL functio
0240: 6e 73 20 61 72 65 20 6e 6f 77 20 73 75 70 70 6f ns are now suppo
0250: 72 74 65 64 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 rted:..<ul>..<li
0260: 3e 3c 62 3e 49 6d 70 6f 72 74 5a 69 70 53 48 50 ><b>ImportZipSHP
0270: 28 29 3c 2f 62 3e 3a 20 74 68 65 20 6d 61 69 6e ()</b>: the main
0280: 20 66 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f 77 69 function allowi
0290: 6e 67 20 74 6f 20 69 6d 70 6f 72 74 20 61 20 77 ng to import a w
02a0: 68 6f 6c 65 20 53 68 61 70 65 66 69 6c 65 20 69 hole Shapefile i
02b0: 6e 74 6f 20 61 20 6e 65 77 20 53 70 61 74 69 61 nto a new Spatia
02c0: 6c 20 54 61 62 6c 65 20 69 6e 74 6f 20 74 68 65 l Table into the
02d0: 20 63 75 72 72 65 6e 74 6c 79 20 63 6f 6e 6e 65 currently conne
02e0: 63 74 65 64 20 44 61 74 61 62 61 73 65 2e 3c 2f cted Database.</
02f0: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 50 52 4f 4a li>..<li><b>PROJ
0300: 5f 47 75 65 73 73 53 72 69 64 46 72 6f 6d 5a 69 _GuessSridFromZi
0310: 70 53 48 50 28 29 3c 2f 62 3e 3a 20 61 20 68 65 pSHP()</b>: a he
0320: 6c 70 65 72 20 66 75 63 74 69 6f 6e 20 66 6f 72 lper fuction for
0330: 20 61 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 67 attempting to g
0340: 75 65 73 73 20 74 68 65 20 53 52 49 44 20 66 6f uess the SRID fo
0350: 72 20 61 20 67 69 76 65 6e 20 7a 69 70 70 65 64 r a given zipped
0360: 20 53 48 50 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e SHP.</li>..<li>
0370: 3c 62 3e 5a 69 70 66 69 6c 65 5f 4e 75 6d 53 48 <b>Zipfile_NumSH
0380: 50 28 29 3c 2f 62 3e 3a 20 61 20 68 65 6c 70 65 P()</b>: a helpe
0390: 72 20 66 75 6e 63 74 69 6f 6e 20 72 65 74 75 72 r function retur
03a0: 6e 69 6e 67 20 74 68 65 20 74 6f 74 61 6c 20 63 ning the total c
03b0: 6f 75 6e 74 20 6f 66 20 53 68 61 70 65 66 69 6c ount of Shapefil
03c0: 65 73 20 63 6f 6e 74 61 69 6e 65 64 20 77 69 74 es contained wit
03d0: 68 69 6e 20 61 20 67 69 76 65 6e 20 5a 69 70 66 hin a given Zipf
03e0: 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c ile.</li>..<li><
03f0: 62 3e 5a 69 70 66 69 6c 65 5f 53 68 70 4e 28 29 b>Zipfile_ShpN()
0400: 3c 2f 62 3e 3a 20 61 20 68 65 6c 70 65 72 20 66 </b>: a helper f
0410: 75 6e 63 74 69 6f 6e 20 72 65 74 75 72 6e 69 6e unction returnin
0420: 67 20 74 68 65 20 3c 62 3e 3c 69 3e 62 61 73 65 g the <b><i>base
0430: 6e 61 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 66 6f 72 name</i></b> for
0440: 20 74 68 65 20 3c 62 3e 4e 74 68 3c 2f 62 3e 20 the <b>Nth</b>
0450: 53 68 61 70 65 66 69 6c 65 20 63 6f 6e 74 61 69 Shapefile contai
0460: 6e 65 64 20 77 69 74 68 69 6e 20 61 20 67 69 76 ned within a giv
0470: 65 6e 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c 69 3e en Zipfile.</li>
0480: 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d 0a 57 ..</ul>..<br>..W
0490: 65 27 6c 6c 20 6e 6f 77 20 73 74 61 72 74 20 61 e'll now start a
04a0: 20 71 75 69 63 6b 20 74 75 74 6f 72 69 61 6c 20 quick tutorial
04b0: 61 62 6f 75 74 20 75 73 69 6e 67 20 61 6c 6c 20 about using all
04c0: 74 68 65 73 65 20 6e 65 77 20 53 51 4c 20 66 75 these new SQL fu
04d0: 6e 63 74 69 6f 6e 73 2e 0d 0a 3c 62 3e 4e 6f 74 nctions...<b>Not
04e0: 65 3c 2f 62 3e 3a 20 74 68 65 20 74 75 74 6f 72 e</b>: the tutor
04f0: 69 61 6c 20 69 73 20 62 61 73 65 64 20 6f 6e 20 ial is based on
0500: 74 68 65 20 64 61 74 61 73 65 74 20 79 6f 75 20 the dataset you
0510: 63 61 6e 20 64 6f 77 6e 6c 6f 61 64 20 66 72 6f can download fro
0520: 6d 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 3a m <a href="http:
0530: 2f 2f 77 77 77 2e 69 73 74 61 74 2e 69 74 2f 73 //www.istat.it/s
0540: 74 6f 72 61 67 65 2f 63 61 72 74 6f 67 72 61 66 torage/cartograf
0550: 69 61 2f 63 6f 6e 66 69 6e 69 5f 61 6d 6d 69 6e ia/confini_ammin
0560: 69 73 74 72 61 74 69 76 69 2f 6e 6f 6e 5f 67 65 istrativi/non_ge
0570: 6e 65 72 61 6c 69 7a 7a 61 74 69 2f 4c 69 6d 69 neralizzati/Limi
0580: 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70 22 3e ti01012020.zip">
0590: 68 65 72 65 3c 2f 61 3e 0d 0a 3c 76 65 72 62 61 here</a>..<verba
05a0: 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 5a 69 70 tim>..SELECT Zip
05b0: 66 69 6c 65 5f 4e 75 6d 53 48 50 20 28 20 27 63 file_NumSHP ( 'c
05c0: 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f :/users/afuri/Do
05d0: 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31 wnloads/Limiti01
05e0: 30 31 32 30 32 30 2e 7a 69 70 27 20 29 0d 0a 2d 012020.zip' )..-
05f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 34 0d 0a -----------..4..
0600: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 6c </verbatim>..<ul
0610: 3e 0d 0a 3c 6c 69 3e 74 68 65 20 53 51 4c 20 66 >..<li>the SQL f
0620: 75 6e 63 74 69 6f 6e 20 3c 62 3e 5a 69 70 66 69 unction <b>Zipfi
0630: 6c 65 5f 4e 75 6d 53 48 50 28 29 3c 2f 62 3e 20 le_NumSHP()</b>
0640: 77 69 6c 6c 20 69 6e 73 70 65 63 74 20 61 20 5a will inspect a Z
0650: 69 70 66 69 6c 65 20 74 68 65 6e 20 72 65 74 75 ipfile then retu
0660: 72 6e 69 6e 67 20 74 68 65 20 74 6f 74 61 6c 20 rning the total
0670: 63 6f 75 6e 74 20 6f 66 20 53 68 61 70 65 66 69 count of Shapefi
0680: 6c 65 73 20 69 74 20 63 6f 6e 74 61 69 6e 73 2e les it contains.
0690: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 74 20 72 65 </li>..<li>it re
06a0: 71 75 69 72 65 73 20 6a 75 73 74 20 61 20 73 69 quires just a si
06b0: 6e 67 6c 65 20 61 72 67 75 6d 65 6e 74 3a 20 74 ngle argument: t
06c0: 68 65 20 61 62 73 6f 6c 75 74 65 20 6f 72 20 72 he absolute or r
06d0: 65 6c 61 74 69 76 65 20 70 61 74 68 20 6c 65 61 elative path lea
06e0: 64 69 6e 67 20 74 6f 20 74 68 65 20 5a 69 70 66 ding to the Zipf
06f0: 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c ile.</li>..<li><
0700: 62 3e 4e 6f 74 65 3c 2f 62 3e 20 69 74 20 77 69 b>Note</b> it wi
0710: 6c 6c 20 72 65 74 75 72 6e 20 3c 62 3e 30 3c 2f ll return <b>0</
0720: 62 3e 20 69 66 20 74 68 65 20 5a 69 70 66 69 6c b> if the Zipfil
0730: 65 20 64 6f 65 73 20 6e 6f 74 20 63 6f 6e 74 61 e does not conta
0740: 69 6e 20 61 6e 79 20 53 68 61 70 65 66 69 6c 65 in any Shapefile
0750: 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e ...<ul>..<li><b>
0760: 4e 55 4c 4c 3c 2f 62 3e 20 77 69 6c 6c 20 62 65 NULL</b> will be
0770: 20 72 65 74 75 72 6e 65 64 20 69 66 20 74 68 65 returned if the
0780: 20 5a 69 70 66 69 6c 65 20 64 6f 65 73 20 6e 6f Zipfile does no
0790: 74 20 65 78 69 73 74 20 6f 66 20 69 66 20 69 74 t exist of if it
07a0: 27 73 20 63 6f 72 72 75 70 74 65 64 20 6f 72 20 's corrupted or
07b0: 69 6e 76 61 6c 69 64 2e 3c 2f 6c 69 3e 0d 0a 3c invalid.</li>..<
07c0: 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e /ul></li>..</ul>
07d0: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 ..<verbatim>..SE
07e0: 4c 45 43 54 20 5a 69 70 66 69 6c 65 5f 73 68 70 LECT Zipfile_shp
07f0: 4e 20 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 N ( 'c:/users/af
0800: 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 uri/Downloads/Li
0810: 6d 69 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70 miti01012020.zip
0820: 27 20 2c 20 31 20 29 0d 0a 2d 2d 2d 2d 2d 2d 0d ' , 1 )..------.
0830: 0a 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2f .Limiti01012020/
0840: 43 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f 6d 30 Com01012020/Com0
0850: 31 30 31 32 30 32 30 5f 57 47 53 38 34 0d 0a 0d 1012020_WGS84...
0860: 0a 53 45 4c 45 43 54 20 5a 69 70 66 69 6c 65 5f .SELECT Zipfile_
0870: 73 68 70 4e 20 28 20 27 63 3a 2f 75 73 65 72 73 shpN ( 'c:/users
0880: 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 /afuri/Downloads
0890: 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2e /Limiti01012020.
08a0: 7a 69 70 27 20 2c 20 32 20 29 0d 0a 2d 2d 2d 2d zip' , 2 )..----
08b0: 2d 2d 0d 0a 4c 69 6d 69 74 69 30 31 30 31 32 30 --..Limiti010120
08c0: 32 30 2f 50 72 6f 76 43 4d 30 31 30 31 32 30 32 20/ProvCM0101202
08d0: 30 2f 50 72 6f 76 43 4d 30 31 30 31 32 30 32 30 0/ProvCM01012020
08e0: 5f 57 47 53 38 34 0d 0a 0d 0a 53 45 4c 45 43 54 _WGS84....SELECT
08f0: 20 5a 69 70 66 69 6c 65 5f 73 68 70 4e 20 28 20 Zipfile_shpN (
0900: 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 'c:/users/afuri/
0910: 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 Downloads/Limiti
0920: 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 01012020.zip' ,
0930: 33 20 29 0d 0a 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 3 )..------..Lim
0940: 69 74 69 30 31 30 31 32 30 32 30 2f 52 65 67 30 iti01012020/Reg0
0950: 31 30 31 32 30 32 30 2f 52 65 67 30 31 30 31 32 1012020/Reg01012
0960: 30 32 30 5f 57 47 53 38 34 0d 0a 0d 0a 53 45 4c 020_WGS84....SEL
0970: 45 43 54 20 5a 69 70 66 69 6c 65 5f 73 68 70 4e ECT Zipfile_shpN
0980: 20 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 ( 'c:/users/afu
0990: 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d ri/Downloads/Lim
09a0: 69 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70 27 iti01012020.zip'
09b0: 20 2c 20 34 20 29 0d 0a 2d 2d 2d 2d 2d 2d 2d 0d , 4 )..-------.
09c0: 0a 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2f .Limiti01012020/
09d0: 52 69 70 47 65 6f 30 31 30 31 32 30 32 30 2f 52 RipGeo01012020/R
09e0: 69 70 47 65 6f 30 31 30 31 32 30 32 30 5f 57 47 ipGeo01012020_WG
09f0: 53 38 34 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e S84..</verbatim>
0a00: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 53 51 <ul>..<li>the SQ
0a10: 4c 20 66 75 6e 63 74 69 6f 6e 20 3c 62 3e 5a 69 L function <b>Zi
0a20: 70 66 69 6c 65 5f 53 68 70 4e 28 29 3c 2f 62 3e pfile_ShpN()</b>
0a30: 20 77 69 6c 6c 20 69 6e 73 70 65 63 74 20 61 20 will inspect a
0a40: 5a 69 70 66 69 6c 65 20 74 68 65 6e 20 72 65 74 Zipfile then ret
0a50: 75 72 6e 69 6e 67 20 74 68 65 20 3c 62 3e 3c 69 urning the <b><i
0a60: 3e 62 61 73 65 6e 61 6d 65 3c 2f 69 3e 3c 2f 62 >basename</i></b
0a70: 3e 20 6f 66 20 74 68 65 20 3c 62 3e 4e 74 68 3c > of the <b>Nth<
0a80: 2f 62 3e 20 53 68 61 70 65 66 69 6c 65 20 69 74 /b> Shapefile it
0a90: 20 63 6f 6e 74 61 69 6e 73 2e 3c 2f 6c 69 3e 0d contains.</li>.
0aa0: 0a 3c 6c 69 3e 69 74 20 72 65 71 75 69 72 65 73 .<li>it requires
0ab0: 20 74 77 6f 20 61 72 67 75 6d 65 6e 73 74 3a 0d two argumenst:.
0ac0: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 61 .<ul>..<li>the a
0ad0: 62 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c 61 74 bsolute or relat
0ae0: 69 76 65 20 70 61 74 68 20 6c 65 61 64 69 6e 67 ive path leading
0af0: 20 74 6f 20 74 68 65 20 5a 69 70 66 69 6c 65 2e to the Zipfile.
0b00: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 72 </li>..<li>the r
0b10: 65 6c 61 74 69 76 65 20 69 6e 64 65 78 20 28 3c elative index (<
0b20: 62 3e 31 20 62 61 73 65 64 3c 2f 62 3e 29 20 6f b>1 based</b>) o
0b30: 66 20 74 68 65 20 53 68 61 70 65 66 69 6c 65 20 f the Shapefile
0b40: 77 69 74 68 69 6e 20 74 68 65 20 5a 69 70 66 69 within the Zipfi
0b50: 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c le.</li>..</ul><
0b60: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4e 6f 74 /li>..<li><b>Not
0b70: 65 3c 2f 62 3e 3a 20 3c 62 3e 4e 55 4c 4c 3c 2f e</b>: <b>NULL</
0b80: 62 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72 b> will be retur
0b90: 6e 65 64 20 69 66 20 74 68 65 20 5a 69 70 66 69 ned if the Zipfi
0ba0: 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 le does not exis
0bb0: 74 20 6f 66 20 69 66 20 69 74 27 73 20 69 6e 76 t of if it's inv
0bc0: 61 6c 69 64 20 6f 72 20 69 66 20 74 68 65 20 69 alid or if the i
0bd0: 6e 64 65 78 20 76 61 6c 75 65 20 69 73 20 6f 75 ndex value is ou
0be0: 74 73 69 64 65 20 74 68 65 20 65 78 70 65 63 74 tside the expect
0bf0: 65 64 20 72 61 6e 67 65 2e 3c 2f 6c 69 3e 0d 0a ed range.</li>..
0c00: 3c 2f 75 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 6d </ul>..<verbatim
0c10: 3e 0d 0a 53 45 4c 45 43 54 20 50 52 4f 4a 5f 47 >..SELECT PROJ_G
0c20: 75 65 73 73 53 72 69 64 46 72 6f 6d 5a 69 70 53 uessSridFromZipS
0c30: 48 50 20 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 HP ( 'c:/users/a
0c40: 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c furi/Downloads/L
0c50: 69 6d 69 74 69 30 31 30 31 32 30 32 30 2e 7a 69 imiti01012020.zi
0c60: 70 27 20 2c 20 27 4c 69 6d 69 74 69 30 31 30 31 p' , 'Limiti0101
0c70: 32 30 32 30 2f 43 6f 6d 30 31 30 31 32 30 32 30 2020/Com01012020
0c80: 2f 43 6f 6d 30 31 30 31 32 30 32 30 5f 57 47 53 /Com01012020_WGS
0c90: 38 34 27 20 29 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 84' )..---------
0ca0: 2d 2d 2d 0d 0a 33 32 36 33 32 0d 0a 3c 2f 76 65 ---..32632..</ve
0cb0: 72 62 61 74 69 6d 3e 0d 0a 3c 6c 69 3e 74 68 65 rbatim>..<li>the
0cc0: 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e 20 3c 62 SQL function <b
0cd0: 3e 50 52 4f 4a 5f 47 75 65 73 73 53 72 69 64 46 >PROJ_GuessSridF
0ce0: 72 6f 6d 5a 69 70 53 48 50 28 29 3c 2f 62 3e 20 romZipSHP()</b>
0cf0: 77 69 6c 6c 20 69 6e 73 70 65 63 74 20 61 20 5a will inspect a Z
0d00: 69 70 66 69 6c 65 20 74 68 65 6e 20 72 65 74 75 ipfile then retu
0d10: 72 6e 69 6e 67 20 74 68 65 20 3c 62 3e 53 52 49 rning the <b>SRI
0d20: 44 3c 2f 62 3e 20 76 61 6c 75 65 20 64 65 63 6c D</b> value decl
0d30: 61 72 65 64 20 62 79 20 74 68 65 20 3c 62 3e 2e ared by the <b>.
0d40: 50 52 4a 3c 2f 62 3e 20 6d 65 6d 62 65 72 20 20 PRJ</b> member
0d50: 6f 66 20 74 68 65 20 53 68 61 70 65 66 69 6c 65 of the Shapefile
0d60: 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e 74 6f 20 contained into
0d70: 74 68 65 20 5a 69 70 66 69 6c 65 73 20 61 73 20 the Zipfiles as
0d80: 69 64 65 6e 74 69 66 69 65 64 20 62 79 20 69 74 identified by it
0d90: 73 20 3c 62 3e 3c 69 3e 62 61 73 65 6e 61 6d 65 s <b><i>basename
0da0: 3c 2f 69 3e 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a </i></b>.</li>..
0db0: 3c 6c 69 3e 69 74 20 72 65 71 75 69 72 65 73 20 <li>it requires
0dc0: 74 77 6f 20 61 72 67 75 6d 65 6e 73 74 3a 0d 0a two argumenst:..
0dd0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 61 62 <ul>..<li>the ab
0de0: 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c 61 74 69 solute or relati
0df0: 76 65 20 70 61 74 68 20 6c 65 61 64 69 6e 67 20 ve path leading
0e00: 74 6f 20 74 68 65 20 5a 69 70 66 69 6c 65 2e 3c to the Zipfile.<
0e10: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 3c 62 /li>..<li>the <b
0e20: 3e 3c 69 3e 62 61 73 65 6e 61 6d 65 3c 2f 69 3e ><i>basename</i>
0e30: 3c 2f 62 3e 20 6f 66 20 74 68 65 20 53 68 61 70 </b> of the Shap
0e40: 65 66 69 6c 65 20 77 69 74 68 69 6e 20 74 68 65 efile within the
0e50: 20 5a 69 70 66 69 6c 65 20 28 77 69 74 68 6f 75 Zipfile (withou
0e60: 74 20 61 64 64 69 6e 67 20 61 6e 79 20 3c 62 3e t adding any <b>
0e70: 2e 73 68 70 3c 2f 62 3e 2c 20 3c 62 3e 2e 73 68 .shp</b>, <b>.sh
0e80: 78 3c 2f 62 3e 20 6f 72 20 3c 62 3e 2e 64 62 66 x</b> or <b>.dbf
0e90: 3c 2f 62 3e 20 73 75 66 66 69 78 29 2e 3c 2f 6c </b> suffix).</l
0ea0: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a i>..</ul></li>..
0eb0: 3c 6c 69 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a <li><b>Note</b>:
0ec0: 20 3c 62 3e 2d 31 3c 2f 62 3e 20 77 69 6c 6c 20 <b>-1</b> will
0ed0: 62 65 20 72 65 74 75 72 6e 65 64 20 69 66 20 74 be returned if t
0ee0: 68 65 20 53 68 61 70 65 66 69 6c 65 20 68 61 73 he Shapefile has
0ef0: 20 6e 6f 20 3c 62 3e 2e 50 52 4a 3c 2f 62 3e 20 no <b>.PRJ</b>
0f00: 6d 65 6d 62 65 72 2c 20 6f 66 20 69 66 20 69 74 member, of if it
0f10: 20 63 6f 6e 74 61 69 6e 73 20 61 6e 20 69 6e 76 contains an inv
0f20: 61 6c 69 64 20 57 4b 54 20 64 65 66 69 6e 69 74 alid WKT definit
0f30: 69 6f 6e 2e 3c 2f 6c 69 3e 0d 0a 3c 75 6c 3e 0d ion.</li>..<ul>.
0f40: 0a 3c 2f 6c 69 3e 3c 62 3e 4e 55 4c 4c 3c 2f 62 .</li><b>NULL</b
0f50: 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72 6e > will be return
0f60: 65 64 20 6f 6e 20 69 6e 76 61 6c 69 64 20 61 72 ed on invalid ar
0f70: 67 75 6d 65 6e 74 73 20 6f 72 20 69 66 20 74 68 guments or if th
0f80: 65 20 53 68 61 70 65 66 69 6c 65 20 64 6f 65 73 e Shapefile does
0f90: 20 6e 6f 74 20 65 78 69 73 74 2e 3c 2f 6c 69 3e not exist.</li>
0fa0: 0d 0a 3c 2f 6c 69 3e 3c 2f 75 6c 3e 0d 0a 3c 2f ..</li></ul>..</
0fb0: 75 6c 3e 0d 0a 3c 62 72 3e 3c 62 72 3e 0d 0a 3c ul>..<br><br>..<
0fc0: 68 72 3e 0d 0a 3c 68 33 3e 41 63 63 65 73 73 69 hr>..<h3>Accessi
0fd0: 6e 67 20 61 20 5a 69 70 70 65 64 20 44 42 46 3c ng a Zipped DBF<
0fe0: 2f 68 33 3e 0d 0a 41 6c 6c 20 74 68 65 73 65 20 /h3>..All these
0ff0: 6e 65 77 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e new SQL function
1000: 73 20 61 72 65 20 6e 6f 77 20 73 75 70 70 6f 72 s are now suppor
1010: 74 65 64 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e ted:..<ul>..<li>
1020: 3c 62 3e 49 6d 70 6f 72 74 5a 69 70 44 42 46 28 <b>ImportZipDBF(
1030: 29 3c 2f 62 3e 3a 20 74 68 65 20 6d 61 69 6e 20 )</b>: the main
1040: 66 75 6e 63 74 69 6f 6e 20 61 6c 6c 6f 77 69 6e function allowin
1050: 67 20 74 6f 20 69 6d 70 6f 72 74 20 61 20 77 68 g to import a wh
1060: 6f 6c 65 20 44 42 46 20 66 69 6c 65 20 69 6e 74 ole DBF file int
1070: 6f 20 61 20 6e 65 77 20 54 61 62 6c 65 20 69 6e o a new Table in
1080: 74 6f 20 74 68 65 20 63 75 72 72 65 6e 74 6c 79 to the currently
1090: 20 63 6f 6e 6e 65 63 74 65 64 20 44 61 74 61 62 connected Datab
10a0: 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c ase.</li>..<li><
10b0: 62 3e 5a 69 70 66 69 6c 65 5f 4e 75 6d 44 42 46 b>Zipfile_NumDBF
10c0: 28 29 3c 2f 62 3e 3a 20 61 20 68 65 6c 70 65 72 ()</b>: a helper
10d0: 20 66 75 6e 63 74 69 6f 6e 20 72 65 74 75 72 6e function return
10e0: 69 6e 67 20 74 68 65 20 74 6f 74 61 6c 20 63 6f ing the total co
10f0: 75 6e 74 20 6f 66 20 44 42 46 20 66 69 6c 65 73 unt of DBF files
1100: 20 63 6f 6e 74 61 69 6e 65 64 20 77 69 74 68 69 contained withi
1110: 6e 20 61 20 67 69 76 65 6e 20 5a 69 70 66 69 6c n a given Zipfil
1120: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e e.</li>..<li><b>
1130: 5a 69 70 66 69 6c 65 5f 44 62 66 4e 28 29 3c 2f Zipfile_DbfN()</
1140: 62 3e 3a 20 61 20 68 65 6c 70 65 72 20 66 75 6e b>: a helper fun
1150: 63 74 69 6f 6e 20 72 65 74 75 72 6e 69 6e 67 20 ction returning
1160: 74 68 65 20 3c 62 3e 3c 69 3e 66 69 6c 65 6e 61 the <b><i>filena
1170: 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 66 6f 72 20 74 me</i></b> for t
1180: 68 65 20 3c 62 3e 4e 74 68 3c 2f 62 3e 20 44 42 he <b>Nth</b> DB
1190: 46 20 66 69 6c 65 20 63 6f 6e 74 61 69 6e 65 64 F file contained
11a0: 20 77 69 74 68 69 6e 20 61 20 67 69 76 65 6e 20 within a given
11b0: 5a 69 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c Zipfile.</li>..<
11c0: 2f 75 6c 3e 0d 0a 0d 0a 3c 62 72 3e 3c 68 72 3e /ul>....<br><hr>
11d0: 3c 62 72 3e 0d 0a 42 61 63 6b 20 74 6f 20 3c 61 <br>..Back to <a
11e0: 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 href="https://w
11f0: 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66 ww.gaia-gis.it/f
1200: 6f 73 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c ossil/libspatial
1210: 69 74 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 35 2e ite/wiki?name=5.
1220: 30 2e 30 2d 64 6f 63 22 3e 6d 61 69 6e 20 53 70 0.0-doc">main Sp
1230: 61 74 69 61 4c 69 74 65 20 70 61 67 65 3c 2f 61 atiaLite page</a
1240: 3e 0a 5a 20 35 31 30 32 31 35 32 31 61 33 66 32 >.Z 51021521a3f2
1250: 65 34 32 61 39 31 62 35 36 35 34 65 30 65 33 66 e42a91b5654e0e3f
1260: 35 36 64 33 0a 56d3.