Hex Artifact Content
Not logged in

Artifact f4198393ed6084c2dbe6ea0bb6a8c615bdc7d3ad:

Wiki page [ZippedSHP] by sandro 2020-07-18 17:55:08.
0000: 44 20 32 30 32 30 2d 30 37 2d 31 38 54 31 37 3a  D 2020-07-18T17:
0010: 35 35 3a 30 38 2e 37 33 37 0a 4c 20 5a 69 70 70  55:08.737.L Zipp
0020: 65 64 53 48 50 0a 50 20 33 64 61 37 37 34 33 36  edSHP.P 3da77436
0030: 33 66 63 32 33 36 62 37 30 36 30 64 31 35 63 33  3fc236b7060d15c3
0040: 33 30 66 39 30 62 39 37 36 33 38 36 62 66 35 62  30f90b976386bf5b
0050: 0a 55 20 73 61 6e 64 72 6f 0a 57 20 31 32 34 35  .U sandro.W 1245
0060: 32 0a 42 61 63 6b 20 74 6f 20 3c 61 20 68 72 65  2.Back to <a hre
0070: 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67  f="https://www.g
0080: 61 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69  aia-gis.it/fossi
0090: 6c 2f 6c 69 62 73 70 61 74 69 61 6c 69 74 65 2f  l/libspatialite/
00a0: 77 69 6b 69 3f 6e 61 6d 65 3d 35 2e 30 2e 30 2d  wiki?name=5.0.0-
00b0: 64 6f 63 22 3e 35 2e 30 2e 30 2d 64 6f 63 20 6d  doc">5.0.0-doc m
00c0: 61 69 6e 20 70 61 67 65 3c 2f 61 3e 0d 0a 3c 68  ain 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 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 74  ell.<br><br>..<t
0210: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66  able bgcolor="#f
0220: 66 66 66 64 30 22 20 63 65 6c 6c 73 70 61 63 69  fffd0" cellspaci
0230: 6e 67 3d 22 31 32 22 20 63 65 6c 6c 70 61 64 64  ng="12" cellpadd
0240: 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74  ing="8">..<tr><t
0250: 64 3e 0d 0a 3c 62 3e 50 6c 65 61 73 65 20 6e 6f  d>..<b>Please no
0260: 74 65 3c 2f 62 3e 3a 20 61 6c 6c 20 74 68 65 20  te</b>: all the 
0270: 66 6f 6c 6c 6f 77 69 6e 67 20 53 51 4c 20 66 75  following SQL fu
0280: 6e 63 74 69 6f 6e 73 20 77 69 6c 6c 20 61 63 63  nctions will acc
0290: 65 73 73 20 61 20 5a 69 70 66 69 6c 65 20 66 72  ess a Zipfile fr
02a0: 6f 6d 20 74 68 65 20 6c 6f 63 61 6c 20 66 69 6c  om the local fil
02b0: 65 2d 73 79 73 74 65 6d 2c 20 61 6e 64 20 77 69  e-system, and wi
02c0: 6c 6c 20 63 6f 6e 73 65 71 75 65 6e 74 6c 79 20  ll consequently 
02d0: 70 6f 73 65 20 73 65 63 75 72 69 74 79 20 63 6f  pose security co
02e0: 6e 63 65 72 6e 73 2e 3c 62 72 3e 3c 62 72 3e 0d  ncerns.<br><br>.
02f0: 0a 41 6c 6c 20 74 68 65 6d 20 77 69 6c 6c 20 62  .All them will b
0300: 65 20 65 66 66 65 63 74 69 76 65 6c 79 20 61 76  e effectively av
0310: 61 69 6c 61 62 6c 65 20 6f 6e 6c 79 20 69 66 20  ailable only if 
0320: 74 68 65 20 65 78 74 65 72 6e 61 6c 20 76 61 72  the external var
0330: 69 61 62 6c 65 20 3c 62 3e 53 50 41 54 49 41 4c  iable <b>SPATIAL
0340: 49 54 45 5f 53 45 43 55 52 49 54 59 3d 72 65 6c  ITE_SECURITY=rel
0350: 61 78 65 64 3c 2f 62 3e 20 68 61 73 20 62 65 65  axed</b> has bee
0360: 6e 20 73 65 74 2e 0d 0a 3c 2f 74 64 3e 3c 2f 74  n set...</td></t
0370: 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 68  r>..</table>..<h
0380: 33 3e 41 63 63 65 73 73 69 6e 67 20 61 20 5a 69  3>Accessing a Zi
0390: 70 70 65 64 20 53 48 50 3c 2f 68 33 3e 0d 0a 41  pped SHP</h3>..A
03a0: 6c 6c 20 74 68 65 73 65 20 6e 65 77 20 53 51 4c  ll these new SQL
03b0: 20 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 6e   functions are n
03c0: 6f 77 20 73 75 70 70 6f 72 74 65 64 3a 0d 0a 3c  ow supported:..<
03d0: 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 49 6d 70 6f  ul>..<li><b>Impo
03e0: 72 74 5a 69 70 53 48 50 28 29 3c 2f 62 3e 3a 20  rtZipSHP()</b>: 
03f0: 74 68 65 20 6d 61 69 6e 20 66 75 6e 63 74 69 6f  the main functio
0400: 6e 20 61 6c 6c 6f 77 69 6e 67 20 74 6f 20 69 6d  n allowing to im
0410: 70 6f 72 74 20 61 20 77 68 6f 6c 65 20 53 68 61  port a whole Sha
0420: 70 65 66 69 6c 65 20 69 6e 74 6f 20 61 20 6e 65  pefile into a ne
0430: 77 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65 20  w Spatial Table 
0440: 69 6e 74 6f 20 74 68 65 20 63 75 72 72 65 6e 74  into the current
0450: 6c 79 20 63 6f 6e 6e 65 63 74 65 64 20 44 61 74  ly connected Dat
0460: 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  abase.</li>..<li
0470: 3e 3c 62 3e 50 52 4f 4a 5f 47 75 65 73 73 53 72  ><b>PROJ_GuessSr
0480: 69 64 46 72 6f 6d 5a 69 70 53 48 50 28 29 3c 2f  idFromZipSHP()</
0490: 62 3e 3a 20 61 20 68 65 6c 70 65 72 20 66 75 6e  b>: a helper fun
04a0: 63 74 69 6f 6e 20 66 6f 72 20 61 74 74 65 6d 70  ction for attemp
04b0: 74 69 6e 67 20 74 6f 20 67 75 65 73 73 20 74 68  ting to guess th
04c0: 65 20 53 52 49 44 20 66 6f 72 20 61 20 67 69 76  e SRID for a giv
04d0: 65 6e 20 7a 69 70 70 65 64 20 53 48 50 2e 3c 2f  en zipped SHP.</
04e0: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 5a 69 70 66  li>..<li><b>Zipf
04f0: 69 6c 65 5f 4e 75 6d 53 48 50 28 29 3c 2f 62 3e  ile_NumSHP()</b>
0500: 3a 20 61 20 68 65 6c 70 65 72 20 66 75 6e 63 74  : a helper funct
0510: 69 6f 6e 20 72 65 74 75 72 6e 69 6e 67 20 74 68  ion returning th
0520: 65 20 74 6f 74 61 6c 20 63 6f 75 6e 74 20 6f 66  e total count of
0530: 20 53 68 61 70 65 66 69 6c 65 73 20 63 6f 6e 74   Shapefiles cont
0540: 61 69 6e 65 64 20 77 69 74 68 69 6e 20 61 20 67  ained within a g
0550: 69 76 65 6e 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c  iven Zipfile.</l
0560: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 5a 69 70 66 69  i>..<li><b>Zipfi
0570: 6c 65 5f 53 68 70 4e 28 29 3c 2f 62 3e 3a 20 61  le_ShpN()</b>: a
0580: 20 68 65 6c 70 65 72 20 66 75 6e 63 74 69 6f 6e   helper function
0590: 20 72 65 74 75 72 6e 69 6e 67 20 74 68 65 20 3c   returning the <
05a0: 62 3e 3c 69 3e 62 61 73 65 6e 61 6d 65 3c 2f 69  b><i>basename</i
05b0: 3e 3c 2f 62 3e 20 66 6f 72 20 74 68 65 20 3c 62  ></b> for the <b
05c0: 3e 4e 74 68 3c 2f 62 3e 20 53 68 61 70 65 66 69  >Nth</b> Shapefi
05d0: 6c 65 20 63 6f 6e 74 61 69 6e 65 64 20 77 69 74  le contained wit
05e0: 68 69 6e 20 61 20 67 69 76 65 6e 20 5a 69 70 66  hin a given Zipf
05f0: 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  ile.</li>..</ul>
0600: 0d 0a 3c 62 72 3e 0d 0a 57 65 27 6c 6c 20 6e 6f  ..<br>..We'll no
0610: 77 20 73 74 61 72 74 20 61 20 71 75 69 63 6b 20  w start a quick 
0620: 74 75 74 6f 72 69 61 6c 20 61 62 6f 75 74 20 75  tutorial about u
0630: 73 69 6e 67 20 61 6c 6c 20 74 68 65 73 65 20 6e  sing all these n
0640: 65 77 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e 73  ew SQL functions
0650: 2e 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20  ...<b>Note</b>: 
0660: 74 68 65 20 74 75 74 6f 72 69 61 6c 20 69 73 20  the tutorial is 
0670: 62 61 73 65 64 20 6f 6e 20 74 68 65 20 64 61 74  based on the dat
0680: 61 73 65 74 20 79 6f 75 20 63 61 6e 20 64 6f 77  aset you can dow
0690: 6e 6c 6f 61 64 20 66 72 6f 6d 20 3c 61 20 68 72  nload from <a hr
06a0: 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 69  ef="http://www.i
06b0: 73 74 61 74 2e 69 74 2f 73 74 6f 72 61 67 65 2f  stat.it/storage/
06c0: 63 61 72 74 6f 67 72 61 66 69 61 2f 63 6f 6e 66  cartografia/conf
06d0: 69 6e 69 5f 61 6d 6d 69 6e 69 73 74 72 61 74 69  ini_amministrati
06e0: 76 69 2f 6e 6f 6e 5f 67 65 6e 65 72 61 6c 69 7a  vi/non_generaliz
06f0: 7a 61 74 69 2f 4c 69 6d 69 74 69 30 31 30 31 32  zati/Limiti01012
0700: 30 32 30 2e 7a 69 70 22 3e 68 65 72 65 3c 2f 61  020.zip">here</a
0710: 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53  >..<verbatim>..S
0720: 45 4c 45 43 54 20 5a 69 70 66 69 6c 65 5f 4e 75  ELECT Zipfile_Nu
0730: 6d 53 48 50 20 28 20 27 63 3a 2f 75 73 65 72 73  mSHP ( 'c:/users
0740: 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73  /afuri/Downloads
0750: 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2e  /Limiti01012020.
0760: 7a 69 70 27 20 29 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d  zip' )..--------
0770: 2d 2d 2d 2d 0d 0a 34 0d 0a 3c 2f 76 65 72 62 61  ----..4..</verba
0780: 74 69 6d 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  tim>..<ul>..<li>
0790: 74 68 65 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e  the SQL function
07a0: 20 3c 62 3e 5a 69 70 66 69 6c 65 5f 4e 75 6d 53   <b>Zipfile_NumS
07b0: 48 50 28 29 3c 2f 62 3e 20 77 69 6c 6c 20 69 6e  HP()</b> will in
07c0: 73 70 65 63 74 20 61 20 5a 69 70 66 69 6c 65 20  spect a Zipfile 
07d0: 74 68 65 6e 20 72 65 74 75 72 6e 69 6e 67 20 74  then returning t
07e0: 68 65 20 74 6f 74 61 6c 20 63 6f 75 6e 74 20 6f  he total count o
07f0: 66 20 53 68 61 70 65 66 69 6c 65 73 20 69 74 20  f Shapefiles it 
0800: 63 6f 6e 74 61 69 6e 73 2e 3c 2f 6c 69 3e 0d 0a  contains.</li>..
0810: 3c 6c 69 3e 69 74 20 72 65 71 75 69 72 65 73 20  <li>it requires 
0820: 6a 75 73 74 20 61 20 73 69 6e 67 6c 65 20 61 72  just a single ar
0830: 67 75 6d 65 6e 74 3a 20 74 68 65 20 61 62 73 6f  gument: the abso
0840: 6c 75 74 65 20 6f 72 20 72 65 6c 61 74 69 76 65  lute or relative
0850: 20 70 61 74 68 20 6c 65 61 64 69 6e 67 20 74 6f   path leading to
0860: 20 74 68 65 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c   the Zipfile.</l
0870: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4e 6f 74 65 3c  i>..<li><b>Note<
0880: 2f 62 3e 20 69 74 20 77 69 6c 6c 20 72 65 74 75  /b> it will retu
0890: 72 6e 20 3c 62 3e 30 3c 2f 62 3e 20 69 66 20 74  rn <b>0</b> if t
08a0: 68 65 20 5a 69 70 66 69 6c 65 20 64 6f 65 73 20  he Zipfile does 
08b0: 6e 6f 74 20 63 6f 6e 74 61 69 6e 20 61 6e 79 20  not contain any 
08c0: 53 68 61 70 65 66 69 6c 65 2e 0d 0a 3c 75 6c 3e  Shapefile...<ul>
08d0: 0d 0a 3c 6c 69 3e 3c 62 3e 4e 55 4c 4c 3c 2f 62  ..<li><b>NULL</b
08e0: 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72 6e  > will be return
08f0: 65 64 20 69 66 20 74 68 65 20 5a 69 70 66 69 6c  ed if the Zipfil
0900: 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73 74  e does not exist
0910: 20 6f 66 20 69 66 20 69 74 27 73 20 63 6f 72 72   of if it's corr
0920: 75 70 74 65 64 20 6f 72 20 69 6e 76 61 6c 69 64  upted or invalid
0930: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c  .</li>..</ul></l
0940: 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65 72 62  i>..</ul>..<verb
0950: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 5a 69  atim>..SELECT Zi
0960: 70 66 69 6c 65 5f 73 68 70 4e 20 28 20 27 63 3a  pfile_shpN ( 'c:
0970: 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f 77  /users/afuri/Dow
0980: 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31 30  nloads/Limiti010
0990: 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 31 20 29  12020.zip' , 1 )
09a0: 0d 0a 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74 69  ..------..Limiti
09b0: 30 31 30 31 32 30 32 30 2f 43 6f 6d 30 31 30 31  01012020/Com0101
09c0: 32 30 32 30 2f 43 6f 6d 30 31 30 31 32 30 32 30  2020/Com01012020
09d0: 5f 57 47 53 38 34 0d 0a 0d 0a 53 45 4c 45 43 54  _WGS84....SELECT
09e0: 20 5a 69 70 66 69 6c 65 5f 73 68 70 4e 20 28 20   Zipfile_shpN ( 
09f0: 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 2f  'c:/users/afuri/
0a00: 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69  Downloads/Limiti
0a10: 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20 2c 20  01012020.zip' , 
0a20: 32 20 29 0d 0a 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 6d  2 )..------..Lim
0a30: 69 74 69 30 31 30 31 32 30 32 30 2f 50 72 6f 76  iti01012020/Prov
0a40: 43 4d 30 31 30 31 32 30 32 30 2f 50 72 6f 76 43  CM01012020/ProvC
0a50: 4d 30 31 30 31 32 30 32 30 5f 57 47 53 38 34 0d  M01012020_WGS84.
0a60: 0a 0d 0a 53 45 4c 45 43 54 20 5a 69 70 66 69 6c  ...SELECT Zipfil
0a70: 65 5f 73 68 70 4e 20 28 20 27 63 3a 2f 75 73 65  e_shpN ( 'c:/use
0a80: 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61  rs/afuri/Downloa
0a90: 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32  ds/Limiti0101202
0aa0: 30 2e 7a 69 70 27 20 2c 20 33 20 29 0d 0a 2d 2d  0.zip' , 3 )..--
0ab0: 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74 69 30 31 30 31  ----..Limiti0101
0ac0: 32 30 32 30 2f 52 65 67 30 31 30 31 32 30 32 30  2020/Reg01012020
0ad0: 2f 52 65 67 30 31 30 31 32 30 32 30 5f 57 47 53  /Reg01012020_WGS
0ae0: 38 34 0d 0a 0d 0a 53 45 4c 45 43 54 20 5a 69 70  84....SELECT Zip
0af0: 66 69 6c 65 5f 73 68 70 4e 20 28 20 27 63 3a 2f  file_shpN ( 'c:/
0b00: 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e  users/afuri/Down
0b10: 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31 30 31  loads/Limiti0101
0b20: 32 30 32 30 2e 7a 69 70 27 20 2c 20 34 20 29 0d  2020.zip' , 4 ).
0b30: 0a 2d 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74 69  .-------..Limiti
0b40: 30 31 30 31 32 30 32 30 2f 52 69 70 47 65 6f 30  01012020/RipGeo0
0b50: 31 30 31 32 30 32 30 2f 52 69 70 47 65 6f 30 31  1012020/RipGeo01
0b60: 30 31 32 30 32 30 5f 57 47 53 38 34 0d 0a 3c 2f  012020_WGS84..</
0b70: 76 65 72 62 61 74 69 6d 3e 3c 75 6c 3e 0d 0a 3c  verbatim><ul>..<
0b80: 6c 69 3e 74 68 65 20 53 51 4c 20 66 75 6e 63 74  li>the SQL funct
0b90: 69 6f 6e 20 3c 62 3e 5a 69 70 66 69 6c 65 5f 53  ion <b>Zipfile_S
0ba0: 68 70 4e 28 29 3c 2f 62 3e 20 77 69 6c 6c 20 69  hpN()</b> will i
0bb0: 6e 73 70 65 63 74 20 61 20 5a 69 70 66 69 6c 65  nspect a Zipfile
0bc0: 20 74 68 65 6e 20 72 65 74 75 72 6e 69 6e 67 20   then returning 
0bd0: 74 68 65 20 3c 62 3e 3c 69 3e 62 61 73 65 6e 61  the <b><i>basena
0be0: 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 6f 66 20 74 68  me</i></b> of th
0bf0: 65 20 3c 62 3e 4e 74 68 3c 2f 62 3e 20 53 68 61  e <b>Nth</b> Sha
0c00: 70 65 66 69 6c 65 20 69 74 20 63 6f 6e 74 61 69  pefile it contai
0c10: 6e 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 74  ns.</li>..<li>it
0c20: 20 72 65 71 75 69 72 65 73 20 74 77 6f 20 61 72   requires two ar
0c30: 67 75 6d 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a  guments:..<ul>..
0c40: 3c 6c 69 3e 74 68 65 20 61 62 73 6f 6c 75 74 65  <li>the absolute
0c50: 20 6f 72 20 72 65 6c 61 74 69 76 65 20 70 61 74   or relative pat
0c60: 68 20 6c 65 61 64 69 6e 67 20 74 6f 20 74 68 65  h leading to the
0c70: 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a   Zipfile.</li>..
0c80: 3c 6c 69 3e 74 68 65 20 72 65 6c 61 74 69 76 65  <li>the relative
0c90: 20 69 6e 64 65 78 20 28 3c 62 3e 31 20 62 61 73   index (<b>1 bas
0ca0: 65 64 3c 2f 62 3e 29 20 6f 66 20 74 68 65 20 53  ed</b>) of the S
0cb0: 68 61 70 65 66 69 6c 65 20 77 69 74 68 69 6e 20  hapefile within 
0cc0: 74 68 65 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c 69  the Zipfile.</li
0cd0: 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c  >..</ul></li>..<
0ce0: 6c 69 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a 20  li><b>Note</b>: 
0cf0: 3c 62 3e 4e 55 4c 4c 3c 2f 62 3e 20 77 69 6c 6c  <b>NULL</b> will
0d00: 20 62 65 20 72 65 74 75 72 6e 65 64 20 69 66 20   be returned if 
0d10: 74 68 65 20 5a 69 70 66 69 6c 65 20 64 6f 65 73  the Zipfile does
0d20: 20 6e 6f 74 20 65 78 69 73 74 20 6f 66 20 69 66   not exist of if
0d30: 20 69 74 27 73 20 69 6e 76 61 6c 69 64 20 6f 72   it's invalid or
0d40: 20 69 66 20 74 68 65 20 69 6e 64 65 78 20 76 61   if the index va
0d50: 6c 75 65 20 69 73 20 6f 75 74 73 69 64 65 20 74  lue is outside t
0d60: 68 65 20 65 78 70 65 63 74 65 64 20 72 61 6e 67  he expected rang
0d70: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a  e.</li>..</ul>..
0d80: 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45  <verbatim>..SELE
0d90: 43 54 20 50 52 4f 4a 5f 47 75 65 73 73 53 72 69  CT PROJ_GuessSri
0da0: 64 46 72 6f 6d 5a 69 70 53 48 50 20 28 20 27 63  dFromZipSHP ( 'c
0db0: 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f  :/users/afuri/Do
0dc0: 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31  wnloads/Limiti01
0dd0: 30 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 27 4c  012020.zip' , 'L
0de0: 69 6d 69 74 69 30 31 30 31 32 30 32 30 2f 43 6f  imiti01012020/Co
0df0: 6d 30 31 30 31 32 30 32 30 2f 43 6f 6d 30 31 30  m01012020/Com010
0e00: 31 32 30 32 30 5f 57 47 53 38 34 27 20 29 0d 0a  12020_WGS84' )..
0e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 33 32  ------------..32
0e20: 36 33 32 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e  632..</verbatim>
0e30: 0d 0a 3c 6c 69 3e 74 68 65 20 53 51 4c 20 66 75  ..<li>the SQL fu
0e40: 6e 63 74 69 6f 6e 20 3c 62 3e 50 52 4f 4a 5f 47  nction <b>PROJ_G
0e50: 75 65 73 73 53 72 69 64 46 72 6f 6d 5a 69 70 53  uessSridFromZipS
0e60: 48 50 28 29 3c 2f 62 3e 20 77 69 6c 6c 20 69 6e  HP()</b> will in
0e70: 73 70 65 63 74 20 61 20 5a 69 70 66 69 6c 65 20  spect a Zipfile 
0e80: 74 68 65 6e 20 72 65 74 75 72 6e 69 6e 67 20 74  then returning t
0e90: 68 65 20 3c 62 3e 53 52 49 44 3c 2f 62 3e 20 76  he <b>SRID</b> v
0ea0: 61 6c 75 65 20 64 65 63 6c 61 72 65 64 20 62 79  alue declared by
0eb0: 20 74 68 65 20 3c 62 3e 2e 50 52 4a 3c 2f 62 3e   the <b>.PRJ</b>
0ec0: 20 6d 65 6d 62 65 72 20 20 6f 66 20 74 68 65 20   member  of the 
0ed0: 53 68 61 70 65 66 69 6c 65 20 63 6f 6e 74 61 69  Shapefile contai
0ee0: 6e 65 64 20 69 6e 74 6f 20 74 68 65 20 5a 69 70  ned into the Zip
0ef0: 66 69 6c 65 20 61 73 20 69 64 65 6e 74 69 66 69  file as identifi
0f00: 65 64 20 62 79 20 69 74 73 20 3c 62 3e 3c 69 3e  ed by its <b><i>
0f10: 62 61 73 65 6e 61 6d 65 3c 2f 69 3e 3c 2f 62 3e  basename</i></b>
0f20: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 74 20 72  .</li>..<li>it r
0f30: 65 71 75 69 72 65 73 20 74 77 6f 20 61 72 67 75  equires two argu
0f40: 6d 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c  ments:..<ul>..<l
0f50: 69 3e 74 68 65 20 61 62 73 6f 6c 75 74 65 20 6f  i>the absolute o
0f60: 72 20 72 65 6c 61 74 69 76 65 20 70 61 74 68 20  r relative path 
0f70: 6c 65 61 64 69 6e 67 20 74 6f 20 74 68 65 20 5a  leading to the Z
0f80: 69 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  ipfile.</li>..<l
0f90: 69 3e 74 68 65 20 3c 62 3e 3c 69 3e 62 61 73 65  i>the <b><i>base
0fa0: 6e 61 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 6f 66 20  name</i></b> of 
0fb0: 74 68 65 20 53 68 61 70 65 66 69 6c 65 20 77 69  the Shapefile wi
0fc0: 74 68 69 6e 20 74 68 65 20 5a 69 70 66 69 6c 65  thin the Zipfile
0fd0: 20 28 77 69 74 68 6f 75 74 20 61 64 64 69 6e 67   (without adding
0fe0: 20 61 6e 79 20 3c 62 3e 2e 73 68 70 3c 2f 62 3e   any <b>.shp</b>
0ff0: 2c 20 3c 62 3e 2e 73 68 78 3c 2f 62 3e 20 6f 72  , <b>.shx</b> or
1000: 20 3c 62 3e 2e 64 62 66 3c 2f 62 3e 20 73 75 66   <b>.dbf</b> suf
1010: 66 69 78 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c  fix).</li>..</ul
1020: 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4e  ></li>..<li><b>N
1030: 6f 74 65 3c 2f 62 3e 3a 20 3c 62 3e 2d 31 3c 2f  ote</b>: <b>-1</
1040: 62 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72  b> will be retur
1050: 6e 65 64 20 69 66 20 74 68 65 20 53 68 61 70 65  ned if the Shape
1060: 66 69 6c 65 20 68 61 73 20 6e 6f 20 3c 62 3e 2e  file has no <b>.
1070: 50 52 4a 3c 2f 62 3e 20 6d 65 6d 62 65 72 2c 20  PRJ</b> member, 
1080: 6f 66 20 69 66 20 69 74 20 63 6f 6e 74 61 69 6e  of if it contain
1090: 73 20 61 6e 20 69 6e 76 61 6c 69 64 20 57 4b 54  s an invalid WKT
10a0: 20 64 65 66 69 6e 69 74 69 6f 6e 2e 3c 2f 6c 69   definition.</li
10b0: 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 2f 6c 69 3e 3c 62  >..<ul>..</li><b
10c0: 3e 4e 55 4c 4c 3c 2f 62 3e 20 77 69 6c 6c 20 62  >NULL</b> will b
10d0: 65 20 72 65 74 75 72 6e 65 64 20 6f 6e 20 69 6e  e returned on in
10e0: 76 61 6c 69 64 20 61 72 67 75 6d 65 6e 74 73 20  valid arguments 
10f0: 6f 72 20 69 66 20 74 68 65 20 53 68 61 70 65 66  or if the Shapef
1100: 69 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69  ile does not exi
1110: 73 74 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 6c 69 3e 3c  st.</li>..</li><
1120: 2f 75 6c 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 74 61  /ul>..</ul>..<ta
1130: 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 66  ble bgcolor="#ff
1140: 66 66 64 30 22 20 63 65 6c 6c 73 70 61 63 69 6e  ffd0" cellspacin
1150: 67 3d 22 31 32 22 20 63 65 6c 6c 70 61 64 64 69  g="12" cellpaddi
1160: 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74 64  ng="8">..<tr><td
1170: 3e 0d 0a 3c 62 3e 50 6c 65 61 73 65 20 6e 6f 74  >..<b>Please not
1180: 65 3c 2f 62 3e 3a 20 74 68 65 20 53 51 4c 20 66  e</b>: the SQL f
1190: 75 6e 63 74 69 6f 6e 20 3c 62 3e 50 52 4f 4a 5f  unction <b>PROJ_
11a0: 47 75 65 73 73 53 72 69 64 46 72 6f 6d 5a 69 70  GuessSridFromZip
11b0: 53 48 50 28 29 3c 2f 62 3e 20 77 69 6c 6c 20 62  SHP()</b> will b
11c0: 65 20 61 76 61 69 6c 61 62 6c 65 20 6f 6e 6c 79  e available only
11d0: 20 77 68 65 6e 20 53 70 61 74 69 61 4c 69 74 65   when SpatiaLite
11e0: 20 69 73 20 6c 69 6e 6b 65 64 20 74 6f 20 61 20   is linked to a 
11f0: 72 65 63 65 6e 74 20 76 65 72 73 69 6f 6e 20 6f  recent version o
1200: 66 20 3c 62 3e 50 52 4f 4a 3c 2f 62 3e 20 28 3c  f <b>PROJ</b> (<
1210: 62 3e 50 52 4f 4a 2e 36 2e 78 2e 78 3c 2f 62 3e  b>PROJ.6.x.x</b>
1220: 20 6f 72 20 61 6e 79 20 6c 61 74 65 72 29 2e 0d   or any later)..
1230: 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74  .</td></tr>..</t
1240: 61 62 6c 65 3e 0d 0a 3c 76 65 72 62 61 74 69 6d  able>..<verbatim
1250: 3e 0d 0a 53 45 4c 45 43 54 20 49 6d 70 6f 72 74  >..SELECT Import
1260: 5a 69 70 53 48 50 20 28 20 27 63 3a 2f 75 73 65  ZipSHP ( 'c:/use
1270: 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61  rs/afuri/Downloa
1280: 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32  ds/Limiti0101202
1290: 30 2e 7a 69 70 27 20 2c 20 0d 0a 20 20 20 20 20  0.zip' , ..     
12a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
12b0: 20 27 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30   'Limiti01012020
12c0: 2f 43 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f 6d  /Com01012020/Com
12d0: 30 31 30 31 32 30 32 30 5f 57 47 53 38 34 27 20  01012020_WGS84' 
12e0: 2c 20 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20  , ..            
12f0: 20 20 20 20 20 20 20 20 20 20 27 63 6f 6d 75 6e            'comun
1300: 69 27 2c 20 27 55 54 46 2d 38 27 20 29 20 0d 0a  i', 'UTF-8' ) ..
1310: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 37 39 30 34 0d  ---------..7904.
1320: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 54 68  .</verbatim>..Th
1330: 65 20 3c 62 3e 49 6d 70 6f 72 74 5a 69 70 53 48  e <b>ImportZipSH
1340: 50 28 29 3c 2f 62 3e 20 63 6c 6f 73 65 6c 79 20  P()</b> closely 
1350: 6d 69 6d 69 63 73 20 3c 62 3e 49 6d 70 6f 72 74  mimics <b>Import
1360: 53 48 50 28 29 3c 2f 62 3e 2c 20 65 78 63 65 70  SHP()</b>, excep
1370: 74 20 69 6e 20 74 68 61 74 20 69 74 20 72 65 71  t in that it req
1380: 75 69 72 65 73 20 6f 6e 65 20 6d 6f 72 65 20 61  uires one more a
1390: 72 67 75 6d 65 6e 74 20 73 70 65 63 69 66 79 69  rgument specifyi
13a0: 6e 67 20 74 68 65 20 70 61 74 68 6e 61 6d 65 20  ng the pathname 
13b0: 6f 66 20 74 68 65 20 5a 69 70 66 69 6c 65 20 63  of the Zipfile c
13c0: 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 53 68  ontaining the Sh
13d0: 61 70 65 66 69 6c 65 20 74 6f 20 62 65 20 69 6d  apefile to be im
13e0: 70 6f 72 74 65 64 2e 3c 62 72 3e 0d 0a 4f 6e 20  ported.<br>..On 
13f0: 73 75 63 63 65 73 73 20 69 74 20 77 69 6c 6c 20  success it will 
1400: 72 65 74 75 72 6e 20 74 68 65 20 6e 75 6d 62 65  return the numbe
1410: 72 20 6f 66 20 66 65 61 74 75 72 65 73 20 69 6e  r of features in
1420: 73 65 72 74 65 64 20 69 6e 74 6f 20 74 68 65 20  serted into the 
1430: 53 70 61 74 69 61 6c 20 54 61 62 6c 65 20 74 68  Spatial Table th
1440: 61 74 20 68 61 73 20 6a 75 73 74 20 62 65 65 6e  at has just been
1450: 20 63 72 65 61 74 65 64 3b 20 6f 6e 20 66 61 69   created; on fai
1460: 6c 75 72 65 20 69 74 20 77 69 6c 6c 20 6a 75 73  lure it will jus
1470: 74 20 72 65 74 75 72 6e 20 3c 62 3e 4e 55 4c 4c  t return <b>NULL
1480: 3c 2f 62 3e 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 49  </b>.<br><br>..I
1490: 6e 20 69 74 73 20 73 69 6d 70 6c 65 73 74 20 66  n its simplest f
14a0: 6f 72 6d 20 69 74 20 72 65 71 75 69 72 65 73 20  orm it requires 
14b0: 6a 75 73 74 20 66 6f 75 72 20 61 72 67 75 6d 65  just four argume
14c0: 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  nts:..<ul>..<li>
14d0: 74 68 65 20 61 62 73 6f 6c 75 74 65 20 6f 72 20  the absolute or 
14e0: 72 65 6c 61 74 69 76 65 20 70 61 74 68 20 6c 65  relative path le
14f0: 61 64 69 6e 67 20 74 6f 20 74 68 65 20 5a 69 70  ading to the Zip
1500: 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  file.</li>..<li>
1510: 74 68 65 20 3c 62 3e 3c 69 3e 62 61 73 65 6e 61  the <b><i>basena
1520: 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 6f 66 20 74 68  me</i></b> of th
1530: 65 20 53 68 61 70 65 66 69 6c 65 20 77 69 74 68  e Shapefile with
1540: 69 6e 20 74 68 65 20 5a 69 70 66 69 6c 65 20 28  in the Zipfile (
1550: 77 69 74 68 6f 75 74 20 61 64 64 69 6e 67 20 61  without adding a
1560: 6e 79 20 3c 62 3e 2e 73 68 70 3c 2f 62 3e 2c 20  ny <b>.shp</b>, 
1570: 3c 62 3e 2e 73 68 78 3c 2f 62 3e 20 6f 72 20 3c  <b>.shx</b> or <
1580: 62 3e 2e 64 62 66 3c 2f 62 3e 20 73 75 66 66 69  b>.dbf</b> suffi
1590: 78 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68  x).</li>..<li>th
15a0: 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 53 70  e name of the Sp
15b0: 61 74 69 61 6c 20 54 61 62 6c 65 20 74 6f 20 62  atial Table to b
15c0: 65 20 63 72 65 61 74 65 64 20 61 6e 64 20 74 68  e created and th
15d0: 65 6e 20 70 6f 70 75 6c 61 74 65 64 20 62 79 20  en populated by 
15e0: 69 6d 70 6f 72 74 69 6e 67 20 74 68 65 20 77 68  importing the wh
15f0: 6f 6c 65 20 53 68 61 70 65 66 69 6c 65 2e 3c 2f  ole Shapefile.</
1600: 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e 61 6d  li>..<li>the nam
1610: 65 20 6f 66 20 74 68 65 20 63 68 61 72 73 65 74  e of the charset
1620: 20 65 6e 63 6f 64 69 6e 67 20 61 64 6f 70 74 65   encoding adopte
1630: 64 20 62 79 20 74 68 65 20 3c 62 3e 2e 64 62 66  d by the <b>.dbf
1640: 3c 2f 62 3e 20 6d 65 6d 62 65 72 20 6f 66 20 74  </b> member of t
1650: 68 65 20 53 68 61 70 65 66 69 6c 65 2e 3c 2f 6c  he Shapefile.</l
1660: 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65 72 62  i>..</ul>..<verb
1670: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 49 6d  atim>..SELECT Im
1680: 70 6f 72 74 5a 69 70 53 48 50 20 28 20 27 63 3a  portZipSHP ( 'c:
1690: 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f 77  /users/afuri/Dow
16a0: 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31 30  nloads/Limiti010
16b0: 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 0d 0a 20  12020.zip' , .. 
16c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
16d0: 20 20 20 20 20 27 4c 69 6d 69 74 69 30 31 30 31       'Limiti0101
16e0: 32 30 32 30 2f 52 65 67 30 31 30 31 32 30 32 30  2020/Reg01012020
16f0: 2f 52 65 67 30 31 30 31 32 30 32 30 5f 57 47 53  /Reg01012020_WGS
1700: 38 34 27 20 2c 20 0d 0a 20 20 20 20 20 20 20 20  84' , ..        
1710: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 72                'r
1720: 65 67 69 6f 6e 69 27 2c 20 27 55 54 46 2d 38 27  egioni', 'UTF-8'
1730: 20 2c 20 33 32 36 33 32 20 2c 20 27 74 68 65 5f   , 32632 , 'the_
1740: 67 65 6f 6d 27 20 2c 20 27 63 6f 64 5f 72 65 67  geom' , 'cod_reg
1750: 27 20 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 20  ' ,..           
1760: 20 20 20 20 20 20 20 20 20 20 20 27 4d 55 4c 54             'MULT
1770: 49 50 4f 4c 59 47 4f 4e 27 20 2c 20 30 20 2c 20  IPOLYGON' , 0 , 
1780: 30 20 2c 20 31 20 2c 20 30 20 2c 20 27 4c 4f 57  0 , 1 , 0 , 'LOW
1790: 45 52 27 20 2c 20 31 20 2c 20 30 20 29 20 0d 0a  ER' , 1 , 0 ) ..
17a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 32  -------------..2
17b0: 30 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a  0..</verbatim>..
17c0: 49 6e 20 69 74 73 20 63 6f 6d 70 6c 65 74 65 20  In its complete 
17d0: 66 6f 72 6d 20 3c 62 3e 49 6d 70 6f 72 74 5a 69  form <b>ImportZi
17e0: 70 53 48 50 28 29 3c 2f 62 3e 20 73 75 70 70 6f  pSHP()</b> suppo
17f0: 72 74 73 20 74 68 65 73 65 20 66 75 72 74 68 65  rts these furthe
1800: 72 20 6f 70 74 69 6f 6e 61 6c 20 61 72 67 75 6d  r optional argum
1810: 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69  ents:..<ul>..<li
1820: 3e 61 6e 20 65 78 70 6c 69 63 69 74 6c 79 20 73  >an explicitly s
1830: 74 61 74 65 64 20 53 52 49 44 3c 2f 6c 69 3e 0d  tated SRID</li>.
1840: 0a 3c 6c 69 3e 74 68 65 20 6e 61 6d 65 20 6f 66  .<li>the name of
1850: 20 74 68 65 20 47 65 6f 6d 65 74 72 79 20 43 6f   the Geometry Co
1860: 6c 75 6d 6e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74  lumn</li>..<li>t
1870: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 53  he name of the S
1880: 68 61 70 65 66 69 6c 65 73 20 63 6f 6c 75 6d 6e  hapefiles column
1890: 20 74 6f 20 62 65 20 61 73 73 75 6d 65 64 20 61   to be assumed a
18a0: 73 20 74 68 65 20 50 72 69 6d 61 72 79 20 4b 65  s the Primary Ke
18b0: 79 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 6e 20 65  y</li>..<li>an e
18c0: 78 70 6c 69 63 69 74 6c 79 20 73 65 74 20 47 65  xplicitly set Ge
18d0: 6f 6d 65 74 72 79 20 54 79 70 65 3c 2f 6c 69 3e  ometry Type</li>
18e0: 0d 0a 3c 6c 69 3e 61 20 3c 69 3e 62 6f 6f 6c 65  ..<li>a <i>boole
18f0: 61 6e 3c 2f 69 3e 20 66 6c 61 67 20 72 65 71 75  an</i> flag requ
1900: 65 73 74 69 6e 67 20 74 6f 20 63 61 73 74 20 61  esting to cast a
1910: 6c 6c 20 63 6f 6f 72 64 69 6e 61 74 65 73 20 74  ll coordinates t
1920: 6f 20 58 59 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61  o XY</li>..<li>a
1930: 20 3c 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20   <i>boolean</i> 
1940: 66 6c 61 67 20 72 65 71 75 65 73 74 69 6e 67 20  flag requesting 
1950: 66 6f 72 20 43 6f 6d 70 72 65 73 73 65 64 20 47  for Compressed G
1960: 65 6f 6d 65 74 72 69 65 73 3c 2f 6c 69 3e 0d 0a  eometries</li>..
1970: 3c 6c 69 3e 61 20 3c 69 3e 62 6f 6f 6c 65 61 6e  <li>a <i>boolean
1980: 3c 2f 69 3e 20 66 6c 61 67 20 72 65 71 75 65 73  </i> flag reques
1990: 74 69 6e 67 20 66 6f 72 20 63 72 65 61 74 69 6e  ting for creatin
19a0: 67 20 61 20 53 70 61 74 69 61 6c 20 49 6e 64 65  g a Spatial Inde
19b0: 78 20 73 75 70 70 6f 72 74 69 6e 67 20 74 68 65  x supporting the
19c0: 20 47 65 6f 6d 65 74 72 79 20 43 6f 6c 75 6d 6e   Geometry Column
19d0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 3c 69 3e  </li>..<li>a <i>
19e0: 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20 66 6c 61 67  boolean</i> flag
19f0: 20 72 65 71 75 65 73 74 69 6e 67 20 66 6f 72 20   requesting for 
1a00: 69 6d 70 6f 72 74 69 6e 67 20 61 6c 6c 20 64 61  importing all da
1a10: 74 65 20 76 61 6c 75 65 73 20 61 73 20 70 6c 61  te values as pla
1a20: 69 6e 20 74 65 78 74 20 28 69 6e 73 74 65 61 64  in text (instead
1a30: 20 6f 66 20 61 73 20 4a 75 6c 69 61 6e 20 44 61   of as Julian Da
1a40: 74 65 73 29 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61  tes)</li>..<li>a
1a50: 20 74 65 78 74 20 73 74 72 69 6e 67 20 73 75 63   text string suc
1a60: 68 20 61 73 20 3c 62 3e 4c 4f 57 45 52 3c 2f 62  h as <b>LOWER</b
1a70: 3e 2c 20 3c 62 3e 55 50 50 45 52 3c 2f 62 3e 20  >, <b>UPPER</b> 
1a80: 6f 72 20 3c 62 3e 53 41 4d 45 3c 2f 62 3e 20 73  or <b>SAME</b> s
1a90: 70 65 63 69 66 79 69 6e 67 20 69 66 20 61 6c 6c  pecifying if all
1aa0: 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 73 68   column names sh
1ab0: 6f 75 6c 64 20 62 65 20 72 65 73 70 65 63 74 69  ould be respecti
1ac0: 76 65 6c 79 20 4c 6f 77 65 72 63 61 73 65 20 6f  vely Lowercase o
1ad0: 72 20 55 70 70 65 72 63 61 73 65 20 6f 72 20 61  r Uppercase or a
1ae0: 73 20 69 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  s is.</li>..<li>
1af0: 61 20 3c 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e  a <i>boolean</i>
1b00: 20 66 6c 61 67 20 66 6f 72 20 69 6d 6d 65 64 69   flag for immedi
1b10: 61 74 65 6c 79 20 75 70 64 61 74 69 6e 67 20 74  ately updating t
1b20: 61 62 6c 65 27 73 20 53 74 61 74 69 73 74 69 63  able's Statistic
1b30: 73 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 3c 69  s</li>..<li>a <i
1b40: 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20 66 6c 61  >boolean</i> fla
1b50: 67 20 61 63 74 69 76 61 74 69 6e 67 20 76 65 72  g activating ver
1b60: 62 6f 73 65 20 6d 6f 64 65 3c 2f 6c 69 3e 20 20  bose mode</li>  
1b70: 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 3c 62 72  ..</ul>..<br><br
1b80: 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 41 63 63  >..<hr>..<h3>Acc
1b90: 65 73 73 69 6e 67 20 61 20 5a 69 70 70 65 64 20  essing a Zipped 
1ba0: 44 42 46 3c 2f 68 33 3e 0d 0a 41 6c 6c 20 74 68  DBF</h3>..All th
1bb0: 65 73 65 20 6e 65 77 20 53 51 4c 20 66 75 6e 63  ese new SQL func
1bc0: 74 69 6f 6e 73 20 61 72 65 20 6e 6f 77 20 73 75  tions are now su
1bd0: 70 70 6f 72 74 65 64 3a 0d 0a 3c 75 6c 3e 0d 0a  pported:..<ul>..
1be0: 3c 6c 69 3e 3c 62 3e 49 6d 70 6f 72 74 5a 69 70  <li><b>ImportZip
1bf0: 44 42 46 28 29 3c 2f 62 3e 3a 20 74 68 65 20 6d  DBF()</b>: the m
1c00: 61 69 6e 20 66 75 6e 63 74 69 6f 6e 20 61 6c 6c  ain function all
1c10: 6f 77 69 6e 67 20 74 6f 20 69 6d 70 6f 72 74 20  owing to import 
1c20: 61 20 77 68 6f 6c 65 20 44 42 46 20 66 69 6c 65  a whole DBF file
1c30: 20 69 6e 74 6f 20 61 20 6e 65 77 20 54 61 62 6c   into a new Tabl
1c40: 65 20 69 6e 74 6f 20 74 68 65 20 63 75 72 72 65  e into the curre
1c50: 6e 74 6c 79 20 63 6f 6e 6e 65 63 74 65 64 20 44  ntly connected D
1c60: 61 74 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c  atabase.</li>..<
1c70: 6c 69 3e 3c 62 3e 5a 69 70 66 69 6c 65 5f 4e 75  li><b>Zipfile_Nu
1c80: 6d 44 42 46 28 29 3c 2f 62 3e 3a 20 61 20 68 65  mDBF()</b>: a he
1c90: 6c 70 65 72 20 66 75 6e 63 74 69 6f 6e 20 72 65  lper function re
1ca0: 74 75 72 6e 69 6e 67 20 74 68 65 20 74 6f 74 61  turning the tota
1cb0: 6c 20 63 6f 75 6e 74 20 6f 66 20 44 42 46 20 66  l count of DBF f
1cc0: 69 6c 65 73 20 63 6f 6e 74 61 69 6e 65 64 20 77  iles contained w
1cd0: 69 74 68 69 6e 20 61 20 67 69 76 65 6e 20 5a 69  ithin a given Zi
1ce0: 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  pfile.</li>..<li
1cf0: 3e 3c 62 3e 5a 69 70 66 69 6c 65 5f 44 62 66 4e  ><b>Zipfile_DbfN
1d00: 28 29 3c 2f 62 3e 3a 20 61 20 68 65 6c 70 65 72  ()</b>: a helper
1d10: 20 66 75 6e 63 74 69 6f 6e 20 72 65 74 75 72 6e   function return
1d20: 69 6e 67 20 74 68 65 20 3c 62 3e 3c 69 3e 66 69  ing the <b><i>fi
1d30: 6c 65 6e 61 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 66  lename</i></b> f
1d40: 6f 72 20 74 68 65 20 3c 62 3e 4e 74 68 3c 2f 62  or the <b>Nth</b
1d50: 3e 20 44 42 46 20 66 69 6c 65 20 63 6f 6e 74 61  > DBF file conta
1d60: 69 6e 65 64 20 77 69 74 68 69 6e 20 61 20 67 69  ined within a gi
1d70: 76 65 6e 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c 69  ven Zipfile.</li
1d80: 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d 0a  >..</ul>..<br>..
1d90: 57 65 27 6c 6c 20 63 6f 6e 74 69 6e 75 65 20 74  We'll continue t
1da0: 6f 20 75 73 65 20 74 68 65 20 73 61 6d 65 20 5a  o use the same Z
1db0: 69 70 66 69 6c 65 20 69 6e 20 74 68 69 73 20 74  ipfile in this t
1dc0: 75 74 6f 72 69 61 6c 20 74 6f 6f 2e 0d 0a 3c 76  utorial too...<v
1dd0: 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54  erbatim>..SELECT
1de0: 20 5a 69 70 66 69 6c 65 5f 4e 75 6d 44 42 46 20   Zipfile_NumDBF 
1df0: 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72  ( 'c:/users/afur
1e00: 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69  i/Downloads/Limi
1e10: 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20  ti01012020.zip' 
1e20: 29 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d  )..------------.
1e30: 0a 34 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d  .4..</verbatim>.
1e40: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 53  .<ul>..<li>the S
1e50: 51 4c 20 66 75 6e 63 74 69 6f 6e 20 3c 62 3e 5a  QL function <b>Z
1e60: 69 70 66 69 6c 65 5f 4e 75 6d 44 42 46 28 29 3c  ipfile_NumDBF()<
1e70: 2f 62 3e 20 77 69 6c 6c 20 69 6e 73 70 65 63 74  /b> will inspect
1e80: 20 61 20 5a 69 70 66 69 6c 65 20 74 68 65 6e 20   a Zipfile then 
1e90: 72 65 74 75 72 6e 69 6e 67 20 74 68 65 20 74 6f  returning the to
1ea0: 74 61 6c 20 63 6f 75 6e 74 20 6f 66 20 44 42 46  tal count of DBF
1eb0: 20 66 69 6c 65 73 20 69 74 20 63 6f 6e 74 61 69   files it contai
1ec0: 6e 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 74  ns.</li>..<li>it
1ed0: 20 72 65 71 75 69 72 65 73 20 6a 75 73 74 20 61   requires just a
1ee0: 20 73 69 6e 67 6c 65 20 61 72 67 75 6d 65 6e 74   single argument
1ef0: 3a 20 74 68 65 20 61 62 73 6f 6c 75 74 65 20 6f  : the absolute o
1f00: 72 20 72 65 6c 61 74 69 76 65 20 70 61 74 68 20  r relative path 
1f10: 6c 65 61 64 69 6e 67 20 74 6f 20 74 68 65 20 5a  leading to the Z
1f20: 69 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  ipfile.</li>..<l
1f30: 69 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 20 69 74  i><b>Note</b> it
1f40: 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 3c 62 3e   will return <b>
1f50: 30 3c 2f 62 3e 20 69 66 20 74 68 65 20 5a 69 70  0</b> if the Zip
1f60: 66 69 6c 65 20 64 6f 65 73 20 6e 6f 74 20 63 6f  file does not co
1f70: 6e 74 61 69 6e 20 61 6e 79 20 44 42 46 20 66 69  ntain any DBF fi
1f80: 6c 65 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c  le...<ul>..<li><
1f90: 62 3e 4e 55 4c 4c 3c 2f 62 3e 20 77 69 6c 6c 20  b>NULL</b> will 
1fa0: 62 65 20 72 65 74 75 72 6e 65 64 20 69 66 20 74  be returned if t
1fb0: 68 65 20 5a 69 70 66 69 6c 65 20 64 6f 65 73 20  he Zipfile does 
1fc0: 6e 6f 74 20 65 78 69 73 74 20 6f 66 20 69 66 20  not exist of if 
1fd0: 69 74 27 73 20 63 6f 72 72 75 70 74 65 64 20 6f  it's corrupted o
1fe0: 72 20 69 6e 76 61 6c 69 64 2e 3c 2f 6c 69 3e 0d  r invalid.</li>.
1ff0: 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f 75  .</ul></li>..</u
2000: 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a  l>..<verbatim>..
2010: 53 45 4c 45 43 54 20 5a 69 70 66 69 6c 65 5f 64  SELECT Zipfile_d
2020: 62 66 4e 20 28 20 27 63 3a 2f 75 73 65 72 73 2f  bfN ( 'c:/users/
2030: 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f  afuri/Downloads/
2040: 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2e 7a  Limiti01012020.z
2050: 69 70 27 20 2c 20 31 20 29 0d 0a 2d 2d 2d 2d 2d  ip' , 1 )..-----
2060: 2d 0d 0a 4c 69 6d 69 74 69 30 31 30 31 32 30 32  -..Limiti0101202
2070: 30 2f 43 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f  0/Com01012020/Co
2080: 6d 30 31 30 31 32 30 32 30 5f 57 47 53 38 34 2e  m01012020_WGS84.
2090: 64 62 66 0d 0a 0d 0a 53 45 4c 45 43 54 20 5a 69  dbf....SELECT Zi
20a0: 70 66 69 6c 65 5f 64 62 66 4e 20 28 20 27 63 3a  pfile_dbfN ( 'c:
20b0: 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f 77  /users/afuri/Dow
20c0: 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31 30  nloads/Limiti010
20d0: 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 32 20 29  12020.zip' , 2 )
20e0: 0d 0a 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74 69  ..------..Limiti
20f0: 30 31 30 31 32 30 32 30 2f 50 72 6f 76 43 4d 30  01012020/ProvCM0
2100: 31 30 31 32 30 32 30 2f 50 72 6f 76 43 4d 30 31  1012020/ProvCM01
2110: 30 31 32 30 32 30 5f 57 47 53 38 34 2e 64 62 66  012020_WGS84.dbf
2120: 0d 0a 0d 0a 53 45 4c 45 43 54 20 5a 69 70 66 69  ....SELECT Zipfi
2130: 6c 65 5f 64 62 66 4e 20 28 20 27 63 3a 2f 75 73  le_dbfN ( 'c:/us
2140: 65 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f  ers/afuri/Downlo
2150: 61 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30  ads/Limiti010120
2160: 32 30 2e 7a 69 70 27 20 2c 20 33 20 29 0d 0a 2d  20.zip' , 3 )..-
2170: 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74 69 30 31 30  -----..Limiti010
2180: 31 32 30 32 30 2f 52 65 67 30 31 30 31 32 30 32  12020/Reg0101202
2190: 30 2f 52 65 67 30 31 30 31 32 30 32 30 5f 57 47  0/Reg01012020_WG
21a0: 53 38 34 2e 64 62 66 0d 0a 0d 0a 53 45 4c 45 43  S84.dbf....SELEC
21b0: 54 20 5a 69 70 66 69 6c 65 5f 64 62 66 4e 20 28  T Zipfile_dbfN (
21c0: 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72 69   'c:/users/afuri
21d0: 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74  /Downloads/Limit
21e0: 69 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20 2c  i01012020.zip' ,
21f0: 20 34 20 29 0d 0a 2d 2d 2d 2d 2d 2d 2d 0d 0a 4c   4 )..-------..L
2200: 69 6d 69 74 69 30 31 30 31 32 30 32 30 2f 52 69  imiti01012020/Ri
2210: 70 47 65 6f 30 31 30 31 32 30 32 30 2f 52 69 70  pGeo01012020/Rip
2220: 47 65 6f 30 31 30 31 32 30 32 30 5f 57 47 53 38  Geo01012020_WGS8
2230: 34 2e 64 62 66 0d 0a 3c 2f 76 65 72 62 61 74 69  4.dbf..</verbati
2240: 6d 3e 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20  m><ul>..<li>the 
2250: 53 51 4c 20 66 75 6e 63 74 69 6f 6e 20 3c 62 3e  SQL function <b>
2260: 5a 69 70 66 69 6c 65 5f 44 62 66 4e 28 29 3c 2f  Zipfile_DbfN()</
2270: 62 3e 20 77 69 6c 6c 20 69 6e 73 70 65 63 74 20  b> will inspect 
2280: 61 20 5a 69 70 66 69 6c 65 20 74 68 65 6e 20 72  a Zipfile then r
2290: 65 74 75 72 6e 69 6e 67 20 74 68 65 20 3c 62 3e  eturning the <b>
22a0: 3c 69 3e 66 69 6c 65 6e 61 6d 65 3c 2f 69 3e 3c  <i>filename</i><
22b0: 2f 62 3e 20 6f 66 20 74 68 65 20 3c 62 3e 4e 74  /b> of the <b>Nt
22c0: 68 3c 2f 62 3e 20 44 42 46 20 66 69 6c 65 20 69  h</b> DBF file i
22d0: 74 20 63 6f 6e 74 61 69 6e 73 2e 3c 2f 6c 69 3e  t contains.</li>
22e0: 0d 0a 3c 6c 69 3e 69 74 20 72 65 71 75 69 72 65  ..<li>it require
22f0: 73 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 3a  s two arguments:
2300: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20  ..<ul>..<li>the 
2310: 61 62 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c 61  absolute or rela
2320: 74 69 76 65 20 70 61 74 68 20 6c 65 61 64 69 6e  tive path leadin
2330: 67 20 74 6f 20 74 68 65 20 5a 69 70 66 69 6c 65  g to the Zipfile
2340: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20  .</li>..<li>the 
2350: 72 65 6c 61 74 69 76 65 20 69 6e 64 65 78 20 28  relative index (
2360: 3c 62 3e 31 20 62 61 73 65 64 3c 2f 62 3e 29 20  <b>1 based</b>) 
2370: 6f 66 20 74 68 65 20 44 42 46 20 66 69 6c 65 20  of the DBF file 
2380: 77 69 74 68 69 6e 20 74 68 65 20 5a 69 70 66 69  within the Zipfi
2390: 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c  le.</li>..</ul><
23a0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4e 6f 74  /li>..<li><b>Not
23b0: 65 3c 2f 62 3e 3a 20 3c 62 3e 4e 55 4c 4c 3c 2f  e</b>: <b>NULL</
23c0: 62 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72  b> will be retur
23d0: 6e 65 64 20 69 66 20 74 68 65 20 5a 69 70 66 69  ned if the Zipfi
23e0: 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73  le does not exis
23f0: 74 20 6f 66 20 69 66 20 69 74 27 73 20 69 6e 76  t of if it's inv
2400: 61 6c 69 64 20 6f 72 20 69 66 20 74 68 65 20 69  alid or if the i
2410: 6e 64 65 78 20 76 61 6c 75 65 20 69 73 20 6f 75  ndex value is ou
2420: 74 73 69 64 65 20 74 68 65 20 65 78 70 65 63 74  tside the expect
2430: 65 64 20 72 61 6e 67 65 2e 3c 2f 6c 69 3e 0d 0a  ed range.</li>..
2440: 3c 2f 75 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 6d  </ul>..<verbatim
2450: 3e 0d 0a 53 45 4c 45 43 54 20 49 6d 70 6f 72 74  >..SELECT Import
2460: 5a 69 70 44 42 46 20 28 20 27 63 3a 2f 75 73 65  ZipDBF ( 'c:/use
2470: 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61  rs/afuri/Downloa
2480: 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32  ds/Limiti0101202
2490: 30 2e 7a 69 70 27 20 2c 20 0d 0a 20 20 20 20 20  0.zip' , ..     
24a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
24b0: 20 27 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30   'Limiti01012020
24c0: 2f 43 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f 6d  /Com01012020/Com
24d0: 30 31 30 31 32 30 32 30 5f 57 47 53 38 34 2e 64  01012020_WGS84.d
24e0: 62 66 27 20 2c 20 0d 0a 20 20 20 20 20 20 20 20  bf' , ..        
24f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27 63                'c
2500: 6f 6d 75 6e 69 5f 64 62 66 27 2c 20 27 55 54 46  omuni_dbf', 'UTF
2510: 2d 38 27 20 29 20 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d  -8' ) ..--------
2520: 2d 0d 0a 37 39 30 34 0d 0a 3c 2f 76 65 72 62 61  -..7904..</verba
2530: 74 69 6d 3e 0d 0a 54 68 65 20 3c 62 3e 49 6d 70  tim>..The <b>Imp
2540: 6f 72 74 5a 69 70 44 42 46 28 29 3c 2f 62 3e 20  ortZipDBF()</b> 
2550: 63 6c 6f 73 65 6c 79 20 6d 69 6d 69 63 73 20 3c  closely mimics <
2560: 62 3e 49 6d 70 6f 72 74 44 42 46 28 29 3c 2f 62  b>ImportDBF()</b
2570: 3e 2c 20 65 78 63 65 70 74 20 69 6e 20 74 68 61  >, except in tha
2580: 74 20 69 74 20 72 65 71 75 69 72 65 73 20 6f 6e  t it requires on
2590: 65 20 6d 6f 72 65 20 61 72 67 75 6d 65 6e 74 20  e more argument 
25a0: 73 70 65 63 69 66 79 69 6e 67 20 74 68 65 20 70  specifying the p
25b0: 61 74 68 6e 61 6d 65 20 6f 66 20 74 68 65 20 5a  athname of the Z
25c0: 69 70 66 69 6c 65 20 63 6f 6e 74 61 69 6e 69 6e  ipfile containin
25d0: 67 20 74 68 65 20 44 42 46 20 66 69 6c 65 20 74  g the DBF file t
25e0: 6f 20 62 65 20 69 6d 70 6f 72 74 65 64 2e 3c 62  o be imported.<b
25f0: 72 3e 0d 0a 4f 6e 20 73 75 63 63 65 73 73 20 69  r>..On success i
2600: 74 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74 68  t will return th
2610: 65 20 6e 75 6d 62 65 72 20 6f 66 20 72 6f 77 73  e number of rows
2620: 20 69 6e 73 65 72 74 65 64 20 69 6e 74 6f 20 74   inserted into t
2630: 68 65 20 54 61 62 6c 65 20 74 68 61 74 20 68 61  he Table that ha
2640: 73 20 6a 75 73 74 20 62 65 65 6e 20 63 72 65 61  s just been crea
2650: 74 65 64 3b 20 6f 6e 20 66 61 69 6c 75 72 65 20  ted; on failure 
2660: 69 74 20 77 69 6c 6c 20 6a 75 73 74 20 72 65 74  it will just ret
2670: 75 72 6e 20 3c 62 3e 4e 55 4c 4c 3c 2f 62 3e 2e  urn <b>NULL</b>.
2680: 3c 62 72 3e 3c 62 72 3e 0d 0a 49 6e 20 69 74 73  <br><br>..In its
2690: 20 73 69 6d 70 6c 65 73 74 20 66 6f 72 6d 20 69   simplest form i
26a0: 74 20 72 65 71 75 69 72 65 73 20 6a 75 73 74 20  t requires just 
26b0: 66 6f 75 72 20 61 72 67 75 6d 65 6e 74 73 3a 0d  four arguments:.
26c0: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20 61  .<ul>..<li>the a
26d0: 62 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c 61 74  bsolute or relat
26e0: 69 76 65 20 70 61 74 68 20 6c 65 61 64 69 6e 67  ive path leading
26f0: 20 74 6f 20 74 68 65 20 5a 69 70 66 69 6c 65 2e   to the Zipfile.
2700: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 3c  </li>..<li>the <
2710: 62 3e 3c 69 3e 66 69 6c 65 6e 61 6d 65 3c 2f 69  b><i>filename</i
2720: 3e 3c 2f 62 3e 20 6f 66 20 74 68 65 20 44 42 46  ></b> of the DBF
2730: 20 66 69 6c 65 20 77 69 74 68 69 6e 20 74 68 65   file within the
2740: 20 5a 69 70 66 69 6c 65 20 28 69 6e 63 6c 75 64   Zipfile (includ
2750: 69 6e 67 20 69 74 73 20 20 3c 62 3e 2e 64 62 66  ing its  <b>.dbf
2760: 3c 2f 62 3e 20 73 75 66 66 69 78 29 2e 3c 2f 6c  </b> suffix).</l
2770: 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e 61 6d 65  i>..<li>the name
2780: 20 6f 66 20 74 68 65 20 54 61 62 6c 65 20 74 6f   of the Table to
2790: 20 62 65 20 63 72 65 61 74 65 64 20 61 6e 64 20   be created and 
27a0: 74 68 65 6e 20 70 6f 70 75 6c 61 74 65 64 20 62  then populated b
27b0: 79 20 69 6d 70 6f 72 74 69 6e 67 20 74 68 65 20  y importing the 
27c0: 77 68 6f 6c 65 20 44 42 46 20 66 69 6c 65 2e 3c  whole DBF file.<
27d0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e 61  /li>..<li>the na
27e0: 6d 65 20 6f 66 20 74 68 65 20 63 68 61 72 73 65  me of the charse
27f0: 74 20 65 6e 63 6f 64 69 6e 67 20 61 64 6f 70 74  t encoding adopt
2800: 65 64 20 62 79 20 74 68 65 20 44 42 46 20 66 69  ed by the DBF fi
2810: 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d  le.</li>..</ul>.
2820: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c  .<verbatim>..SEL
2830: 45 43 54 20 49 6d 70 6f 72 74 5a 69 70 44 42 46  ECT ImportZipDBF
2840: 20 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 75   ( 'c:/users/afu
2850: 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d  ri/Downloads/Lim
2860: 69 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70 27  iti01012020.zip'
2870: 20 2c 20 0d 0a 20 20 20 20 20 20 20 20 20 20 20   , ..           
2880: 20 20 20 20 20 20 20 20 20 20 20 27 4c 69 6d 69             'Limi
2890: 74 69 30 31 30 31 32 30 32 30 2f 52 65 67 30 31  ti01012020/Reg01
28a0: 30 31 32 30 32 30 2f 52 65 67 30 31 30 31 32 30  012020/Reg010120
28b0: 32 30 5f 57 47 53 38 34 2e 64 62 66 27 20 2c 20  20_WGS84.dbf' , 
28c0: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ..              
28d0: 20 20 20 20 20 20 20 20 27 72 65 67 69 6f 6e 69          'regioni
28e0: 5f 64 62 66 27 2c 20 27 55 54 46 2d 38 27 20 2c  _dbf', 'UTF-8' ,
28f0: 20 27 63 6f 64 5f 72 65 67 27 20 2c 20 31 20 2c   'cod_reg' , 1 ,
2900: 20 27 4c 4f 57 45 52 27 20 29 20 0d 0a 2d 2d 2d   'LOWER' ) ..---
2910: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 32 30 0d 0a  ----------..20..
2920: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 49 6e 20  </verbatim>..In 
2930: 69 74 73 20 63 6f 6d 70 6c 65 74 65 20 66 6f 72  its complete for
2940: 6d 20 3c 62 3e 49 6d 70 6f 72 74 5a 69 70 44 42  m <b>ImportZipDB
2950: 46 28 29 3c 2f 62 3e 20 73 75 70 70 6f 72 74 73  F()</b> supports
2960: 20 74 68 65 73 65 20 66 75 72 74 68 65 72 20 6f   these further o
2970: 70 74 69 6f 6e 61 6c 20 61 72 67 75 6d 65 6e 74  ptional argument
2980: 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68  s:..<ul>..<li>th
2990: 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 44 42  e name of the DB
29a0: 46 20 63 6f 6c 75 6d 6e 20 74 6f 20 62 65 20 61  F column to be a
29b0: 73 73 75 6d 65 64 20 61 73 20 74 68 65 20 50 72  ssumed as the Pr
29c0: 69 6d 61 72 79 20 4b 65 79 3c 2f 6c 69 3e 0d 0a  imary Key</li>..
29d0: 3c 6c 69 3e 61 20 3c 69 3e 62 6f 6f 6c 65 61 6e  <li>a <i>boolean
29e0: 3c 2f 69 3e 20 66 6c 61 67 20 72 65 71 75 65 73  </i> flag reques
29f0: 74 69 6e 67 20 66 6f 72 20 69 6d 70 6f 72 74 69  ting for importi
2a00: 6e 67 20 61 6c 6c 20 64 61 74 65 20 76 61 6c 75  ng all date valu
2a10: 65 73 20 61 73 20 70 6c 61 69 6e 20 74 65 78 74  es as plain text
2a20: 20 28 69 6e 73 74 65 61 64 20 6f 66 20 61 73 20   (instead of as 
2a30: 4a 75 6c 69 61 6e 20 44 61 74 65 73 29 3c 2f 6c  Julian Dates)</l
2a40: 69 3e 0d 0a 3c 6c 69 3e 61 20 74 65 78 74 20 73  i>..<li>a text s
2a50: 74 72 69 6e 67 20 73 75 63 68 20 61 73 20 3c 62  tring such as <b
2a60: 3e 4c 4f 57 45 52 3c 2f 62 3e 2c 20 3c 62 3e 55  >LOWER</b>, <b>U
2a70: 50 50 45 52 3c 2f 62 3e 20 6f 72 20 3c 62 3e 53  PPER</b> or <b>S
2a80: 41 4d 45 3c 2f 62 3e 20 73 70 65 63 69 66 79 69  AME</b> specifyi
2a90: 6e 67 20 69 66 20 61 6c 6c 20 63 6f 6c 75 6d 6e  ng if all column
2aa0: 20 6e 61 6d 65 73 20 73 68 6f 75 6c 64 20 62 65   names should be
2ab0: 20 72 65 73 70 65 63 74 69 76 65 6c 79 20 4c 6f   respectively Lo
2ac0: 77 65 72 63 61 73 65 20 6f 72 20 55 70 70 65 72  wercase or Upper
2ad0: 63 61 73 65 20 6f 72 20 61 73 20 69 73 2e 3c 2f  case or as is.</
2ae0: 6c 69 3e 20 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72  li> ..</ul>..<br
2af0: 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 47 55 49  >..<hr>..<h3>GUI
2b00: 20 73 75 70 70 6f 72 74 20 66 6f 72 20 69 6d 70   support for imp
2b10: 6f 72 74 69 6e 67 20 53 48 50 20 61 6e 64 20 44  orting SHP and D
2b20: 42 46 20 64 61 74 61 73 65 74 73 20 64 69 72 65  BF datasets dire
2b30: 63 74 6c 79 20 66 72 6f 6d 20 61 20 5a 69 70 66  ctly from a Zipf
2b40: 69 6c 65 3c 2f 68 33 3e 0d 0a 3c 74 61 62 6c 65  ile</h3>..<table
2b50: 20 77 69 64 74 68 3d 22 31 30 30 25 22 20 63 65   width="100%" ce
2b60: 6c 6c 70 61 64 64 69 6e 67 3d 22 31 32 22 20 63  llpadding="12" c
2b70: 65 6c 6c 73 70 61 63 69 6e 67 3d 22 38 22 3e 0d  ellspacing="8">.
2b80: 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 6f 6c 3e 0d  .<tr><td>..<ol>.
2b90: 0a 3c 6c 69 3e 55 73 69 6e 67 20 74 68 65 20 73  .<li>Using the s
2ba0: 74 61 6e 64 61 72 64 20 66 69 6c 65 20 73 65 6c  tandard file sel
2bb0: 65 63 74 69 6f 6e 20 64 69 61 6c 6f 67 20 62 6f  ection dialog bo
2bc0: 78 20 79 6f 75 20 73 69 6d 70 6c 79 20 68 61 76  x you simply hav
2bd0: 65 20 74 6f 20 73 65 6c 65 63 74 20 74 68 65 20  e to select the 
2be0: 69 6e 74 65 6e 64 65 64 20 5a 69 70 66 69 6c 65  intended Zipfile
2bf0: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 69 73  .</li>..<li>This
2c00: 20 5a 69 70 66 69 6c 65 20 77 69 6c 6c 20 62 65   Zipfile will be
2c10: 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 73   automatically s
2c20: 63 61 6e 6e 65 64 20 73 6f 20 74 6f 20 69 64 65  canned so to ide
2c30: 6e 74 69 66 79 20 61 6c 6c 20 53 68 61 70 65 66  ntify all Shapef
2c40: 69 6c 65 73 20 28 6f 72 20 72 65 73 70 65 63 74  iles (or respect
2c50: 69 76 65 6c 79 20 44 42 46 20 66 69 6c 65 73 29  ively DBF files)
2c60: 20 69 74 20 63 6f 6e 74 61 69 6e 73 3a 3c 2f 6c   it contains:</l
2c70: 69 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 49 66  i>..<ul>..<li>If
2c80: 20 74 68 65 20 5a 69 70 66 69 6c 65 20 64 6f 65   the Zipfile doe
2c90: 73 20 6e 6f 74 20 63 6f 6e 74 61 69 6e 20 61 6e  s not contain an
2ca0: 79 20 53 68 61 70 65 66 69 6c 65 20 28 6f 72 20  y Shapefile (or 
2cb0: 44 42 46 20 66 69 6c 65 29 20 61 6e 20 65 72 72  DBF file) an err
2cc0: 6f 72 20 6d 65 73 73 61 67 65 20 77 69 6c 6c 20  or message will 
2cd0: 62 65 20 73 68 6f 77 6e 20 61 6e 64 20 74 68 65  be shown and the
2ce0: 20 77 68 6f 6c 65 20 69 6d 70 6f 72 74 20 6f 70   whole import op
2cf0: 65 72 61 74 69 6f 6e 20 77 69 6c 6c 20 66 61 69  eration will fai
2d00: 69 6c 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 4f 74  il.</li>..<li>Ot
2d10: 68 65 72 77 69 73 65 20 74 68 65 20 64 69 61 6c  herwise the dial
2d20: 6f 67 20 62 6f 78 20 73 68 6f 77 6e 20 6f 6e 20  og box shown on 
2d30: 74 68 65 20 73 69 64 65 20 66 69 67 75 72 65 20  the side figure 
2d40: 77 69 6c 6c 20 62 65 20 73 68 6f 77 6e 2e 3c 62  will be shown.<b
2d50: 72 3e 0d 0a 53 65 6c 65 63 74 20 6f 6e 65 20 6f  r>..Select one o
2d60: 66 20 74 68 65 20 53 68 61 70 65 66 69 6c 65 73  f the Shapefiles
2d70: 20 28 6f 66 20 44 42 46 20 66 69 6c 65 3d 20 66   (of DBF file= f
2d80: 72 6f 6d 20 74 68 65 20 6c 69 73 74 20 61 6e 20  rom the list an 
2d90: 74 68 65 6e 20 63 6f 6e 66 69 72 6d 2e 3c 2f 6c  then confirm.</l
2da0: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a  i>..</ul></li>..
2db0: 3c 2f 6f 6c 3e 3c 2f 74 64 3e 0d 0a 3c 74 64 20  </ol></td>..<td 
2dc0: 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 3c  align="center"><
2dd0: 69 6d 67 20 73 72 63 3d 22 68 74 74 70 73 3a 2f  img src="https:/
2de0: 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74  /www.gaia-gis.it
2df0: 2f 67 61 69 61 2d 73 69 6e 73 2f 67 75 69 32 2d  /gaia-sins/gui2-
2e00: 70 69 63 73 2f 7a 69 70 2d 73 68 70 2d 31 2e 70  pics/zip-shp-1.p
2e10: 6e 67 22 20 61 6c 74 3d 22 47 55 49 5f 31 22 3e  ng" alt="GUI_1">
2e20: 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72 3e  </td></tr>..<tr>
2e30: 3c 74 64 3e 41 20 73 6c 69 67 68 74 6c 79 20 6d  <td>A slightly m
2e40: 6f 64 69 66 69 65 64 20 76 65 72 73 69 6f 6e 20  odified version 
2e50: 6f 66 20 74 68 65 20 64 69 61 6c 6f 67 20 62 6f  of the dialog bo
2e60: 78 20 61 6c 6c 6f 77 69 6e 67 20 74 6f 20 73 65  x allowing to se
2e70: 74 20 61 6c 6c 20 69 6d 70 6f 72 74 20 6f 70 74  t all import opt
2e80: 69 6f 6e 73 20 77 69 6c 6c 20 61 70 70 65 61 72  ions will appear
2e90: 2e 3c 62 72 3e 0d 0a 53 65 74 20 61 6e 79 20 61  .<br>..Set any a
2ea0: 70 70 72 6f 70 72 69 61 74 65 20 6f 70 74 69 6f  ppropriate optio
2eb0: 6e 20 61 6e 64 20 74 68 65 6e 20 63 6f 6e 74 69  n and then conti
2ec0: 6e 75 65 20 61 73 20 75 73 75 61 6c 2e 0d 0a 3c  nue as usual...<
2ed0: 62 72 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62 6c  br>..<br>..<tabl
2ee0: 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 66 66 66  e bgcolor="#ffff
2ef0: 64 30 22 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d  d0" cellspacing=
2f00: 22 31 32 22 20 63 65 6c 6c 70 61 64 64 69 6e 67  "12" cellpadding
2f10: 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e 0d  ="8">..<tr><td>.
2f20: 0a 49 66 20 79 6f 75 20 77 69 73 68 20 74 6f 20  .If you wish to 
2f30: 69 6d 70 6f 72 74 20 6d 6f 72 65 20 74 68 61 6e  import more than
2f40: 20 61 20 73 69 6e 67 6c 65 20 53 68 61 70 65 66   a single Shapef
2f50: 69 6c 65 20 28 6f 64 20 44 42 46 20 66 69 6c 65  ile (od DBF file
2f60: 29 20 66 72 6f 6d 20 74 68 65 20 73 61 6d 65 20  ) from the same 
2f70: 5a 69 70 66 69 6c 65 20 79 6f 75 20 6d 75 73 74  Zipfile you must
2f80: 20 72 65 61 70 65 74 65 20 74 68 65 20 73 61 6d   reapete the sam
2f90: 65 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20  e procedure for 
2fa0: 65 61 63 68 20 64 61 74 61 73 65 74 2e 3c 62 72  each dataset.<br
2fb0: 3e 3c 62 72 3e 3c 62 72 3e 0d 0a 53 65 6c 65 63  ><br><br>..Selec
2fc0: 74 69 6e 67 20 6d 75 6c 74 69 70 6c 65 20 64 61  ting multiple da
2fd0: 74 61 73 65 73 74 20 69 6e 20 61 20 73 69 6e 67  tasest in a sing
2fe0: 6c 65 20 70 61 73 73 20 69 73 20 6e 6f 74 20 61  le pass is not a
2ff0: 6c 6c 6f 77 65 64 2e 0d 0a 3c 2f 74 64 3e 3c 2f  llowed...</td></
3000: 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 3c 2f 74  tr>..</table></t
3010: 64 3e 0d 0a 3c 74 64 20 61 6c 69 67 6e 3d 22 63  d>..<td align="c
3020: 65 6e 74 65 72 22 3e 3c 69 6d 67 20 73 72 63 3d  enter"><img src=
3030: 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69  "https://www.gai
3040: 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d 73 69  a-gis.it/gaia-si
3050: 6e 73 2f 67 75 69 32 2d 70 69 63 73 2f 7a 69 70  ns/gui2-pics/zip
3060: 2d 73 68 70 2d 32 2e 70 6e 67 22 20 61 6c 74 3d  -shp-2.png" alt=
3070: 22 47 55 49 5f 32 22 3e 3c 2f 74 64 3e 3c 2f 74  "GUI_2"></td></t
3080: 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62  r>..</table>..<b
3090: 72 3e 3c 68 72 3e 3c 62 72 3e 0d 0a 42 61 63 6b  r><hr><br>..Back
30a0: 20 74 6f 20 3c 61 20 68 72 65 66 3d 22 68 74 74   to <a href="htt
30b0: 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69  ps://www.gaia-gi
30c0: 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73  s.it/fossil/libs
30d0: 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e  patialite/wiki?n
30e0: 61 6d 65 3d 35 2e 30 2e 30 2d 64 6f 63 22 3e 35  ame=5.0.0-doc">5
30f0: 2e 30 2e 30 2d 64 6f 63 20 6d 61 69 6e 20 70 61  .0.0-doc main pa
3100: 67 65 3c 2f 61 3e 0a 5a 20 34 30 31 36 30 64 61  ge</a>.Z 40160da
3110: 32 34 30 64 33 37 33 33 39 65 62 35 63 65 64 66  240d37339eb5cedf
3120: 35 37 61 64 39 61 38 32 63 0a                    57ad9a82c.