Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Artifact ID: | d2bbf69bff1fe987e5cb01bb6827b6ab2b01527f |
---|---|
Page Name: | Virtual Tables (misc) |
Date: | 2018-08-24 14:04:00 |
Original User: | sandro |
Parent: | 3719a484da7ca5a7279c9a88b5db9e20c06e3d46 (diff) |
Next | fd73f8e7d8513dac8e35dc3e9ec052e1fb0fa3fd |
Content
List of topics
- VirtualShape - Emulation of Shape-Files
- VirtualDBF - Emulation of DBF Tables
- VirtualText - Emulation of TXT/CSV-Files
- VirtualXL - Emulation of MS Excel spreadsheets
- VirtualFDO - Emulation of FDO binary Geometries (GDAL)
- VirtualGPKG - Emulation of GeoPackage-Databases
VirtualShape
The VirtualShape Interface allows to directly access an external ShapeFile by using standard Spatial SQL queries.Syntax for creating a VirtualShape Table:
SELECT CREATE VIRTUAL TABLE my_table USING VirtualShape ( shp_path , charset_encoding , srid ); SELECT CREATE VIRTUAL TABLE my_table USING VirtualShape ( shp_path , charset_encoding , srid , text_dates ); SELECT CREATE VIRTUAL TABLE my_table USING VirtualShape ( shp_path , charset_encoding , srid , text_dates , colname_case );Supported arguments and their interpretation:
- shp_path (mandatory): the relative or absolute pathname leading to the external Shapefile.
- Note: any Shapefile requires at least three individual members sharing the same base name but with different suffixes (*.shp, *.shx and *.dbf).
All suffixes will be automatically handled by VirtualShape, and consequently the shp_path argument must not specify any suffix, just the bare base path must be passed.
- Note: any Shapefile requires at least three individual members sharing the same base name but with different suffixes (*.shp, *.shx and *.dbf).
- charset_encoding (mandatory): canonical name of the charset encoding adopted by the DBF member.
- Examples of valid names are: ASCII, UTF-8, CP850, CP1252, ISO-8849-1
- You can check the full list of supported charset encodings here.
- srid (mandatory): the SRID value of all Geometries within the Shapefile.
- Examples of valid SRID values are: 4326, 3003, 32632
- text_dates (optional): this is a BOOLEAN flag:
- if set to 0 (FALSE) all fields of the DATE type will be represented as julian dates
- if set to any other integer value (TRUE) all fields of the DATE type will be represented as Text Strings as e.g. 2018-08-21
- if not explicitly specified, TRUE will always be assumed (default setting).
- colname_case (optional): this argument specifies if all column names should be considered uppercase or lowercase.
Valid settings are:- uppercase or upper: all column names will be fully capitalized.
- lowercase or lower: all column names will be full lowercase.
- samecase or same: all column names will be exactly preserved as they are defined into the DBF member.
- if not specified, or if any other definition definition is found, lowercase will always be assumed (default setting).
Note: any Text String, quoted or not, when it appears as a Virtual Table argument has the same effect.
SELECT CREATE VIRTUAL TABLE my_table USING VirtualShape( /home/sandro/myshp , CP1252 , 3003 , 1 , lower ); or SELECT CREATE VIRTUAL TABLE my_table USING VirtualShape( '/home/sandro/myshp' , 'CP1252' , 3003 , 1 , 'lower' );Both notations will produce the same result. |
Best practices and known limitations
Warning: VirtualShape Tables are always subject to READ-ONLY restrictions. Any attempt to to execute an INSERT, UPDATE or DELETE statement will always return an error. |
Related Topics
|
VirtualDBF
The VirtualDBF Interface allows to directly access an external DBF table by using standard Spatial SQL queries.Syntax for creating a VirtualDbf Table:
SELECT CREATE VIRTUAL TABLE my_table USING VirtualDbf ( dbf_path , charset_encoding ); SELECT CREATE VIRTUAL TABLE my_table USING VirtualDbf ( dbf_path , charset_encoding , text_dates ); SELECT CREATE VIRTUAL TABLE my_table USING VirtualDbf ( dbf_path , charset_encoding , text_dates , colname_case );Supported arguments and their interpretation:
- dbf_path (mandatory): the relative or absolute pathname leading to the external DBF file.
- Note: the full pathname must be passed, including the final *.dbf suffix.
- charset_encoding (mandatory): canonical name of the charset encoding adopted by the DBF member.
- Examples of valid names are: ASCII, UTF-8, CP850, CP1252, ISO-8849-1
- You can check the full list of supported charset encodings here.
- text_dates (optional): this is a BOOLEAN flag:
- if set to 0 (FALSE) all fields of the DATE type will be represented as julian dates
- if set to any other integer value (TRUE) all fields of the DATE type will be represented as Text Strings as e.g. 2018-08-21
- if not explicitly specified, TRUE will always be assumed (default setting).
- colname_case (optional): this argument specifies if all column names should be considered uppercase or lowercase.
Valid settings are:- uppercase or upper: all column names will be fully capitalized.
- lowercase or lower: all column names will be full lowercase.
- samecase or same: all column names will be exactly preserved as they are defined into the DBF member.
- if not specified, or if any other definition definition is found, lowercase will always be assumed (default setting).
Note: any Text String, quoted or not, when it appears as a Virtual Table argument has the same effect.
SELECT CREATE VIRTUAL TABLE my_table USING VirtualDbf( /home/sandro/myshp , CP1252 , 1 , lower ); or SELECT CREATE VIRTUAL TABLE my_table USING VirtualDbf( '/home/sandro/myshp' , 'CP1252' , 1 , 'lower' );Both notations will produce the same result. |
Best practices and known limitations
Warning: VirtualDBF Tables are always subject to READ-ONLY restrictions. Any attempt to to execute an INSERT, UPDATE or DELETE statement will always return an error. |
Related Topics
|
VirtualText
The VirtualText Interface allows to directly access an external Text file by using standard Spatial SQL queries.The Text File is expected to contain a properly formatted Table accordingly to some Delimiter-Separated-Values format (comma separated values *.csv, tab separated values *.txt and alike).
Syntax for creating a VirtualText Table:
SELECT CREATE VIRTUAL TABLE my_table USING VirtualText ( textfile_path , charset_encoding ); SELECT CREATE VIRTUAL TABLE my_table USING VirtualText ( textfile_path , charset_encoding , first_row_as_titles ); SELECT CREATE VIRTUAL TABLE my_table USING VirtualText ( textfile_path , charset_encoding , first_row_as_titles , decimal_separator ); SELECT CREATE VIRTUAL TABLE my_table USING VirtualText ( textfile_path , charset_encoding , first_row_as_titles , decimal_separator , text_separator ); SELECT CREATE VIRTUAL TABLE my_table USING VirtualText ( textfile_path , charset_encoding , first_row_as_titles , decimal_separator , text_separator , field_separator );Supported arguments and their interpretation:
- textfile_path (mandatory): the relative or absolute pathname leading to the external Text file.
- Note: the full pathname must be passed, including an eventual final suffix (*.txt, *.csv and alike).
- charset_encoding (mandatory): canonical name of the charset encoding adopted by the Text file.
- Examples of valid names are: ASCII, UTF-8, CP850, CP1252, ISO-8849-1
- You can check the full list of supported charset encodings here.
- first_row_as_titles (optional): this is a BOOLEAN flag:
- if set to 0 (FALSE) all column names will be automatically set by using a progressive sequence.
- if set to any other integer value (TRUE) all column names will by expected to be defined in the very first row of the Text file.
- if not explicitly specified, TRUE will always be assumed (default setting).
- decimal_separator (optional): the character acting as a separator between the integer and decimal parts of a number.
Valid values are any printable character or the special mnemonic notations POINT or COMMA.
If not explicitly specified, POINT will always be assumed (default setting) - text_separator (optional): the character acting as a string delimiter.
Valid values are any printable character or the special mnemonic notations SINGLEQUOTE, DOUBLEQUOTE or NONE.
If not explicitly specified, DOUBLEQUOTE will always be assumed (default setting) - field_separator (optional): the character acting as a delimiter between consecutive fields.
Valid values are any printable character or the special mnemonic notations TAB.
If not explicitly specified, TAB will always be assumed (default setting)
Note: any Text String, quoted or not, when it appears as a Virtual Table argument has the same effect.
SELECT CREATE VIRTUAL TABLE my_table USING VirtualText( /home/sandro/myfile.txt , CP1252 , 1 , POINT , NONE , TAB ); or SELECT CREATE VIRTUAL TABLE my_table USING VirtualText( '/home/sandro/myfile.txt' , 'CP1252' , 1 , 'POINT' , 'NONE' , 'TAB' );Both notations will produce the same result. |
Best practices and known limitations
Warning: VirtualText Tables are always subject to READ-ONLY restrictions. Any attempt to to execute an INSERT, UPDATE or DELETE statement will always return an error. |
VirtualXL
The VirtualXL Interface allows to directly access an external MS Excel spreadsheet (Legacy binary format *.xls, i.e. not *.xlsm or 'LibreOffice Calc' *.ods files) by using standard Spatial SQL queries.Syntax for creating a VirtualXL Table:
SELECT CREATE VIRTUAL TABLE my_table USING VirtualXL ( xls_path ); SELECT CREATE VIRTUAL TABLE my_table USING VirtualXL ( xls_path , worksheet_index ); SELECT CREATE VIRTUAL TABLE my_table USING VirtualXL ( xls_path , worksheet_index , first_row_as_titles );Supported arguments and their interpretation:
- xls_path (mandatory): the relative or absolute pathname leading to the external MS Excel spreadsheet (old binary format *.xls).
- worksheet_index (optional): the index identifying one of the worksheets within the Excel document.
MS Excel may contain more than one worksheet, and each individual worksheet is identified by its own index (zero-based index; the first worksheet always has index=0).
If not explicitly specified the first worksheet will always be assumed (default value). - first_row_as_titles (optional): this is a BOOLEAN flag:
- if set to 0 (FALSE) all column names will be automatically set by using a progressive sequence.
- if set to any other integer value (TRUE) all column names will by expected to be defined in the very first row of the Spreadsheet.
- if not explicitly specified, TRUE will always be assumed (default setting).
Note: any Text String, quoted or not, when it appears as a Virtual Table argument has the same effect.
SELECT CREATE VIRTUAL TABLE my_table USING VirtualXL( /home/sandro/myspreadsheet.xls , 3, 1 ); or SELECT CREATE VIRTUAL TABLE my_table USING VirtualXL( '/home/sandro/myspreadsheet.xls' , 3, 1 );Both notations will produce the same result. |
Best practices and known limitations
Warning: VirtualXL Tables are always subject to READ-ONLY restrictions. Any attempt to to execute an INSERT, UPDATE or DELETE statement will always return an error. |
Related TopicsThe ImportXLS() SQL function allows to create and populate a genuine Database Table by importing an external MS Excel spreadsheet. |
VirtualFDO
The VirtualFDO Interface allows to directly access a Spatial Table containing FDO binary Geometries exactly as if was a SpatiaLite's own native Table.FDO is an alternative binary format for Geometries stored within a SQLite Database; you can eventually read the RFC 16 specification for more details.
Syntax for creating a VirtualFDO Table:
SELECT CREATE VIRTUAL TABLE my_table USING VirtualFdo ( table_name );Supported argument and its interpretation:
- table_name (mandatory): the name of the Table in the current Database containing one or more FDO Geometry Columns to be automatically translated to/from SpatiaLite's own native binary BLOB-format.
Note: any Text String, quoted or not, when it appears as a Virtual Table argument has the same effect.
SELECT CREATE VIRTUAL TABLE my_table USING VirtualFdo( my_parcels ); or SELECT CREATE VIRTUAL TABLE my_table USING VirtualFdo( 'my_parcels' );Both notations will produce the same result. |
Best practices and known limitations
Note: VirtualFDO Tables support unrestricted READ-WRITE operations, this including executing INSERT, UPDATE and DELETE statements. |
VirtualGPKG
The VirtualGPKG Interface allows to directly access Spatial Tables from a GeoPackage Database exactly as if was a SpatiaLite's own native Database.GeoPackage (aka GPKG) is an alternative Spatial Database built on the top of SQLite; you can eventually read the official specification for more details.
Syntax for creating a VirtualFDO Table:
SELECT CREATE VIRTUAL TABLE my_table USING VirtualGpkg ( table_name );Supported argument and its interpretation:
- table_name (mandatory): the name of the Table in the current Database containing one or more GPKG Geometry Columns to be automatically translated to/from SpatiaLite's own native binary BLOB-format.
Note: any Text String, quoted or not, when it appears as a Virtual Table argument has the same effect.
SELECT CREATE VIRTUAL TABLE my_table USING VirtualGpks( my_parcels ); or SELECT CREATE VIRTUAL TABLE my_table USING VirtualGpkg( 'my_parcels' );Both notations will produce the same result. |
Best practices and known limitations
Note: VirtualGPKG Tables support unrestricted READ-WRITE operations, this including executing INSERT, UPDATE and DELETE statements. |
back to main page