The SpatiaLite extension enables SQLite to support spatial data too (aka GIS), in a way conformant to OpenGis specifications
The VirtualShape extension enables SQLite to access shapefiles as VIRTUAL TABLEs
The VirtualText extension enables SQLite to access CSV/TxtTab files as VIRTUAL TABLEs
JMN 2009-11-07 Looks interesting - but I see no reference to Tcl on the site. I'm assuming by 'extension' this refers only to it being an extension to SQLite, and that there is no Tcl interface?
SEH -- Spatialite is an extension to SQLite, and thus the Tcl binding to SQLite can be used to access Spatialite's features.
TR --This works (using sqlite 3.3.7 or newer):
package require sqlite3 sqlite3 db someDBfile.db db enable_load_extension true db eval {select load_extension('/path/to/spatialsqlite/libraryfile')}
andrewsh On Debian, the following works fine:
db eval {select load_extension("libspatialite.so.2")}
Harm Olthof: using tdbc it works like this:
package require tdbc::sqlite3 set db_path {/path/to/sqlitefile.sqlite} tdbc::sqlite3::connection create db $db_path set db_handle [db getDBhandle] $db_handle enable_load_extension 1 # The directory containing dll's for geos, proj4, etc must be added to the PATH environment append ::env(PATH) {;} {D:\pshare\bin\spatialite\bin\spatialite-3.0.1-DLL-win-x86} db allrows {SELECT load_extension('/path/to/spatialsqlite/libraryfile')}
and if it's a new or non-spatialite database file, you should initialize it:
db allrows {SELECT InitSpatialMetaData()}
pd Dynamically loading SpatiaLite No longer requires extension dll - same code will work on windows as *nix
package require sqlite3 sqlite3 db :memory: db enable_load_extension true db eval "SELECT load_extension('mod_spatialite')" db eval "Select InitSpatialMetaData()" db eval "CREATE table hal (id integer)" db eval "SELECT AddGeometryColumn('hal','geometry',0,'LINESTRING','XY')" db eval "SELECT CreateSpatialIndex('hal','geometry')"