Hex Artifact Content
Not logged in

Artifact 3da774363fc236b7060d15c330f90b976386bf5b:

Wiki page [ZippedSHP] by sandro 2020-05-10 18:03:27.
0000: 44 20 32 30 32 30 2d 30 35 2d 31 30 54 31 38 3a  D 2020-05-10T18:
0010: 30 33 3a 32 37 2e 31 34 31 0a 4c 20 5a 69 70 70  03:27.141.L Zipp
0020: 65 64 53 48 50 0a 50 20 30 30 65 33 39 35 38 62  edSHP.P 00e3958b
0030: 63 34 61 33 63 66 31 37 66 30 35 61 36 62 64 62  c4a3cf17f05a6bdb
0040: 33 31 39 62 39 32 61 33 66 61 65 34 33 66 37 38  319b92a3fae43f78
0050: 0a 55 20 73 61 6e 64 72 6f 0a 57 20 31 32 34 35  .U sandro.W 1245
0060: 34 0a 42 61 63 6b 20 74 6f 20 3c 61 20 68 72 65  4.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 6d 61 69 6e 20 53 70 61 74 69 61  doc">main Spatia
00c0: 4c 69 74 65 20 70 61 67 65 3c 2f 61 3e 0d 0a 3c  Lite page</a>..<
00d0: 68 32 3e 52 65 61 64 69 6e 67 20 53 48 50 20 61  h2>Reading SHP a
00e0: 6e 64 20 44 42 46 20 66 69 6c 65 73 20 64 69 72  nd DBF files dir
00f0: 65 63 74 6c 79 20 66 72 6f 6d 20 77 69 74 68 69  ectly from withi
0100: 6e 20 61 20 5a 69 70 66 69 6c 65 3c 2f 68 32 3e  n a Zipfile</h2>
0110: 0d 0a 53 74 61 72 74 69 6e 67 20 73 69 6e 63 65  ..Starting since
0120: 20 76 65 72 73 69 6f 6e 20 3c 62 3e 35 2e 30 2e   version <b>5.0.
0130: 30 3c 2f 62 3e 20 53 70 61 74 69 61 4c 69 74 65  0</b> SpatiaLite
0140: 20 68 61 73 20 74 68 65 20 63 61 70 61 62 69 6c   has the capabil
0150: 69 74 79 20 74 6f 20 64 69 72 65 63 74 6c 79 20  ity to directly 
0160: 72 65 61 64 20 61 6e 79 20 3c 62 3e 53 68 61 70  read any <b>Shap
0170: 65 66 69 6c 65 3c 2f 62 3e 20 28 6f 72 20 3c 62  efile</b> (or <b
0180: 3e 44 42 46 3c 2f 62 3e 20 66 69 6c 65 29 20 63  >DBF</b> file) c
0190: 6f 6e 74 61 69 6e 65 64 20 77 69 74 68 69 6e 20  ontained within 
01a0: 61 20 63 6f 6d 70 72 65 73 73 65 64 20 3c 62 3e  a compressed <b>
01b0: 5a 69 70 66 69 6c 65 3c 2f 62 3e 2e 3c 62 72 3e  Zipfile</b>.<br>
01c0: 0d 0a 53 65 76 65 72 61 6c 20 63 6c 6f 73 65 6c  ..Several closel
01d0: 79 20 72 65 6c 61 74 65 64 20 53 51 4c 20 66 75  y related SQL fu
01e0: 6e 63 74 69 6f 6e 73 20 68 61 76 65 20 62 65 65  nctions have bee
01f0: 6e 20 69 6e 74 72 6f 64 75 63 65 64 20 61 73 20  n introduced as 
0200: 77 65 6c 6c 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 3c  well.<br><br>..<
0210: 74 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23  table bgcolor="#
0220: 66 66 66 66 64 30 22 20 63 65 6c 6c 73 70 61 63  ffffd0" cellspac
0230: 69 6e 67 3d 22 31 32 22 20 63 65 6c 6c 70 61 64  ing="12" cellpad
0240: 64 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c  ding="8">..<tr><
0250: 74 64 3e 0d 0a 3c 62 3e 50 6c 65 61 73 65 20 6e  td>..<b>Please n
0260: 6f 74 65 3c 2f 62 3e 3a 20 61 6c 6c 20 74 68 65  ote</b>: all the
0270: 20 66 6f 6c 6c 6f 77 69 6e 67 20 53 51 4c 20 66   following SQL f
0280: 75 6e 63 74 69 6f 6e 73 20 77 69 6c 6c 20 61 63  unctions will ac
0290: 63 65 73 73 20 61 20 5a 69 70 66 69 6c 65 20 66  cess a Zipfile f
02a0: 72 6f 6d 20 74 68 65 20 6c 6f 63 61 6c 20 66 69  rom the local fi
02b0: 6c 65 2d 73 79 73 74 65 6d 2c 20 61 6e 64 20 77  le-system, and w
02c0: 69 6c 6c 20 63 6f 6e 73 65 71 75 65 6e 74 6c 79  ill consequently
02d0: 20 70 6f 73 65 20 73 65 63 75 72 69 74 79 20 63   pose security c
02e0: 6f 6e 63 65 72 6e 73 2e 3c 62 72 3e 3c 62 72 3e  oncerns.<br><br>
02f0: 0d 0a 41 6c 6c 20 74 68 65 6d 20 77 69 6c 6c 20  ..All them will 
0300: 62 65 20 65 66 66 65 63 74 69 76 65 6c 79 20 61  be effectively a
0310: 76 61 69 6c 61 62 6c 65 20 6f 6e 6c 79 20 69 66  vailable only if
0320: 20 74 68 65 20 65 78 74 65 72 6e 61 6c 20 76 61   the external va
0330: 72 69 61 62 6c 65 20 3c 62 3e 53 50 41 54 49 41  riable <b>SPATIA
0340: 4c 49 54 45 5f 53 45 43 55 52 49 54 59 3d 72 65  LITE_SECURITY=re
0350: 6c 61 78 65 64 3c 2f 62 3e 20 68 61 73 20 62 65  laxed</b> has be
0360: 65 6e 20 73 65 74 2e 0d 0a 3c 2f 74 64 3e 3c 2f  en set...</td></
0370: 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c  tr>..</table>..<
0380: 68 33 3e 41 63 63 65 73 73 69 6e 67 20 61 20 5a  h3>Accessing a Z
0390: 69 70 70 65 64 20 53 48 50 3c 2f 68 33 3e 0d 0a  ipped SHP</h3>..
03a0: 41 6c 6c 20 74 68 65 73 65 20 6e 65 77 20 53 51  All these new SQ
03b0: 4c 20 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 20  L functions are 
03c0: 6e 6f 77 20 73 75 70 70 6f 72 74 65 64 3a 0d 0a  now supported:..
03d0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 49 6d 70  <ul>..<li><b>Imp
03e0: 6f 72 74 5a 69 70 53 48 50 28 29 3c 2f 62 3e 3a  ortZipSHP()</b>:
03f0: 20 74 68 65 20 6d 61 69 6e 20 66 75 6e 63 74 69   the main functi
0400: 6f 6e 20 61 6c 6c 6f 77 69 6e 67 20 74 6f 20 69  on allowing to i
0410: 6d 70 6f 72 74 20 61 20 77 68 6f 6c 65 20 53 68  mport a whole Sh
0420: 61 70 65 66 69 6c 65 20 69 6e 74 6f 20 61 20 6e  apefile into a n
0430: 65 77 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65  ew Spatial Table
0440: 20 69 6e 74 6f 20 74 68 65 20 63 75 72 72 65 6e   into the curren
0450: 74 6c 79 20 63 6f 6e 6e 65 63 74 65 64 20 44 61  tly connected Da
0460: 74 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  tabase.</li>..<l
0470: 69 3e 3c 62 3e 50 52 4f 4a 5f 47 75 65 73 73 53  i><b>PROJ_GuessS
0480: 72 69 64 46 72 6f 6d 5a 69 70 53 48 50 28 29 3c  ridFromZipSHP()<
0490: 2f 62 3e 3a 20 61 20 68 65 6c 70 65 72 20 66 75  /b>: a helper fu
04a0: 6e 63 74 69 6f 6e 20 66 6f 72 20 61 74 74 65 6d  nction for attem
04b0: 70 74 69 6e 67 20 74 6f 20 67 75 65 73 73 20 74  pting to guess t
04c0: 68 65 20 53 52 49 44 20 66 6f 72 20 61 20 67 69  he SRID for a gi
04d0: 76 65 6e 20 7a 69 70 70 65 64 20 53 48 50 2e 3c  ven zipped SHP.<
04e0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 5a 69 70  /li>..<li><b>Zip
04f0: 66 69 6c 65 5f 4e 75 6d 53 48 50 28 29 3c 2f 62  file_NumSHP()</b
0500: 3e 3a 20 61 20 68 65 6c 70 65 72 20 66 75 6e 63  >: a helper func
0510: 74 69 6f 6e 20 72 65 74 75 72 6e 69 6e 67 20 74  tion returning t
0520: 68 65 20 74 6f 74 61 6c 20 63 6f 75 6e 74 20 6f  he total count o
0530: 66 20 53 68 61 70 65 66 69 6c 65 73 20 63 6f 6e  f Shapefiles con
0540: 74 61 69 6e 65 64 20 77 69 74 68 69 6e 20 61 20  tained within a 
0550: 67 69 76 65 6e 20 5a 69 70 66 69 6c 65 2e 3c 2f  given Zipfile.</
0560: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 5a 69 70 66  li>..<li><b>Zipf
0570: 69 6c 65 5f 53 68 70 4e 28 29 3c 2f 62 3e 3a 20  ile_ShpN()</b>: 
0580: 61 20 68 65 6c 70 65 72 20 66 75 6e 63 74 69 6f  a helper functio
0590: 6e 20 72 65 74 75 72 6e 69 6e 67 20 74 68 65 20  n returning the 
05a0: 3c 62 3e 3c 69 3e 62 61 73 65 6e 61 6d 65 3c 2f  <b><i>basename</
05b0: 69 3e 3c 2f 62 3e 20 66 6f 72 20 74 68 65 20 3c  i></b> for the <
05c0: 62 3e 4e 74 68 3c 2f 62 3e 20 53 68 61 70 65 66  b>Nth</b> Shapef
05d0: 69 6c 65 20 63 6f 6e 74 61 69 6e 65 64 20 77 69  ile contained wi
05e0: 74 68 69 6e 20 61 20 67 69 76 65 6e 20 5a 69 70  thin a given Zip
05f0: 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c  file.</li>..</ul
0600: 3e 0d 0a 3c 62 72 3e 0d 0a 57 65 27 6c 6c 20 6e  >..<br>..We'll n
0610: 6f 77 20 73 74 61 72 74 20 61 20 71 75 69 63 6b  ow start a quick
0620: 20 74 75 74 6f 72 69 61 6c 20 61 62 6f 75 74 20   tutorial about 
0630: 75 73 69 6e 67 20 61 6c 6c 20 74 68 65 73 65 20  using all these 
0640: 6e 65 77 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e  new SQL function
0650: 73 2e 0d 0a 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a  s...<b>Note</b>:
0660: 20 74 68 65 20 74 75 74 6f 72 69 61 6c 20 69 73   the tutorial is
0670: 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 64 61   based on the da
0680: 74 61 73 65 74 20 79 6f 75 20 63 61 6e 20 64 6f  taset you can do
0690: 77 6e 6c 6f 61 64 20 66 72 6f 6d 20 3c 61 20 68  wnload from <a h
06a0: 72 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e  ref="http://www.
06b0: 69 73 74 61 74 2e 69 74 2f 73 74 6f 72 61 67 65  istat.it/storage
06c0: 2f 63 61 72 74 6f 67 72 61 66 69 61 2f 63 6f 6e  /cartografia/con
06d0: 66 69 6e 69 5f 61 6d 6d 69 6e 69 73 74 72 61 74  fini_amministrat
06e0: 69 76 69 2f 6e 6f 6e 5f 67 65 6e 65 72 61 6c 69  ivi/non_generali
06f0: 7a 7a 61 74 69 2f 4c 69 6d 69 74 69 30 31 30 31  zzati/Limiti0101
0700: 32 30 32 30 2e 7a 69 70 22 3e 68 65 72 65 3c 2f  2020.zip">here</
0710: 61 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a  a>..<verbatim>..
0720: 53 45 4c 45 43 54 20 5a 69 70 66 69 6c 65 5f 4e  SELECT Zipfile_N
0730: 75 6d 53 48 50 20 28 20 27 63 3a 2f 75 73 65 72  umSHP ( 'c:/user
0740: 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64  s/afuri/Download
0750: 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30  s/Limiti01012020
0760: 2e 7a 69 70 27 20 29 0d 0a 2d 2d 2d 2d 2d 2d 2d  .zip' )..-------
0770: 2d 2d 2d 2d 2d 0d 0a 34 0d 0a 3c 2f 76 65 72 62  -----..4..</verb
0780: 61 74 69 6d 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69  atim>..<ul>..<li
0790: 3e 74 68 65 20 53 51 4c 20 66 75 6e 63 74 69 6f  >the SQL functio
07a0: 6e 20 3c 62 3e 5a 69 70 66 69 6c 65 5f 4e 75 6d  n <b>Zipfile_Num
07b0: 53 48 50 28 29 3c 2f 62 3e 20 77 69 6c 6c 20 69  SHP()</b> will i
07c0: 6e 73 70 65 63 74 20 61 20 5a 69 70 66 69 6c 65  nspect a Zipfile
07d0: 20 74 68 65 6e 20 72 65 74 75 72 6e 69 6e 67 20   then returning 
07e0: 74 68 65 20 74 6f 74 61 6c 20 63 6f 75 6e 74 20  the total count 
07f0: 6f 66 20 53 68 61 70 65 66 69 6c 65 73 20 69 74  of Shapefiles it
0800: 20 63 6f 6e 74 61 69 6e 73 2e 3c 2f 6c 69 3e 0d   contains.</li>.
0810: 0a 3c 6c 69 3e 69 74 20 72 65 71 75 69 72 65 73  .<li>it requires
0820: 20 6a 75 73 74 20 61 20 73 69 6e 67 6c 65 20 61   just a single a
0830: 72 67 75 6d 65 6e 74 3a 20 74 68 65 20 61 62 73  rgument: the abs
0840: 6f 6c 75 74 65 20 6f 72 20 72 65 6c 61 74 69 76  olute or relativ
0850: 65 20 70 61 74 68 20 6c 65 61 64 69 6e 67 20 74  e path leading t
0860: 6f 20 74 68 65 20 5a 69 70 66 69 6c 65 2e 3c 2f  o the Zipfile.</
0870: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4e 6f 74 65  li>..<li><b>Note
0880: 3c 2f 62 3e 20 69 74 20 77 69 6c 6c 20 72 65 74  </b> it will ret
0890: 75 72 6e 20 3c 62 3e 30 3c 2f 62 3e 20 69 66 20  urn <b>0</b> if 
08a0: 74 68 65 20 5a 69 70 66 69 6c 65 20 64 6f 65 73  the Zipfile does
08b0: 20 6e 6f 74 20 63 6f 6e 74 61 69 6e 20 61 6e 79   not contain any
08c0: 20 53 68 61 70 65 66 69 6c 65 2e 0d 0a 3c 75 6c   Shapefile...<ul
08d0: 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4e 55 4c 4c 3c 2f  >..<li><b>NULL</
08e0: 62 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75 72  b> will be retur
08f0: 6e 65 64 20 69 66 20 74 68 65 20 5a 69 70 66 69  ned if the Zipfi
0900: 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69 73  le does not exis
0910: 74 20 6f 66 20 69 66 20 69 74 27 73 20 63 6f 72  t of if it's cor
0920: 72 75 70 74 65 64 20 6f 72 20 69 6e 76 61 6c 69  rupted or invali
0930: 64 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f  d.</li>..</ul></
0940: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65 72  li>..</ul>..<ver
0950: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 5a  batim>..SELECT Z
0960: 69 70 66 69 6c 65 5f 73 68 70 4e 20 28 20 27 63  ipfile_shpN ( 'c
0970: 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f  :/users/afuri/Do
0980: 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31  wnloads/Limiti01
0990: 30 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 31 20  012020.zip' , 1 
09a0: 29 0d 0a 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74  )..------..Limit
09b0: 69 30 31 30 31 32 30 32 30 2f 43 6f 6d 30 31 30  i01012020/Com010
09c0: 31 32 30 32 30 2f 43 6f 6d 30 31 30 31 32 30 32  12020/Com0101202
09d0: 30 5f 57 47 53 38 34 0d 0a 0d 0a 53 45 4c 45 43  0_WGS84....SELEC
09e0: 54 20 5a 69 70 66 69 6c 65 5f 73 68 70 4e 20 28  T Zipfile_shpN (
09f0: 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72 69   'c:/users/afuri
0a00: 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74  /Downloads/Limit
0a10: 69 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20 2c  i01012020.zip' ,
0a20: 20 32 20 29 0d 0a 2d 2d 2d 2d 2d 2d 0d 0a 4c 69   2 )..------..Li
0a30: 6d 69 74 69 30 31 30 31 32 30 32 30 2f 50 72 6f  miti01012020/Pro
0a40: 76 43 4d 30 31 30 31 32 30 32 30 2f 50 72 6f 76  vCM01012020/Prov
0a50: 43 4d 30 31 30 31 32 30 32 30 5f 57 47 53 38 34  CM01012020_WGS84
0a60: 0d 0a 0d 0a 53 45 4c 45 43 54 20 5a 69 70 66 69  ....SELECT Zipfi
0a70: 6c 65 5f 73 68 70 4e 20 28 20 27 63 3a 2f 75 73  le_shpN ( 'c:/us
0a80: 65 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f  ers/afuri/Downlo
0a90: 61 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30  ads/Limiti010120
0aa0: 32 30 2e 7a 69 70 27 20 2c 20 33 20 29 0d 0a 2d  20.zip' , 3 )..-
0ab0: 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74 69 30 31 30  -----..Limiti010
0ac0: 31 32 30 32 30 2f 52 65 67 30 31 30 31 32 30 32  12020/Reg0101202
0ad0: 30 2f 52 65 67 30 31 30 31 32 30 32 30 5f 57 47  0/Reg01012020_WG
0ae0: 53 38 34 0d 0a 0d 0a 53 45 4c 45 43 54 20 5a 69  S84....SELECT Zi
0af0: 70 66 69 6c 65 5f 73 68 70 4e 20 28 20 27 63 3a  pfile_shpN ( 'c:
0b00: 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f 77  /users/afuri/Dow
0b10: 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31 30  nloads/Limiti010
0b20: 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 34 20 29  12020.zip' , 4 )
0b30: 0d 0a 2d 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74  ..-------..Limit
0b40: 69 30 31 30 31 32 30 32 30 2f 52 69 70 47 65 6f  i01012020/RipGeo
0b50: 30 31 30 31 32 30 32 30 2f 52 69 70 47 65 6f 30  01012020/RipGeo0
0b60: 31 30 31 32 30 32 30 5f 57 47 53 38 34 0d 0a 3c  1012020_WGS84..<
0b70: 2f 76 65 72 62 61 74 69 6d 3e 3c 75 6c 3e 0d 0a  /verbatim><ul>..
0b80: 3c 6c 69 3e 74 68 65 20 53 51 4c 20 66 75 6e 63  <li>the SQL func
0b90: 74 69 6f 6e 20 3c 62 3e 5a 69 70 66 69 6c 65 5f  tion <b>Zipfile_
0ba0: 53 68 70 4e 28 29 3c 2f 62 3e 20 77 69 6c 6c 20  ShpN()</b> will 
0bb0: 69 6e 73 70 65 63 74 20 61 20 5a 69 70 66 69 6c  inspect a Zipfil
0bc0: 65 20 74 68 65 6e 20 72 65 74 75 72 6e 69 6e 67  e then returning
0bd0: 20 74 68 65 20 3c 62 3e 3c 69 3e 62 61 73 65 6e   the <b><i>basen
0be0: 61 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 6f 66 20 74  ame</i></b> of t
0bf0: 68 65 20 3c 62 3e 4e 74 68 3c 2f 62 3e 20 53 68  he <b>Nth</b> Sh
0c00: 61 70 65 66 69 6c 65 20 69 74 20 63 6f 6e 74 61  apefile it conta
0c10: 69 6e 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69  ins.</li>..<li>i
0c20: 74 20 72 65 71 75 69 72 65 73 20 74 77 6f 20 61  t requires two a
0c30: 72 67 75 6d 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d  rguments:..<ul>.
0c40: 0a 3c 6c 69 3e 74 68 65 20 61 62 73 6f 6c 75 74  .<li>the absolut
0c50: 65 20 6f 72 20 72 65 6c 61 74 69 76 65 20 70 61  e or relative pa
0c60: 74 68 20 6c 65 61 64 69 6e 67 20 74 6f 20 74 68  th leading to th
0c70: 65 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d  e Zipfile.</li>.
0c80: 0a 3c 6c 69 3e 74 68 65 20 72 65 6c 61 74 69 76  .<li>the relativ
0c90: 65 20 69 6e 64 65 78 20 28 3c 62 3e 31 20 62 61  e index (<b>1 ba
0ca0: 73 65 64 3c 2f 62 3e 29 20 6f 66 20 74 68 65 20  sed</b>) of the 
0cb0: 53 68 61 70 65 66 69 6c 65 20 77 69 74 68 69 6e  Shapefile within
0cc0: 20 74 68 65 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c   the Zipfile.</l
0cd0: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a  i>..</ul></li>..
0ce0: 3c 6c 69 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 3a  <li><b>Note</b>:
0cf0: 20 3c 62 3e 4e 55 4c 4c 3c 2f 62 3e 20 77 69 6c   <b>NULL</b> wil
0d00: 6c 20 62 65 20 72 65 74 75 72 6e 65 64 20 69 66  l be returned if
0d10: 20 74 68 65 20 5a 69 70 66 69 6c 65 20 64 6f 65   the Zipfile doe
0d20: 73 20 6e 6f 74 20 65 78 69 73 74 20 6f 66 20 69  s not exist of i
0d30: 66 20 69 74 27 73 20 69 6e 76 61 6c 69 64 20 6f  f it's invalid o
0d40: 72 20 69 66 20 74 68 65 20 69 6e 64 65 78 20 76  r if the index v
0d50: 61 6c 75 65 20 69 73 20 6f 75 74 73 69 64 65 20  alue is outside 
0d60: 74 68 65 20 65 78 70 65 63 74 65 64 20 72 61 6e  the expected ran
0d70: 67 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d  ge.</li>..</ul>.
0d80: 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c  .<verbatim>..SEL
0d90: 45 43 54 20 50 52 4f 4a 5f 47 75 65 73 73 53 72  ECT PROJ_GuessSr
0da0: 69 64 46 72 6f 6d 5a 69 70 53 48 50 20 28 20 27  idFromZipSHP ( '
0db0: 63 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44  c:/users/afuri/D
0dc0: 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30  ownloads/Limiti0
0dd0: 31 30 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 27  1012020.zip' , '
0de0: 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2f 43  Limiti01012020/C
0df0: 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f 6d 30 31  om01012020/Com01
0e00: 30 31 32 30 32 30 5f 57 47 53 38 34 27 20 29 0d  012020_WGS84' ).
0e10: 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 33  .------------..3
0e20: 32 36 33 32 0d 0a 3c 2f 76 65 72 62 61 74 69 6d  2632..</verbatim
0e30: 3e 0d 0a 3c 6c 69 3e 74 68 65 20 53 51 4c 20 66  >..<li>the SQL f
0e40: 75 6e 63 74 69 6f 6e 20 3c 62 3e 50 52 4f 4a 5f  unction <b>PROJ_
0e50: 47 75 65 73 73 53 72 69 64 46 72 6f 6d 5a 69 70  GuessSridFromZip
0e60: 53 48 50 28 29 3c 2f 62 3e 20 77 69 6c 6c 20 69  SHP()</b> will i
0e70: 6e 73 70 65 63 74 20 61 20 5a 69 70 66 69 6c 65  nspect a Zipfile
0e80: 20 74 68 65 6e 20 72 65 74 75 72 6e 69 6e 67 20   then returning 
0e90: 74 68 65 20 3c 62 3e 53 52 49 44 3c 2f 62 3e 20  the <b>SRID</b> 
0ea0: 76 61 6c 75 65 20 64 65 63 6c 61 72 65 64 20 62  value declared b
0eb0: 79 20 74 68 65 20 3c 62 3e 2e 50 52 4a 3c 2f 62  y the <b>.PRJ</b
0ec0: 3e 20 6d 65 6d 62 65 72 20 20 6f 66 20 74 68 65  > member  of the
0ed0: 20 53 68 61 70 65 66 69 6c 65 20 63 6f 6e 74 61   Shapefile conta
0ee0: 69 6e 65 64 20 69 6e 74 6f 20 74 68 65 20 5a 69  ined into the Zi
0ef0: 70 66 69 6c 65 20 61 73 20 69 64 65 6e 74 69 66  pfile as identif
0f00: 69 65 64 20 62 79 20 69 74 73 20 3c 62 3e 3c 69  ied by its <b><i
0f10: 3e 62 61 73 65 6e 61 6d 65 3c 2f 69 3e 3c 2f 62  >basename</i></b
0f20: 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 74 20  >.</li>..<li>it 
0f30: 72 65 71 75 69 72 65 73 20 74 77 6f 20 61 72 67  requires two arg
0f40: 75 6d 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c  uments:..<ul>..<
0f50: 6c 69 3e 74 68 65 20 61 62 73 6f 6c 75 74 65 20  li>the absolute 
0f60: 6f 72 20 72 65 6c 61 74 69 76 65 20 70 61 74 68  or relative path
0f70: 20 6c 65 61 64 69 6e 67 20 74 6f 20 74 68 65 20   leading to the 
0f80: 5a 69 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c  Zipfile.</li>..<
0f90: 6c 69 3e 74 68 65 20 3c 62 3e 3c 69 3e 62 61 73  li>the <b><i>bas
0fa0: 65 6e 61 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 6f 66  ename</i></b> of
0fb0: 20 74 68 65 20 53 68 61 70 65 66 69 6c 65 20 77   the Shapefile w
0fc0: 69 74 68 69 6e 20 74 68 65 20 5a 69 70 66 69 6c  ithin the Zipfil
0fd0: 65 20 28 77 69 74 68 6f 75 74 20 61 64 64 69 6e  e (without addin
0fe0: 67 20 61 6e 79 20 3c 62 3e 2e 73 68 70 3c 2f 62  g any <b>.shp</b
0ff0: 3e 2c 20 3c 62 3e 2e 73 68 78 3c 2f 62 3e 20 6f  >, <b>.shx</b> o
1000: 72 20 3c 62 3e 2e 64 62 66 3c 2f 62 3e 20 73 75  r <b>.dbf</b> su
1010: 66 66 69 78 29 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75  ffix).</li>..</u
1020: 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e  l></li>..<li><b>
1030: 4e 6f 74 65 3c 2f 62 3e 3a 20 3c 62 3e 2d 31 3c  Note</b>: <b>-1<
1040: 2f 62 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75  /b> will be retu
1050: 72 6e 65 64 20 69 66 20 74 68 65 20 53 68 61 70  rned if the Shap
1060: 65 66 69 6c 65 20 68 61 73 20 6e 6f 20 3c 62 3e  efile has no <b>
1070: 2e 50 52 4a 3c 2f 62 3e 20 6d 65 6d 62 65 72 2c  .PRJ</b> member,
1080: 20 6f 66 20 69 66 20 69 74 20 63 6f 6e 74 61 69   of if it contai
1090: 6e 73 20 61 6e 20 69 6e 76 61 6c 69 64 20 57 4b  ns an invalid WK
10a0: 54 20 64 65 66 69 6e 69 74 69 6f 6e 2e 3c 2f 6c  T definition.</l
10b0: 69 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 2f 6c 69 3e 3c  i>..<ul>..</li><
10c0: 62 3e 4e 55 4c 4c 3c 2f 62 3e 20 77 69 6c 6c 20  b>NULL</b> will 
10d0: 62 65 20 72 65 74 75 72 6e 65 64 20 6f 6e 20 69  be returned on i
10e0: 6e 76 61 6c 69 64 20 61 72 67 75 6d 65 6e 74 73  nvalid arguments
10f0: 20 6f 72 20 69 66 20 74 68 65 20 53 68 61 70 65   or if the Shape
1100: 66 69 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 78  file does not ex
1110: 69 73 74 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 6c 69 3e  ist.</li>..</li>
1120: 3c 2f 75 6c 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 74  </ul>..</ul>..<t
1130: 61 62 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66  able bgcolor="#f
1140: 66 66 66 64 30 22 20 63 65 6c 6c 73 70 61 63 69  fffd0" cellspaci
1150: 6e 67 3d 22 31 32 22 20 63 65 6c 6c 70 61 64 64  ng="12" cellpadd
1160: 69 6e 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74  ing="8">..<tr><t
1170: 64 3e 0d 0a 3c 62 3e 50 6c 65 61 73 65 20 6e 6f  d>..<b>Please no
1180: 74 65 3c 2f 62 3e 3a 20 74 68 65 20 53 51 4c 20  te</b>: the SQL 
1190: 66 75 6e 63 74 69 6f 6e 20 3c 62 3e 50 52 4f 4a  function <b>PROJ
11a0: 5f 47 75 65 73 73 53 72 69 64 46 72 6f 6d 5a 69  _GuessSridFromZi
11b0: 70 53 48 50 28 29 3c 2f 62 3e 20 77 69 6c 6c 20  pSHP()</b> will 
11c0: 62 65 20 61 76 61 69 6c 61 62 6c 65 20 6f 6e 6c  be available onl
11d0: 79 20 77 68 65 6e 20 53 70 61 74 69 61 4c 69 74  y when SpatiaLit
11e0: 65 20 69 73 20 6c 69 6e 6b 65 64 20 74 6f 20 61  e is linked to a
11f0: 20 72 65 63 65 6e 74 20 76 65 72 73 69 6f 6e 20   recent version 
1200: 6f 66 20 3c 62 3e 50 52 4f 4a 3c 2f 62 3e 20 28  of <b>PROJ</b> (
1210: 3c 62 3e 50 52 4f 4a 2e 36 2e 78 2e 78 3c 2f 62  <b>PROJ.6.x.x</b
1220: 3e 20 6f 72 20 61 6e 79 20 6c 61 74 65 72 29 2e  > or any later).
1230: 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f  ..</td></tr>..</
1240: 74 61 62 6c 65 3e 0d 0a 3c 76 65 72 62 61 74 69  table>..<verbati
1250: 6d 3e 0d 0a 53 45 4c 45 43 54 20 49 6d 70 6f 72  m>..SELECT Impor
1260: 74 5a 69 70 53 48 50 20 28 20 27 63 3a 2f 75 73  tZipSHP ( 'c:/us
1270: 65 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f  ers/afuri/Downlo
1280: 61 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30  ads/Limiti010120
1290: 32 30 2e 7a 69 70 27 20 2c 20 0d 0a 20 20 20 20  20.zip' , ..    
12a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
12b0: 20 20 27 4c 69 6d 69 74 69 30 31 30 31 32 30 32    'Limiti0101202
12c0: 30 2f 43 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f  0/Com01012020/Co
12d0: 6d 30 31 30 31 32 30 32 30 5f 57 47 53 38 34 27  m01012020_WGS84'
12e0: 20 2c 20 0d 0a 20 20 20 20 20 20 20 20 20 20 20   , ..           
12f0: 20 20 20 20 20 20 20 20 20 20 20 27 63 6f 6d 75             'comu
1300: 6e 69 27 2c 20 27 55 54 46 2d 38 27 20 29 20 0d  ni', 'UTF-8' ) .
1310: 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 37 39 30 34  .---------..7904
1320: 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 54  ..</verbatim>..T
1330: 68 65 20 3c 62 3e 49 6d 70 6f 72 74 5a 69 70 53  he <b>ImportZipS
1340: 48 50 28 29 3c 2f 62 3e 20 63 6c 6f 73 65 6c 79  HP()</b> closely
1350: 20 6d 69 6d 69 63 73 20 3c 62 3e 49 6d 70 6f 72   mimics <b>Impor
1360: 74 53 48 50 28 29 3c 2f 62 3e 2c 20 65 78 63 65  tSHP()</b>, exce
1370: 70 74 20 69 6e 20 74 68 61 74 20 69 74 20 72 65  pt in that it re
1380: 71 75 69 72 65 73 20 6f 6e 65 20 6d 6f 72 65 20  quires one more 
1390: 61 72 67 75 6d 65 6e 74 20 73 70 65 63 69 66 79  argument specify
13a0: 69 6e 67 20 74 68 65 20 70 61 74 68 6e 61 6d 65  ing the pathname
13b0: 20 6f 66 20 74 68 65 20 5a 69 70 66 69 6c 65 20   of the Zipfile 
13c0: 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 53  containing the S
13d0: 68 61 70 65 66 69 6c 65 20 74 6f 20 62 65 20 69  hapefile to be i
13e0: 6d 70 6f 72 74 65 64 2e 3c 62 72 3e 0d 0a 4f 6e  mported.<br>..On
13f0: 20 73 75 63 63 65 73 73 20 69 74 20 77 69 6c 6c   success it will
1400: 20 72 65 74 75 72 6e 20 74 68 65 20 6e 75 6d 62   return the numb
1410: 65 72 20 6f 66 20 66 65 61 74 75 72 65 73 20 69  er of features i
1420: 6e 73 65 72 74 65 64 20 69 6e 74 6f 20 74 68 65  nserted into the
1430: 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65 20 74   Spatial Table t
1440: 68 61 74 20 68 61 73 20 6a 75 73 74 20 62 65 65  hat has just bee
1450: 6e 20 63 72 65 61 74 65 64 3b 20 6f 6e 20 66 61  n created; on fa
1460: 69 6c 75 72 65 20 69 74 20 77 69 6c 6c 20 6a 75  ilure it will ju
1470: 73 74 20 72 65 74 75 72 6e 20 3c 62 3e 4e 55 4c  st return <b>NUL
1480: 4c 3c 2f 62 3e 2e 3c 62 72 3e 3c 62 72 3e 0d 0a  L</b>.<br><br>..
1490: 49 6e 20 69 74 73 20 73 69 6d 70 6c 65 73 74 20  In its simplest 
14a0: 66 6f 72 6d 20 69 74 20 72 65 71 75 69 72 65 73  form it requires
14b0: 20 6a 75 73 74 20 66 6f 75 72 20 61 72 67 75 6d   just four argum
14c0: 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69  ents:..<ul>..<li
14d0: 3e 74 68 65 20 61 62 73 6f 6c 75 74 65 20 6f 72  >the absolute or
14e0: 20 72 65 6c 61 74 69 76 65 20 70 61 74 68 20 6c   relative path l
14f0: 65 61 64 69 6e 67 20 74 6f 20 74 68 65 20 5a 69  eading to the Zi
1500: 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  pfile.</li>..<li
1510: 3e 74 68 65 20 3c 62 3e 3c 69 3e 62 61 73 65 6e  >the <b><i>basen
1520: 61 6d 65 3c 2f 69 3e 3c 2f 62 3e 20 6f 66 20 74  ame</i></b> of t
1530: 68 65 20 53 68 61 70 65 66 69 6c 65 20 77 69 74  he Shapefile wit
1540: 68 69 6e 20 74 68 65 20 5a 69 70 66 69 6c 65 20  hin the Zipfile 
1550: 28 77 69 74 68 6f 75 74 20 61 64 64 69 6e 67 20  (without adding 
1560: 61 6e 79 20 3c 62 3e 2e 73 68 70 3c 2f 62 3e 2c  any <b>.shp</b>,
1570: 20 3c 62 3e 2e 73 68 78 3c 2f 62 3e 20 6f 72 20   <b>.shx</b> or 
1580: 3c 62 3e 2e 64 62 66 3c 2f 62 3e 20 73 75 66 66  <b>.dbf</b> suff
1590: 69 78 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74  ix).</li>..<li>t
15a0: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 53  he name of the S
15b0: 70 61 74 69 61 6c 20 54 61 62 6c 65 20 74 6f 20  patial Table to 
15c0: 62 65 20 63 72 65 61 74 65 64 20 61 6e 64 20 74  be created and t
15d0: 68 65 6e 20 70 6f 70 75 6c 61 74 65 64 20 62 79  hen populated by
15e0: 20 69 6d 70 6f 72 74 69 6e 67 20 74 68 65 20 77   importing the w
15f0: 68 6f 6c 65 20 53 68 61 70 65 66 69 6c 65 2e 3c  hole Shapefile.<
1600: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e 61  /li>..<li>the na
1610: 6d 65 20 6f 66 20 74 68 65 20 63 68 61 72 73 65  me of the charse
1620: 74 20 65 6e 63 6f 64 69 6e 67 20 61 64 6f 70 74  t encoding adopt
1630: 65 64 20 62 79 20 74 68 65 20 3c 62 3e 2e 64 62  ed by the <b>.db
1640: 66 3c 2f 62 3e 20 6d 65 6d 62 65 72 20 6f 66 20  f</b> member of 
1650: 74 68 65 20 53 68 61 70 65 66 69 6c 65 2e 3c 2f  the Shapefile.</
1660: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65 72  li>..</ul>..<ver
1670: 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 49  batim>..SELECT I
1680: 6d 70 6f 72 74 5a 69 70 53 48 50 20 28 20 27 63  mportZipSHP ( 'c
1690: 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f  :/users/afuri/Do
16a0: 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31  wnloads/Limiti01
16b0: 30 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 0d 0a  012020.zip' , ..
16c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
16d0: 20 20 20 20 20 20 27 4c 69 6d 69 74 69 30 31 30        'Limiti010
16e0: 31 32 30 32 30 2f 52 65 67 30 31 30 31 32 30 32  12020/Reg0101202
16f0: 30 2f 52 65 67 30 31 30 31 32 30 32 30 5f 57 47  0/Reg01012020_WG
1700: 53 38 34 27 20 2c 20 0d 0a 20 20 20 20 20 20 20  S84' , ..       
1710: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27                 '
1720: 72 65 67 69 6f 6e 69 27 2c 20 27 55 54 46 2d 38  regioni', 'UTF-8
1730: 27 20 2c 20 33 32 36 33 32 20 2c 20 27 74 68 65  ' , 32632 , 'the
1740: 5f 67 65 6f 6d 27 20 2c 20 27 63 6f 64 5f 72 65  _geom' , 'cod_re
1750: 67 27 20 2c 0d 0a 20 20 20 20 20 20 20 20 20 20  g' ,..          
1760: 20 20 20 20 20 20 20 20 20 20 20 20 27 4d 55 4c              'MUL
1770: 54 49 50 4f 4c 59 47 4f 4e 27 20 2c 20 30 20 2c  TIPOLYGON' , 0 ,
1780: 20 30 20 2c 20 31 20 2c 20 30 20 2c 20 27 4c 4f   0 , 1 , 0 , 'LO
1790: 57 45 52 27 20 2c 20 31 20 2c 20 30 20 29 20 0d  WER' , 1 , 0 ) .
17a0: 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a  .-------------..
17b0: 32 30 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d  20..</verbatim>.
17c0: 0a 49 6e 20 69 74 73 20 63 6f 6d 70 6c 65 74 65  .In its complete
17d0: 20 66 6f 72 6d 20 3c 62 3e 49 6d 70 6f 72 74 5a   form <b>ImportZ
17e0: 69 70 53 48 50 28 29 3c 2f 62 3e 20 73 75 70 70  ipSHP()</b> supp
17f0: 6f 72 74 73 20 74 68 65 73 65 20 66 75 72 74 68  orts these furth
1800: 65 72 20 6f 70 74 69 6f 6e 61 6c 20 61 72 67 75  er optional argu
1810: 6d 65 6e 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c  ments:..<ul>..<l
1820: 69 3e 61 6e 20 65 78 70 6c 69 63 69 74 6c 79 20  i>an explicitly 
1830: 73 74 61 74 65 64 20 53 52 49 44 3c 2f 6c 69 3e  stated SRID</li>
1840: 0d 0a 3c 6c 69 3e 74 68 65 20 6e 61 6d 65 20 6f  ..<li>the name o
1850: 66 20 74 68 65 20 47 65 6f 6d 65 74 72 79 20 43  f the Geometry C
1860: 6f 6c 75 6d 6e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  olumn</li>..<li>
1870: 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20  the name of the 
1880: 53 68 61 70 65 66 69 6c 65 73 20 63 6f 6c 75 6d  Shapefiles colum
1890: 6e 20 74 6f 20 62 65 20 61 73 73 75 6d 65 64 20  n to be assumed 
18a0: 61 73 20 74 68 65 20 50 72 69 6d 61 72 79 20 4b  as the Primary K
18b0: 65 79 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 6e 20  ey</li>..<li>an 
18c0: 65 78 70 6c 69 63 69 74 6c 79 20 73 65 74 20 47  explicitly set G
18d0: 65 6f 6d 65 74 72 79 20 54 79 70 65 3c 2f 6c 69  eometry Type</li
18e0: 3e 0d 0a 3c 6c 69 3e 61 20 3c 69 3e 62 6f 6f 6c  >..<li>a <i>bool
18f0: 65 61 6e 3c 2f 69 3e 20 66 6c 61 67 20 72 65 71  ean</i> flag req
1900: 75 65 73 74 69 6e 67 20 74 6f 20 63 61 73 74 20  uesting to cast 
1910: 61 6c 6c 20 63 6f 6f 72 64 69 6e 61 74 65 73 20  all coordinates 
1920: 74 6f 20 58 59 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  to XY</li>..<li>
1930: 61 20 3c 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e  a <i>boolean</i>
1940: 20 66 6c 61 67 20 72 65 71 75 65 73 74 69 6e 67   flag requesting
1950: 20 66 6f 72 20 43 6f 6d 70 72 65 73 73 65 64 20   for Compressed 
1960: 47 65 6f 6d 65 74 72 69 65 73 3c 2f 6c 69 3e 0d  Geometries</li>.
1970: 0a 3c 6c 69 3e 61 20 3c 69 3e 62 6f 6f 6c 65 61  .<li>a <i>boolea
1980: 6e 3c 2f 69 3e 20 66 6c 61 67 20 72 65 71 75 65  n</i> flag reque
1990: 73 74 69 6e 67 20 66 6f 72 20 63 72 65 61 74 69  sting for creati
19a0: 6e 67 20 61 20 53 70 61 74 69 61 6c 20 49 6e 64  ng a Spatial Ind
19b0: 65 78 20 73 75 70 70 6f 72 74 69 6e 67 20 74 68  ex supporting th
19c0: 65 20 47 65 6f 6d 65 74 72 79 20 43 6f 6c 75 6d  e Geometry Colum
19d0: 6e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 3c 69  n</li>..<li>a <i
19e0: 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20 66 6c 61  >boolean</i> fla
19f0: 67 20 72 65 71 75 65 73 74 69 6e 67 20 66 6f 72  g requesting for
1a00: 20 69 6d 70 6f 72 74 69 6e 67 20 61 6c 6c 20 64   importing all d
1a10: 61 74 65 20 76 61 6c 75 65 73 20 61 73 20 70 6c  ate values as pl
1a20: 61 69 6e 20 74 65 78 74 20 28 69 6e 73 74 65 61  ain text (instea
1a30: 64 20 6f 66 20 61 73 20 4a 75 6c 69 61 6e 20 44  d of as Julian D
1a40: 61 74 65 73 29 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e  ates)</li>..<li>
1a50: 61 20 74 65 78 74 20 73 74 72 69 6e 67 20 73 75  a text string su
1a60: 63 68 20 61 73 20 3c 62 3e 4c 4f 57 45 52 3c 2f  ch as <b>LOWER</
1a70: 62 3e 2c 20 3c 62 3e 55 50 50 45 52 3c 2f 62 3e  b>, <b>UPPER</b>
1a80: 20 6f 72 20 3c 62 3e 53 41 4d 45 3c 2f 62 3e 20   or <b>SAME</b> 
1a90: 73 70 65 63 69 66 79 69 6e 67 20 69 66 20 61 6c  specifying if al
1aa0: 6c 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 20 73  l column names s
1ab0: 68 6f 75 6c 64 20 62 65 20 72 65 73 70 65 63 74  hould be respect
1ac0: 69 76 65 6c 79 20 4c 6f 77 65 72 63 61 73 65 20  ively Lowercase 
1ad0: 6f 72 20 55 70 70 65 72 63 61 73 65 20 6f 72 20  or Uppercase or 
1ae0: 61 73 20 69 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69  as is.</li>..<li
1af0: 3e 61 20 3c 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69  >a <i>boolean</i
1b00: 3e 20 66 6c 61 67 20 66 6f 72 20 69 6d 6d 65 64  > flag for immed
1b10: 69 61 74 65 6c 79 20 75 70 64 61 74 69 6e 67 20  iately updating 
1b20: 74 61 62 6c 65 27 73 20 53 74 61 74 69 73 74 69  table's Statisti
1b30: 63 73 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 3c  cs</li>..<li>a <
1b40: 69 3e 62 6f 6f 6c 65 61 6e 3c 2f 69 3e 20 66 6c  i>boolean</i> fl
1b50: 61 67 20 61 63 74 69 76 61 74 69 6e 67 20 76 65  ag activating ve
1b60: 72 62 6f 73 65 20 6d 6f 64 65 3c 2f 6c 69 3e 20  rbose mode</li> 
1b70: 20 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 3c 62   ..</ul>..<br><b
1b80: 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 41 63  r>..<hr>..<h3>Ac
1b90: 63 65 73 73 69 6e 67 20 61 20 5a 69 70 70 65 64  cessing a Zipped
1ba0: 20 44 42 46 3c 2f 68 33 3e 0d 0a 41 6c 6c 20 74   DBF</h3>..All t
1bb0: 68 65 73 65 20 6e 65 77 20 53 51 4c 20 66 75 6e  hese new SQL fun
1bc0: 63 74 69 6f 6e 73 20 61 72 65 20 6e 6f 77 20 73  ctions are now s
1bd0: 75 70 70 6f 72 74 65 64 3a 0d 0a 3c 75 6c 3e 0d  upported:..<ul>.
1be0: 0a 3c 6c 69 3e 3c 62 3e 49 6d 70 6f 72 74 5a 69  .<li><b>ImportZi
1bf0: 70 44 42 46 28 29 3c 2f 62 3e 3a 20 74 68 65 20  pDBF()</b>: the 
1c00: 6d 61 69 6e 20 66 75 6e 63 74 69 6f 6e 20 61 6c  main function al
1c10: 6c 6f 77 69 6e 67 20 74 6f 20 69 6d 70 6f 72 74  lowing to import
1c20: 20 61 20 77 68 6f 6c 65 20 44 42 46 20 66 69 6c   a whole DBF fil
1c30: 65 20 69 6e 74 6f 20 61 20 6e 65 77 20 54 61 62  e into a new Tab
1c40: 6c 65 20 69 6e 74 6f 20 74 68 65 20 63 75 72 72  le into the curr
1c50: 65 6e 74 6c 79 20 63 6f 6e 6e 65 63 74 65 64 20  ently connected 
1c60: 44 61 74 61 62 61 73 65 2e 3c 2f 6c 69 3e 0d 0a  Database.</li>..
1c70: 3c 6c 69 3e 3c 62 3e 5a 69 70 66 69 6c 65 5f 4e  <li><b>Zipfile_N
1c80: 75 6d 44 42 46 28 29 3c 2f 62 3e 3a 20 61 20 68  umDBF()</b>: a h
1c90: 65 6c 70 65 72 20 66 75 6e 63 74 69 6f 6e 20 72  elper function r
1ca0: 65 74 75 72 6e 69 6e 67 20 74 68 65 20 74 6f 74  eturning the tot
1cb0: 61 6c 20 63 6f 75 6e 74 20 6f 66 20 44 42 46 20  al count of DBF 
1cc0: 66 69 6c 65 73 20 63 6f 6e 74 61 69 6e 65 64 20  files contained 
1cd0: 77 69 74 68 69 6e 20 61 20 67 69 76 65 6e 20 5a  within a given Z
1ce0: 69 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c  ipfile.</li>..<l
1cf0: 69 3e 3c 62 3e 5a 69 70 66 69 6c 65 5f 44 62 66  i><b>Zipfile_Dbf
1d00: 4e 28 29 3c 2f 62 3e 3a 20 61 20 68 65 6c 70 65  N()</b>: a helpe
1d10: 72 20 66 75 6e 63 74 69 6f 6e 20 72 65 74 75 72  r function retur
1d20: 6e 69 6e 67 20 74 68 65 20 3c 62 3e 3c 69 3e 66  ning the <b><i>f
1d30: 69 6c 65 6e 61 6d 65 3c 2f 69 3e 3c 2f 62 3e 20  ilename</i></b> 
1d40: 66 6f 72 20 74 68 65 20 3c 62 3e 4e 74 68 3c 2f  for the <b>Nth</
1d50: 62 3e 20 44 42 46 20 66 69 6c 65 20 63 6f 6e 74  b> DBF file cont
1d60: 61 69 6e 65 64 20 77 69 74 68 69 6e 20 61 20 67  ained within a g
1d70: 69 76 65 6e 20 5a 69 70 66 69 6c 65 2e 3c 2f 6c  iven Zipfile.</l
1d80: 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d  i>..</ul>..<br>.
1d90: 0a 57 65 27 6c 6c 20 63 6f 6e 74 69 6e 75 65 20  .We'll continue 
1da0: 74 6f 20 75 73 65 20 74 68 65 20 73 61 6d 65 20  to use the same 
1db0: 5a 69 70 66 69 6c 65 20 69 6e 20 74 68 69 73 20  Zipfile in this 
1dc0: 74 75 74 6f 72 69 61 6c 20 74 6f 6f 2e 0d 0a 3c  tutorial too...<
1dd0: 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 4c 45 43  verbatim>..SELEC
1de0: 54 20 5a 69 70 66 69 6c 65 5f 4e 75 6d 44 42 46  T Zipfile_NumDBF
1df0: 20 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 75   ( 'c:/users/afu
1e00: 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d  ri/Downloads/Lim
1e10: 69 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70 27  iti01012020.zip'
1e20: 20 29 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   )..------------
1e30: 0d 0a 34 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e  ..4..</verbatim>
1e40: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20  ..<ul>..<li>the 
1e50: 53 51 4c 20 66 75 6e 63 74 69 6f 6e 20 3c 62 3e  SQL function <b>
1e60: 5a 69 70 66 69 6c 65 5f 4e 75 6d 44 42 46 28 29  Zipfile_NumDBF()
1e70: 3c 2f 62 3e 20 77 69 6c 6c 20 69 6e 73 70 65 63  </b> will inspec
1e80: 74 20 61 20 5a 69 70 66 69 6c 65 20 74 68 65 6e  t a Zipfile then
1e90: 20 72 65 74 75 72 6e 69 6e 67 20 74 68 65 20 74   returning the t
1ea0: 6f 74 61 6c 20 63 6f 75 6e 74 20 6f 66 20 44 42  otal count of DB
1eb0: 46 20 66 69 6c 65 73 20 69 74 20 63 6f 6e 74 61  F files it conta
1ec0: 69 6e 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69  ins.</li>..<li>i
1ed0: 74 20 72 65 71 75 69 72 65 73 20 6a 75 73 74 20  t requires just 
1ee0: 61 20 73 69 6e 67 6c 65 20 61 72 67 75 6d 65 6e  a single argumen
1ef0: 74 3a 20 74 68 65 20 61 62 73 6f 6c 75 74 65 20  t: the absolute 
1f00: 6f 72 20 72 65 6c 61 74 69 76 65 20 70 61 74 68  or relative path
1f10: 20 6c 65 61 64 69 6e 67 20 74 6f 20 74 68 65 20   leading to the 
1f20: 5a 69 70 66 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c  Zipfile.</li>..<
1f30: 6c 69 3e 3c 62 3e 4e 6f 74 65 3c 2f 62 3e 20 69  li><b>Note</b> i
1f40: 74 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 3c 62  t will return <b
1f50: 3e 30 3c 2f 62 3e 20 69 66 20 74 68 65 20 5a 69  >0</b> if the Zi
1f60: 70 66 69 6c 65 20 64 6f 65 73 20 6e 6f 74 20 63  pfile does not c
1f70: 6f 6e 74 61 69 6e 20 61 6e 79 20 44 42 46 20 66  ontain any DBF f
1f80: 69 6c 65 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e  ile...<ul>..<li>
1f90: 3c 62 3e 4e 55 4c 4c 3c 2f 62 3e 20 77 69 6c 6c  <b>NULL</b> will
1fa0: 20 62 65 20 72 65 74 75 72 6e 65 64 20 69 66 20   be returned if 
1fb0: 74 68 65 20 5a 69 70 66 69 6c 65 20 64 6f 65 73  the Zipfile does
1fc0: 20 6e 6f 74 20 65 78 69 73 74 20 6f 66 20 69 66   not exist of if
1fd0: 20 69 74 27 73 20 63 6f 72 72 75 70 74 65 64 20   it's corrupted 
1fe0: 6f 72 20 69 6e 76 61 6c 69 64 2e 3c 2f 6c 69 3e  or invalid.</li>
1ff0: 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 2f  ..</ul></li>..</
2000: 75 6c 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d  ul>..<verbatim>.
2010: 0a 53 45 4c 45 43 54 20 5a 69 70 66 69 6c 65 5f  .SELECT Zipfile_
2020: 64 62 66 4e 20 28 20 27 63 3a 2f 75 73 65 72 73  dbfN ( 'c:/users
2030: 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73  /afuri/Downloads
2040: 2f 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2e  /Limiti01012020.
2050: 7a 69 70 27 20 2c 20 31 20 29 0d 0a 2d 2d 2d 2d  zip' , 1 )..----
2060: 2d 2d 0d 0a 4c 69 6d 69 74 69 30 31 30 31 32 30  --..Limiti010120
2070: 32 30 2f 43 6f 6d 30 31 30 31 32 30 32 30 2f 43  20/Com01012020/C
2080: 6f 6d 30 31 30 31 32 30 32 30 5f 57 47 53 38 34  om01012020_WGS84
2090: 2e 64 62 66 0d 0a 0d 0a 53 45 4c 45 43 54 20 5a  .dbf....SELECT Z
20a0: 69 70 66 69 6c 65 5f 64 62 66 4e 20 28 20 27 63  ipfile_dbfN ( 'c
20b0: 3a 2f 75 73 65 72 73 2f 61 66 75 72 69 2f 44 6f  :/users/afuri/Do
20c0: 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31  wnloads/Limiti01
20d0: 30 31 32 30 32 30 2e 7a 69 70 27 20 2c 20 32 20  012020.zip' , 2 
20e0: 29 0d 0a 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74  )..------..Limit
20f0: 69 30 31 30 31 32 30 32 30 2f 50 72 6f 76 43 4d  i01012020/ProvCM
2100: 30 31 30 31 32 30 32 30 2f 50 72 6f 76 43 4d 30  01012020/ProvCM0
2110: 31 30 31 32 30 32 30 5f 57 47 53 38 34 2e 64 62  1012020_WGS84.db
2120: 66 0d 0a 0d 0a 53 45 4c 45 43 54 20 5a 69 70 66  f....SELECT Zipf
2130: 69 6c 65 5f 64 62 66 4e 20 28 20 27 63 3a 2f 75  ile_dbfN ( 'c:/u
2140: 73 65 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c  sers/afuri/Downl
2150: 6f 61 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32  oads/Limiti01012
2160: 30 32 30 2e 7a 69 70 27 20 2c 20 33 20 29 0d 0a  020.zip' , 3 )..
2170: 2d 2d 2d 2d 2d 2d 0d 0a 4c 69 6d 69 74 69 30 31  ------..Limiti01
2180: 30 31 32 30 32 30 2f 52 65 67 30 31 30 31 32 30  012020/Reg010120
2190: 32 30 2f 52 65 67 30 31 30 31 32 30 32 30 5f 57  20/Reg01012020_W
21a0: 47 53 38 34 2e 64 62 66 0d 0a 0d 0a 53 45 4c 45  GS84.dbf....SELE
21b0: 43 54 20 5a 69 70 66 69 6c 65 5f 64 62 66 4e 20  CT Zipfile_dbfN 
21c0: 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 66 75 72  ( 'c:/users/afur
21d0: 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69 6d 69  i/Downloads/Limi
21e0: 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70 27 20  ti01012020.zip' 
21f0: 2c 20 34 20 29 0d 0a 2d 2d 2d 2d 2d 2d 2d 0d 0a  , 4 )..-------..
2200: 4c 69 6d 69 74 69 30 31 30 31 32 30 32 30 2f 52  Limiti01012020/R
2210: 69 70 47 65 6f 30 31 30 31 32 30 32 30 2f 52 69  ipGeo01012020/Ri
2220: 70 47 65 6f 30 31 30 31 32 30 32 30 5f 57 47 53  pGeo01012020_WGS
2230: 38 34 2e 64 62 66 0d 0a 3c 2f 76 65 72 62 61 74  84.dbf..</verbat
2240: 69 6d 3e 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65  im><ul>..<li>the
2250: 20 53 51 4c 20 66 75 6e 63 74 69 6f 6e 20 3c 62   SQL function <b
2260: 3e 5a 69 70 66 69 6c 65 5f 44 62 66 4e 28 29 3c  >Zipfile_DbfN()<
2270: 2f 62 3e 20 77 69 6c 6c 20 69 6e 73 70 65 63 74  /b> will inspect
2280: 20 61 20 5a 69 70 66 69 6c 65 20 74 68 65 6e 20   a Zipfile then 
2290: 72 65 74 75 72 6e 69 6e 67 20 74 68 65 20 3c 62  returning the <b
22a0: 3e 3c 69 3e 66 69 6c 65 6e 61 6d 65 3c 2f 69 3e  ><i>filename</i>
22b0: 3c 2f 62 3e 20 6f 66 20 74 68 65 20 3c 62 3e 4e  </b> of the <b>N
22c0: 74 68 3c 2f 62 3e 20 44 42 46 20 66 69 6c 65 20  th</b> DBF file 
22d0: 69 74 20 63 6f 6e 74 61 69 6e 73 2e 3c 2f 6c 69  it contains.</li
22e0: 3e 0d 0a 3c 6c 69 3e 69 74 20 72 65 71 75 69 72  >..<li>it requir
22f0: 65 73 20 74 77 6f 20 61 72 67 75 6d 65 6e 74 73  es two arguments
2300: 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65  :..<ul>..<li>the
2310: 20 61 62 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c   absolute or rel
2320: 61 74 69 76 65 20 70 61 74 68 20 6c 65 61 64 69  ative path leadi
2330: 6e 67 20 74 6f 20 74 68 65 20 5a 69 70 66 69 6c  ng to the Zipfil
2340: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65  e.</li>..<li>the
2350: 20 72 65 6c 61 74 69 76 65 20 69 6e 64 65 78 20   relative index 
2360: 28 3c 62 3e 31 20 62 61 73 65 64 3c 2f 62 3e 29  (<b>1 based</b>)
2370: 20 6f 66 20 74 68 65 20 44 42 46 20 66 69 6c 65   of the DBF file
2380: 20 77 69 74 68 69 6e 20 74 68 65 20 5a 69 70 66   within the Zipf
2390: 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  ile.</li>..</ul>
23a0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 4e 6f  </li>..<li><b>No
23b0: 74 65 3c 2f 62 3e 3a 20 3c 62 3e 4e 55 4c 4c 3c  te</b>: <b>NULL<
23c0: 2f 62 3e 20 77 69 6c 6c 20 62 65 20 72 65 74 75  /b> will be retu
23d0: 72 6e 65 64 20 69 66 20 74 68 65 20 5a 69 70 66  rned if the Zipf
23e0: 69 6c 65 20 64 6f 65 73 20 6e 6f 74 20 65 78 69  ile does not exi
23f0: 73 74 20 6f 66 20 69 66 20 69 74 27 73 20 69 6e  st of if it's in
2400: 76 61 6c 69 64 20 6f 72 20 69 66 20 74 68 65 20  valid or if the 
2410: 69 6e 64 65 78 20 76 61 6c 75 65 20 69 73 20 6f  index value is o
2420: 75 74 73 69 64 65 20 74 68 65 20 65 78 70 65 63  utside the expec
2430: 74 65 64 20 72 61 6e 67 65 2e 3c 2f 6c 69 3e 0d  ted range.</li>.
2440: 0a 3c 2f 75 6c 3e 0d 0a 3c 76 65 72 62 61 74 69  .</ul>..<verbati
2450: 6d 3e 0d 0a 53 45 4c 45 43 54 20 49 6d 70 6f 72  m>..SELECT Impor
2460: 74 5a 69 70 44 42 46 20 28 20 27 63 3a 2f 75 73  tZipDBF ( 'c:/us
2470: 65 72 73 2f 61 66 75 72 69 2f 44 6f 77 6e 6c 6f  ers/afuri/Downlo
2480: 61 64 73 2f 4c 69 6d 69 74 69 30 31 30 31 32 30  ads/Limiti010120
2490: 32 30 2e 7a 69 70 27 20 2c 20 0d 0a 20 20 20 20  20.zip' , ..    
24a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
24b0: 20 20 27 4c 69 6d 69 74 69 30 31 30 31 32 30 32    'Limiti0101202
24c0: 30 2f 43 6f 6d 30 31 30 31 32 30 32 30 2f 43 6f  0/Com01012020/Co
24d0: 6d 30 31 30 31 32 30 32 30 5f 57 47 53 38 34 2e  m01012020_WGS84.
24e0: 64 62 66 27 20 2c 20 0d 0a 20 20 20 20 20 20 20  dbf' , ..       
24f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 27                 '
2500: 63 6f 6d 75 6e 69 5f 64 62 66 27 2c 20 27 55 54  comuni_dbf', 'UT
2510: 46 2d 38 27 20 29 20 0d 0a 2d 2d 2d 2d 2d 2d 2d  F-8' ) ..-------
2520: 2d 2d 0d 0a 37 39 30 34 0d 0a 3c 2f 76 65 72 62  --..7904..</verb
2530: 61 74 69 6d 3e 0d 0a 54 68 65 20 3c 62 3e 49 6d  atim>..The <b>Im
2540: 70 6f 72 74 5a 69 70 44 42 46 28 29 3c 2f 62 3e  portZipDBF()</b>
2550: 20 63 6c 6f 73 65 6c 79 20 6d 69 6d 69 63 73 20   closely mimics 
2560: 3c 62 3e 49 6d 70 6f 72 74 44 42 46 28 29 3c 2f  <b>ImportDBF()</
2570: 62 3e 2c 20 65 78 63 65 70 74 20 69 6e 20 74 68  b>, except in th
2580: 61 74 20 69 74 20 72 65 71 75 69 72 65 73 20 6f  at it requires o
2590: 6e 65 20 6d 6f 72 65 20 61 72 67 75 6d 65 6e 74  ne more argument
25a0: 20 73 70 65 63 69 66 79 69 6e 67 20 74 68 65 20   specifying the 
25b0: 70 61 74 68 6e 61 6d 65 20 6f 66 20 74 68 65 20  pathname of the 
25c0: 5a 69 70 66 69 6c 65 20 63 6f 6e 74 61 69 6e 69  Zipfile containi
25d0: 6e 67 20 74 68 65 20 44 42 46 20 66 69 6c 65 20  ng the DBF file 
25e0: 74 6f 20 62 65 20 69 6d 70 6f 72 74 65 64 2e 3c  to be imported.<
25f0: 62 72 3e 0d 0a 4f 6e 20 73 75 63 63 65 73 73 20  br>..On success 
2600: 69 74 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 74  it will return t
2610: 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 72 6f 77  he number of row
2620: 73 20 69 6e 73 65 72 74 65 64 20 69 6e 74 6f 20  s inserted into 
2630: 74 68 65 20 54 61 62 6c 65 20 74 68 61 74 20 68  the Table that h
2640: 61 73 20 6a 75 73 74 20 62 65 65 6e 20 63 72 65  as just been cre
2650: 61 74 65 64 3b 20 6f 6e 20 66 61 69 6c 75 72 65  ated; on failure
2660: 20 69 74 20 77 69 6c 6c 20 6a 75 73 74 20 72 65   it will just re
2670: 74 75 72 6e 20 3c 62 3e 4e 55 4c 4c 3c 2f 62 3e  turn <b>NULL</b>
2680: 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 49 6e 20 69 74  .<br><br>..In it
2690: 73 20 73 69 6d 70 6c 65 73 74 20 66 6f 72 6d 20  s simplest form 
26a0: 69 74 20 72 65 71 75 69 72 65 73 20 6a 75 73 74  it requires just
26b0: 20 66 6f 75 72 20 61 72 67 75 6d 65 6e 74 73 3a   four arguments:
26c0: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 68 65 20  ..<ul>..<li>the 
26d0: 61 62 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c 61  absolute or rela
26e0: 74 69 76 65 20 70 61 74 68 20 6c 65 61 64 69 6e  tive path leadin
26f0: 67 20 74 6f 20 74 68 65 20 5a 69 70 66 69 6c 65  g to the Zipfile
2700: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20  .</li>..<li>the 
2710: 3c 62 3e 3c 69 3e 66 69 6c 65 6e 61 6d 65 3c 2f  <b><i>filename</
2720: 69 3e 3c 2f 62 3e 20 6f 66 20 74 68 65 20 44 42  i></b> of the DB
2730: 46 20 66 69 6c 65 20 77 69 74 68 69 6e 20 74 68  F file within th
2740: 65 20 5a 69 70 66 69 6c 65 20 28 69 6e 63 6c 75  e Zipfile (inclu
2750: 64 69 6e 67 20 69 74 73 20 20 3c 62 3e 2e 64 62  ding its  <b>.db
2760: 66 3c 2f 62 3e 20 73 75 66 66 69 78 29 2e 3c 2f  f</b> suffix).</
2770: 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e 61 6d  li>..<li>the nam
2780: 65 20 6f 66 20 74 68 65 20 54 61 62 6c 65 20 74  e of the Table t
2790: 6f 20 62 65 20 63 72 65 61 74 65 64 20 61 6e 64  o be created and
27a0: 20 74 68 65 6e 20 70 6f 70 75 6c 61 74 65 64 20   then populated 
27b0: 62 79 20 69 6d 70 6f 72 74 69 6e 67 20 74 68 65  by importing the
27c0: 20 77 68 6f 6c 65 20 44 42 46 20 66 69 6c 65 2e   whole DBF file.
27d0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 6e  </li>..<li>the n
27e0: 61 6d 65 20 6f 66 20 74 68 65 20 63 68 61 72 73  ame of the chars
27f0: 65 74 20 65 6e 63 6f 64 69 6e 67 20 61 64 6f 70  et encoding adop
2800: 74 65 64 20 62 79 20 74 68 65 20 44 42 46 20 66  ted by the DBF f
2810: 69 6c 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e  ile.</li>..</ul>
2820: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45  ..<verbatim>..SE
2830: 4c 45 43 54 20 49 6d 70 6f 72 74 5a 69 70 44 42  LECT ImportZipDB
2840: 46 20 28 20 27 63 3a 2f 75 73 65 72 73 2f 61 66  F ( 'c:/users/af
2850: 75 72 69 2f 44 6f 77 6e 6c 6f 61 64 73 2f 4c 69  uri/Downloads/Li
2860: 6d 69 74 69 30 31 30 31 32 30 32 30 2e 7a 69 70  miti01012020.zip
2870: 27 20 2c 20 0d 0a 20 20 20 20 20 20 20 20 20 20  ' , ..          
2880: 20 20 20 20 20 20 20 20 20 20 20 20 27 4c 69 6d              'Lim
2890: 69 74 69 30 31 30 31 32 30 32 30 2f 52 65 67 30  iti01012020/Reg0
28a0: 31 30 31 32 30 32 30 2f 52 65 67 30 31 30 31 32  1012020/Reg01012
28b0: 30 32 30 5f 57 47 53 38 34 2e 64 62 66 27 20 2c  020_WGS84.dbf' ,
28c0: 20 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20 20   ..             
28d0: 20 20 20 20 20 20 20 20 20 27 72 65 67 69 6f 6e           'region
28e0: 69 5f 64 62 66 27 2c 20 27 55 54 46 2d 38 27 20  i_dbf', 'UTF-8' 
28f0: 2c 20 27 63 6f 64 5f 72 65 67 27 20 2c 20 31 20  , 'cod_reg' , 1 
2900: 2c 20 27 4c 4f 57 45 52 27 20 29 20 0d 0a 2d 2d  , 'LOWER' ) ..--
2910: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 32 30 0d  -----------..20.
2920: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 49 6e  .</verbatim>..In
2930: 20 69 74 73 20 63 6f 6d 70 6c 65 74 65 20 66 6f   its complete fo
2940: 72 6d 20 3c 62 3e 49 6d 70 6f 72 74 5a 69 70 44  rm <b>ImportZipD
2950: 42 46 28 29 3c 2f 62 3e 20 73 75 70 70 6f 72 74  BF()</b> support
2960: 73 20 74 68 65 73 65 20 66 75 72 74 68 65 72 20  s these further 
2970: 6f 70 74 69 6f 6e 61 6c 20 61 72 67 75 6d 65 6e  optional argumen
2980: 74 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74  ts:..<ul>..<li>t
2990: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 44  he name of the D
29a0: 42 46 20 63 6f 6c 75 6d 6e 20 74 6f 20 62 65 20  BF column to be 
29b0: 61 73 73 75 6d 65 64 20 61 73 20 74 68 65 20 50  assumed as the P
29c0: 72 69 6d 61 72 79 20 4b 65 79 3c 2f 6c 69 3e 0d  rimary Key</li>.
29d0: 0a 3c 6c 69 3e 61 20 3c 69 3e 62 6f 6f 6c 65 61  .<li>a <i>boolea
29e0: 6e 3c 2f 69 3e 20 66 6c 61 67 20 72 65 71 75 65  n</i> flag reque
29f0: 73 74 69 6e 67 20 66 6f 72 20 69 6d 70 6f 72 74  sting for import
2a00: 69 6e 67 20 61 6c 6c 20 64 61 74 65 20 76 61 6c  ing all date val
2a10: 75 65 73 20 61 73 20 70 6c 61 69 6e 20 74 65 78  ues as plain tex
2a20: 74 20 28 69 6e 73 74 65 61 64 20 6f 66 20 61 73  t (instead of as
2a30: 20 4a 75 6c 69 61 6e 20 44 61 74 65 73 29 3c 2f   Julian Dates)</
2a40: 6c 69 3e 0d 0a 3c 6c 69 3e 61 20 74 65 78 74 20  li>..<li>a text 
2a50: 73 74 72 69 6e 67 20 73 75 63 68 20 61 73 20 3c  string such as <
2a60: 62 3e 4c 4f 57 45 52 3c 2f 62 3e 2c 20 3c 62 3e  b>LOWER</b>, <b>
2a70: 55 50 50 45 52 3c 2f 62 3e 20 6f 72 20 3c 62 3e  UPPER</b> or <b>
2a80: 53 41 4d 45 3c 2f 62 3e 20 73 70 65 63 69 66 79  SAME</b> specify
2a90: 69 6e 67 20 69 66 20 61 6c 6c 20 63 6f 6c 75 6d  ing if all colum
2aa0: 6e 20 6e 61 6d 65 73 20 73 68 6f 75 6c 64 20 62  n names should b
2ab0: 65 20 72 65 73 70 65 63 74 69 76 65 6c 79 20 4c  e respectively L
2ac0: 6f 77 65 72 63 61 73 65 20 6f 72 20 55 70 70 65  owercase or Uppe
2ad0: 72 63 61 73 65 20 6f 72 20 61 73 20 69 73 2e 3c  rcase or as is.<
2ae0: 2f 6c 69 3e 20 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 62  /li> ..</ul>..<b
2af0: 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 47 55  r>..<hr>..<h3>GU
2b00: 49 20 73 75 70 70 6f 72 74 20 66 6f 72 20 69 6d  I support for im
2b10: 70 6f 72 74 69 6e 67 20 53 48 50 20 61 6e 64 20  porting SHP and 
2b20: 44 42 46 20 64 61 74 61 73 65 74 73 20 64 69 72  DBF datasets dir
2b30: 65 63 74 6c 79 20 66 72 6f 6d 20 61 20 5a 69 70  ectly from a Zip
2b40: 66 69 6c 65 3c 2f 68 33 3e 0d 0a 3c 74 61 62 6c  file</h3>..<tabl
2b50: 65 20 77 69 64 74 68 3d 22 31 30 30 25 22 20 63  e width="100%" c
2b60: 65 6c 6c 70 61 64 64 69 6e 67 3d 22 31 32 22 20  ellpadding="12" 
2b70: 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 38 22 3e  cellspacing="8">
2b80: 0d 0a 3c 74 72 3e 3c 74 64 3e 0d 0a 3c 6f 6c 3e  ..<tr><td>..<ol>
2b90: 0d 0a 3c 6c 69 3e 55 73 69 6e 67 20 74 68 65 20  ..<li>Using the 
2ba0: 73 74 61 6e 64 61 72 64 20 66 69 6c 65 20 73 65  standard file se
2bb0: 6c 65 63 74 69 6f 6e 20 64 69 61 6c 6f 67 20 62  lection dialog b
2bc0: 6f 78 20 79 6f 75 20 73 69 6d 70 6c 79 20 68 61  ox you simply ha
2bd0: 76 65 20 74 6f 20 73 65 6c 65 63 74 20 74 68 65  ve to select the
2be0: 20 69 6e 74 65 6e 64 65 64 20 5a 69 70 66 69 6c   intended Zipfil
2bf0: 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 69  e.</li>..<li>Thi
2c00: 73 20 5a 69 70 66 69 6c 65 20 77 69 6c 6c 20 62  s Zipfile will b
2c10: 65 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20  e automatically 
2c20: 73 63 61 6e 6e 65 64 20 73 6f 20 74 6f 20 69 64  scanned so to id
2c30: 65 6e 74 69 66 79 20 61 6c 6c 20 53 68 61 70 65  entify all Shape
2c40: 66 69 6c 65 73 20 28 6f 72 20 72 65 73 70 65 63  files (or respec
2c50: 74 69 76 65 6c 79 20 44 42 46 20 66 69 6c 65 73  tively DBF files
2c60: 29 20 69 74 20 63 6f 6e 74 61 69 6e 73 3a 3c 2f  ) it contains:</
2c70: 6c 69 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 49  li>..<ul>..<li>I
2c80: 66 20 74 68 65 20 5a 69 70 66 69 6c 65 20 64 6f  f the Zipfile do
2c90: 65 73 20 6e 6f 74 20 63 6f 6e 74 61 69 6e 20 61  es not contain a
2ca0: 6e 79 20 53 68 61 70 65 66 69 6c 65 20 28 6f 72  ny Shapefile (or
2cb0: 20 44 42 46 20 66 69 6c 65 29 20 61 6e 20 65 72   DBF file) an er
2cc0: 72 6f 72 20 6d 65 73 73 61 67 65 20 77 69 6c 6c  ror message will
2cd0: 20 62 65 20 73 68 6f 77 6e 20 61 6e 64 20 74 68   be shown and th
2ce0: 65 20 77 68 6f 6c 65 20 69 6d 70 6f 72 74 20 6f  e whole import o
2cf0: 70 65 72 61 74 69 6f 6e 20 77 69 6c 6c 20 66 61  peration will fa
2d00: 69 69 6c 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 4f  iil.</li>..<li>O
2d10: 74 68 65 72 77 69 73 65 20 74 68 65 20 64 69 61  therwise the dia
2d20: 6c 6f 67 20 62 6f 78 20 73 68 6f 77 6e 20 6f 6e  log box shown on
2d30: 20 74 68 65 20 73 69 64 65 20 66 69 67 75 72 65   the side figure
2d40: 20 77 69 6c 6c 20 62 65 20 73 68 6f 77 6e 2e 3c   will be shown.<
2d50: 62 72 3e 0d 0a 53 65 6c 65 63 74 20 6f 6e 65 20  br>..Select one 
2d60: 6f 66 20 74 68 65 20 53 68 61 70 65 66 69 6c 65  of the Shapefile
2d70: 73 20 28 6f 66 20 44 42 46 20 66 69 6c 65 3d 20  s (of DBF file= 
2d80: 66 72 6f 6d 20 74 68 65 20 6c 69 73 74 20 61 6e  from the list an
2d90: 20 74 68 65 6e 20 63 6f 6e 66 69 72 6d 2e 3c 2f   then confirm.</
2da0: 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d  li>..</ul></li>.
2db0: 0a 3c 2f 6f 6c 3e 3c 2f 74 64 3e 0d 0a 3c 74 64  .</ol></td>..<td
2dc0: 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e   align="center">
2dd0: 3c 69 6d 67 20 73 72 63 3d 22 68 74 74 70 73 3a  <img src="https:
2de0: 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69  //www.gaia-gis.i
2df0: 74 2f 67 61 69 61 2d 73 69 6e 73 2f 67 75 69 32  t/gaia-sins/gui2
2e00: 2d 70 69 63 73 2f 7a 69 70 2d 73 68 70 2d 31 2e  -pics/zip-shp-1.
2e10: 70 6e 67 22 20 61 6c 74 3d 22 47 55 49 5f 31 22  png" alt="GUI_1"
2e20: 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 0d 0a 3c 74 72  ></td></tr>..<tr
2e30: 3e 3c 74 64 3e 41 20 73 6c 69 67 68 74 6c 79 20  ><td>A slightly 
2e40: 6d 6f 64 69 66 69 65 64 20 76 65 72 73 69 6f 6e  modified version
2e50: 20 6f 66 20 74 68 65 20 64 69 61 6c 6f 67 20 62   of the dialog b
2e60: 6f 78 20 61 6c 6c 6f 77 69 6e 67 20 74 6f 20 73  ox allowing to s
2e70: 65 74 20 61 6c 6c 20 69 6d 70 6f 72 74 20 6f 70  et all import op
2e80: 74 69 6f 6e 73 20 77 69 6c 6c 20 61 70 70 65 61  tions will appea
2e90: 72 2e 3c 62 72 3e 0d 0a 53 65 74 20 61 6e 79 20  r.<br>..Set any 
2ea0: 61 70 70 72 6f 70 72 69 61 74 65 20 6f 70 74 69  appropriate opti
2eb0: 6f 6e 20 61 6e 64 20 74 68 65 6e 20 63 6f 6e 74  on and then cont
2ec0: 69 6e 75 65 20 61 73 20 75 73 75 61 6c 2e 0d 0a  inue as usual...
2ed0: 3c 62 72 3e 0d 0a 3c 62 72 3e 0d 0a 3c 74 61 62  <br>..<br>..<tab
2ee0: 6c 65 20 62 67 63 6f 6c 6f 72 3d 22 23 66 66 66  le bgcolor="#fff
2ef0: 66 64 30 22 20 63 65 6c 6c 73 70 61 63 69 6e 67  fd0" cellspacing
2f00: 3d 22 31 32 22 20 63 65 6c 6c 70 61 64 64 69 6e  ="12" cellpaddin
2f10: 67 3d 22 38 22 3e 0d 0a 3c 74 72 3e 3c 74 64 3e  g="8">..<tr><td>
2f20: 0d 0a 49 66 20 79 6f 75 20 77 69 73 68 20 74 6f  ..If you wish to
2f30: 20 69 6d 70 6f 72 74 20 6d 6f 72 65 20 74 68 61   import more tha
2f40: 6e 20 61 20 73 69 6e 67 6c 65 20 53 68 61 70 65  n a single Shape
2f50: 66 69 6c 65 20 28 6f 64 20 44 42 46 20 66 69 6c  file (od DBF fil
2f60: 65 29 20 66 72 6f 6d 20 74 68 65 20 73 61 6d 65  e) from the same
2f70: 20 5a 69 70 66 69 6c 65 20 79 6f 75 20 6d 75 73   Zipfile you mus
2f80: 74 20 72 65 61 70 65 74 65 20 74 68 65 20 73 61  t reapete the sa
2f90: 6d 65 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72  me procedure for
2fa0: 20 65 61 63 68 20 64 61 74 61 73 65 74 2e 3c 62   each dataset.<b
2fb0: 72 3e 3c 62 72 3e 3c 62 72 3e 0d 0a 53 65 6c 65  r><br><br>..Sele
2fc0: 63 74 69 6e 67 20 6d 75 6c 74 69 70 6c 65 20 64  cting multiple d
2fd0: 61 74 61 73 65 73 74 20 69 6e 20 61 20 73 69 6e  atasest in a sin
2fe0: 67 6c 65 20 70 61 73 73 20 69 73 20 6e 6f 74 20  gle pass is not 
2ff0: 61 6c 6c 6f 77 65 64 2e 0d 0a 3c 2f 74 64 3e 3c  allowed...</td><
3000: 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 3c 2f  /tr>..</table></
3010: 74 64 3e 0d 0a 3c 74 64 20 61 6c 69 67 6e 3d 22  td>..<td align="
3020: 63 65 6e 74 65 72 22 3e 3c 69 6d 67 20 73 72 63  center"><img src
3030: 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61  ="https://www.ga
3040: 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d 73  ia-gis.it/gaia-s
3050: 69 6e 73 2f 67 75 69 32 2d 70 69 63 73 2f 7a 69  ins/gui2-pics/zi
3060: 70 2d 73 68 70 2d 32 2e 70 6e 67 22 20 61 6c 74  p-shp-2.png" alt
3070: 3d 22 47 55 49 5f 32 22 3e 3c 2f 74 64 3e 3c 2f  ="GUI_2"></td></
3080: 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c  tr>..</table>..<
3090: 62 72 3e 3c 68 72 3e 3c 62 72 3e 0d 0a 42 61 63  br><hr><br>..Bac
30a0: 6b 20 74 6f 20 3c 61 20 68 72 65 66 3d 22 68 74  k to <a href="ht
30b0: 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67  tps://www.gaia-g
30c0: 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62  is.it/fossil/lib
30d0: 73 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f  spatialite/wiki?
30e0: 6e 61 6d 65 3d 35 2e 30 2e 30 2d 64 6f 63 22 3e  name=5.0.0-doc">
30f0: 6d 61 69 6e 20 53 70 61 74 69 61 4c 69 74 65 20  main SpatiaLite 
3100: 70 61 67 65 3c 2f 61 3e 0a 5a 20 35 37 35 31 39  page</a>.Z 57519
3110: 64 37 65 36 35 31 37 39 64 61 63 63 62 33 65 65  d7e65179daccb3ee
3120: 31 36 31 30 39 63 34 32 61 34 30 0a              16109c42a40.