tools-4.0
Not logged in

Changes in GUI and CLI tools supporting version 4.0.0

Back to main page

Shapefile Import

Two brand new features are now supported when importing any Shapefile:
  • You can now explicitly specify the expected Geometry Type.
  • You can now explicitly choose the field/column to be used as a Primary Key.
  • The default behavior is unchanged: if you don't explicitly set the one or the other anything will work as before.
    i.e. the Geometry Type will be automatically detected.
    And the Primary Key will be named PK_UID, and will be of the INTEGER AUTOINCREMENT datatype.

Suggesting a Geometry Type: automatic detection of the actual Geometry Type corresponding to some Shapefile often requires a two-passes approach.
The Shapefile formant doesn't supports a clear distinction between Linestring/MultiLinestring and/or Polygon/MultiPolygon, so a preliminary scan is absolutely required in order to check the actual type of Geometries stored within the Shapefile to be imported.
If the user suggests a predefined Geometry Type the preliminary scan is no longer required: and for huge Shapefiles this could be a noticeable performance improvement.
On the other side, suggesting a mismatching Geometry Type will surely cause the import to abort (due to Geometry constraints violation).
shp_import
The same features are now supported by the spatialite CLI (command line) tool as well:
.loadshp <args>   Loads a SHAPEFILE into a SpatiaLite table
                  arg_list: shp_path table_name charset [SRID] [column_name]
                      [pk_column] [geom_type] [2d | 3d] [compressed]
                      [with_spatial_index]
                      geom_type={ AUTO | LINESTRING[ Z | M | ZM ]
                                 | MULTILINESTRING[ Z | M | ZM ]
                                 | POLYGON[ Z | M | ZM ]
                                 | MULTIPOLYGON[ Z | M | ZM ] }
e.g. in order to get the same settings exactly corresponding to the above shown GUI example you simply have to type the following dot command:
.loadshp F:/vanuatu/Istat2/com2011 com2011 CP1252 0 Geometry PRO_COM MULTIPOLYGON


DBF Import

The same feature (explicit Primary Key selection) is supported as well while importing any DBF.
Please notice the new updated import dialog supported by the spatialite GUI tool.
The spatialite CLI (command line) tool now supports the following syntax:
.loaddbf <args>   Loads a DBF into a SpatiaLite table
                  arg_list: dbf_path table_name charset [pk_column]


The SQL statements Log

Any DB adopting the most recent layout (i.e. being created by version 4.0.0) supports an SQL Log table; and quite obviously spatialite_gui effectively supports this cool new feature.
When the SQL Log is enabled any SQL statement issued by the user will be permanently recorded into the Log; and this one is a surely useful feature:
  • some smart user could easily retrieve (and eventually reuse yet again) any previously executed SQL statement, may well be one really complex and thus requiring patient care to be properly written and successfully debugged.
  • keeping a permanent trace of all relevant operations could surely help to fully document the whole process producing the current version of the target DB.

Anyway recording into the Log each single SQL statement being executed could be sometimes really annoying: so you can freely enable or disable the SQL Log at your will (enabled being the default action).
You simply have to click the corresponding button on the toolbar. The same feature is available on the Files menu as well.

Please note: spatialite_gui simply records into the SQL Log any SQL statement directly issued by the user; SQL statement implicitly executed by the GUI itself, or contained into SQL scripts are never recorded.
shp_import
The same identical SQL Log feature is now supported by the spatialite CLI (command line) tool as well.
When using the CLI tool all SQL Statements being executed are effectively recorded, even the ones eventually contained into some SQL script.

You can freely enable or disable the SQL Log by invoking the following dot command aka macro:
.sqllog ON|OFF    Turn SQL Log on or off

Please note: by default the SQL Log is always enabled; you can eventually disable it by explicitly invoking .sqllog OFF

You can learn more technical details about SQL Log by reading this Wiki page



ATTACH / DETACH DATABASE

The most recent version of spatialite_gui now directly supports ATTACH / DETACH DATABASE statements.
You simply have to click the corresponding button on the toolbar, and a standard file selection dialog will allow you to select the required DB to be attached.

Then the attached DB (and any table it contains) will immediately appear as a node into the Tables Tree control.
shp_import
Detaching a DB is now an absolutely plain task; you simply have to perform a right click on the corresponding Tables Tree node, so to make the context menu to appear; then duly clicking Detach Database. shp_import



Back to main page