Update of "ZippedSHP"
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: a2a1995d003686095779367b8112c58f1ea06037
Page Name:ZippedSHP
Date: 2020-05-08 11:32:57
Original User: sandro
Parent: 64df71ad6734f958727608ce4e1f6c3dd10bb7d4 (diff)
Next 00e3958bc4a3cf17f05a6bdb319b92a3fae43f78
Content

Back to main SpatiaLite page

Reading SHP and DBF files directly from within a Zipfile

Starting since version 5.0.0 SpatiaLite has the capability to directly read any Shapefile (or DBF file) contained within a compressed Zipfile.
Several closely related SQL functions have been introduced as well.

Accessing a Zipped SHP

All these new SQL functions are now supported:
We'll now start a quick tutorial about using all these new SQL functions. Note: the tutorial is based on the dataset you can download from here
SELECT Zipfile_NumSHP ( 'c:/users/afuri/Downloads/Limiti01012020.zip' )
------------
4
SELECT Zipfile_shpN ( 'c:/users/afuri/Downloads/Limiti01012020.zip' , 1 )
------
Limiti01012020/Com01012020/Com01012020_WGS84

SELECT Zipfile_shpN ( 'c:/users/afuri/Downloads/Limiti01012020.zip' , 2 )
------
Limiti01012020/ProvCM01012020/ProvCM01012020_WGS84

SELECT Zipfile_shpN ( 'c:/users/afuri/Downloads/Limiti01012020.zip' , 3 )
------
Limiti01012020/Reg01012020/Reg01012020_WGS84

SELECT Zipfile_shpN ( 'c:/users/afuri/Downloads/Limiti01012020.zip' , 4 )
-------
Limiti01012020/RipGeo01012020/RipGeo01012020_WGS84
SELECT PROJ_GuessSridFromZipSHP ( 'c:/users/afuri/Downloads/Limiti01012020.zip' , 'Limiti01012020/Com01012020/Com01012020_WGS84' )
------------
32632
SELECT ImportZipSHP ( 'c:/users/afuri/Downloads/Limiti01012020.zip' , 
                      'Limiti01012020/Com01012020/Com01012020_WGS84' , 
                      'comuni', 'UTF-8' ) 
---------
7904
The ImportZipSHP() closely mimics ImportSHP(), except in that it requires one more argument specifying the pathname of the Zipfile containing the Shapefile to be imported.
On success it will return the number of features inserted into the Spatial Table that has just been created; on failure it will just return NULL.

In its simplest form it requires just four arguments:
SELECT ImportZipSHP ( 'c:/users/afuri/Downloads/Limiti01012020.zip' , 
                      'Limiti01012020/Reg01012020/Reg01012020_WGS84' , 
                      'regioni', 'UTF-8' , 32632 , 'the_geom' , 'cod_reg' ,
                      'MULTIPOLYGON' , 0 , 0 , 1 , 0 , 'LOWER' , 1 , 0 ) 
-------------
20
In its complete form ImportZipSHP() supports these further optional arguments:


Accessing a Zipped DBF

All these new SQL functions are now supported:


Back to main SpatiaLite page