[gdal-dev] Export from PG to spatialite

aperi2007 aperi2007 at gmail.com
Sat Dec 31 07:18:54 EST 2011


Hi,

I'm try to export from Postgres 9.1.2 with Postgis 2.0 to a spatialite 
3.0.0 version using ogr2ogr.exe.
To do this I try this sintax:

ogr2ogr.exe --config PG_LIST_ALL_TABLES YES --config PG_SKIP_VIEWS YES 
-f "SQLite" db.sqlite -progress PG:"dbname='test' active_schema=work 
schemas=work,public host='localhost' port='5432' user='postgres' 
password='postgres' " -overwrite -lco GEOMETRY_NAME=geom -dsco 
SPATIALITE=yes -lco SPATIAL_INDEX=yes -gt 65536  -sql "select * from 
work.table1" -nln table1

Ogr2ogr regularly export it on a new created file named db.sqlite,
and create a table in it named "table1",

but this table1 don't have a geometry column named "geom" as I try ask using
-lco GEOMETRY:NAME=geom
instead has a field named "Geometry" and with "G" uppercase.
So I guess the
GEOMETRY_NAME seem don't work .

Another think I notice is that the geometry field seem to have no a 
declared geometrytype.

Infact try-ing to export table1 which has a POINT geometrytype.
After exported in the spatialite it don't has a cleared geometrytype,
and qgis is not able to open it.

I guess surely miss something parameter.

Thx,

Andrea


More information about the gdal-dev mailing list