SQLite / SpatiaLite driver in GDAL / OGR

721 views
Skip to first unread message

BME

unread,
Aug 19, 2009, 9:01:29 AM8/19/09
to SpatiaLite Users
Based on the following documentation:

http://gdal.org/ogr/drv_sqlite.html

It is my understanding that SpatiaLite support is only availbale
starting with the GDAL 1.7.0 version which is still under development.
Has anyone had any luck testing this on Windows? If so, could you
please describe the installation procedure. This is probably a more
appropriate question for the GDAL group, but I thought I would give
the SpatiaLite group a try.

Alex Mandel

unread,
Aug 19, 2009, 5:42:24 PM8/19/09
to spatiali...@googlegroups.com

Sorta, yes for full support of the spatialite method of data storage I
believe 1.7 is what you will need. However, recent versions of
spatialite allow you to store the data in a OGR compatible form which
should already be supported. And as a 3rd method you can always keep a
wkt column handy which is updated from the blob spatial field with a
quick update query.

Alex

Kev

unread,
Aug 23, 2009, 4:54:17 PM8/23/09
to SpatiaLite Users
Hi,

Yes i have managed to use the ogr/gdal 1.7.0 stuff on windows to
convert a PostGIS database into a SpatiaLite database. The versions of
the gdal libraries made available in the latest fwtools are built with
SpatiaLite support for writing databases but dont seem to be linked
explicitly against libspatialite2.dll meaning you can't use the gdal
driver on windows to access spatialite functions directly (but you can
use spatialite itself for that)

Cheers,
Kev.

BME

unread,
Aug 24, 2009, 4:47:18 PM8/24/09
to SpatiaLite Users
Thanks for the responses.

Through trial and tribulation I think that the easiest way to get
SpatiaLite support via GDAL/OGR is by installing ms4w. I have had the
most success with v3.0 Beta 6, which comes with GDAL 1.7.0dev. As an
added bonus, installing additional plugins (ex. gdal_SDE, ogr_SDE) is
as simple as moving the desired dlls from the ms4w\gdalplugins\ignored
directory to ms4w\gdalplugins. I have been experimenting with ArcSDE
(v9.2 on Oracle 10g with SDE binary geometry storage) to SpatiaLite
conversion with commands like:

ogr2ogr -f "SQLite" db.sqlite SDE:"server,instance,db,user,password" -
sql "SELECT * FROM usr.table alias WHERE blah blah" -a_srs "EPSG:
32188" -nlt MULTIPOLYGON -dsco FORMAT=SPATIALITE -dsco SPATIALITE=YES

Does anyone know how you can write multiple datasets to the same
SQLite db - either through single or multiple commands? I keep getting
the following error when trying to write a second dataset into an
existing SQLite db:

"It seems a file object called 'YourSQLiteDB' already exists."

I am also having problems converting data (from various formats) that
have contain non-ascii characters such as (é, ô, à etc.) using OGR.
This doesn't seem to be a SpatiaLite issue as the shapefile loader in
the SpatiaLite GUI handles the non-ascii characters without issue as
long as my default output charset is a charset that supports accented
characters. Does anyone have advice for dealing with non-ascii
characters in OGR?
Reply all
Reply to author
Forward
0 new messages