[gdal-dev] Re: Problem converting certain postgis tables to spatialite

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Wed Sep 7 10:52:31 EDT 2011


Andreas Neumann <a.neumann <at> carto.net> writes:

> 
>  Hi,
> 
>  I am converting several tables from Postgis to SpatiaLite using 
>  ogr2ogr.
> 
>  Here is my command:
> 
>  -----------
>  ogr2ogr -append -lco LAUNDER=yes -lco SPATIAL_INDEX=yes -nln 
>  av_grenzpunkte -f SQLite uster.sqlite PG:"dbname='mydb' host='myserver' 
>  port='5432' user='username' password='pw' schemas=av_user 
>  tables=grenzpunkte(the_geom)"
>  ----------

Hi,

I have used these options:

-dsco SPATIALITE=yes
-lco SPATIAL_INDEX=no
and for polygon layers
-nlt MULTIPOLYGON (Spatialite do not want polygons and multipolygons on the same
layer, so let them be all multipolygons). Same with mixed lines/multilines if
you may have those.

-update is needed when adding new layers. Are you adding to an existing table
because you have -append?

Ogr2ogr does not create totally valid Spatialite databases. Therefore I skip the
SPATIAL_INDEX because conversion is faster without. After ogr2ogr process I am
cleaning the resulting database by copying the tables into a fresh Spatialite
database with OpenLite tool http://www.gaia-gis.it/OpenLite/

-Jukka Rahkonen-



More information about the gdal-dev mailing list