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

Andreas Neumann a.neumann at carto.net
Wed Sep 7 11:05:50 EDT 2011


 HI Jukka,

 Thank you for your thoughts. Yes, perhaps I should use update instead 
 of append.

 I actually found out what the problem is:

 Tables or views that do not have an entry in public.geometry_columns 
 (the postgis metadata table) cause the segmentation fault. Once the 
 entry is there, it converts fine.

 Perhaps ogr2ogr could issue a warning or error message in this case 
 instead of segfaulting. It would be nicer.

 Thanks again,
 Andreas

 On Wed, 7 Sep 2011 14:52:31 +0000 (UTC), Jukka Rahkonen wrote:
> 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-
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
 --
 Andreas Neumann
 Böschacherstrasse 10A
 8624 Grüt (Gossau ZH)
 Switzerland


More information about the gdal-dev mailing list