[gdal-dev] ogr2ogr and spatialite

Even Rouault even.rouault at mines-paris.org
Tue Apr 19 07:53:29 EDT 2011


Selon iomeneandrei <aborruso at tin.it>:

> Dear all,
> I'm using ogr2ogr (GDAL 1.8.0) to import a shapefile in a spatialite db.
>
> If I use spatialite gui to make it (without check "with spatial index"
> option), I have only a new one table in my sqlite db.
>
> If I use ogr2ogr "ogr2ogr -append -s_srs EPSG:3004 -t_srs EPSG:3004 -f
> SQLite -dsco SPATIALITE=NO db.sqlite input.shp", I have as output also the
> spatial index tables. Is it normal?
> Is it possible to use ogr2ogr without have in the db the spatial index
> tables?

I'm a bit confused by what you are trying to do, probably because I'm at the
right side of the wire ;-).

Well if I've well understood, before running ogr2ogr, the db.sqlite file is a
file created by spatiliate gui, right ?

ok, then, as the output dataset of ogr2ogr is already existing, dataset creation
options ( specified with -dsco ) have of course no effect and I'm not sure why
you specified it if your database is already spatialite ... It can't "revert" a
spatialite database into a "regular" sqlite one.

Now, as indicated in http://gdal.org/ogr/drv_sqlite.html, the creation of
spatial index for spatialite databases depends on the value of the SPATIAL_INDEX
*layer* creation option (so specificed with -lco), and when not specified, it
defaults to YES.

So try replacing -dsco SPATIALITE=NO with -lco SPATIAL_INDEX=NO

>
> Best regards,
>
> Andrea
>
> -----
> Andrea Borruso
>
> ----------------------------------------------------
> email: aborruso at tin.it
> website: http://blog.spaziogis.it
> my 2.0 life: http://aborruso.spaziogis.it
> feed: http://feeds2.feedburner.com/Tanto
> 38° 7' 48" N, 13° 21' 9" E
> ----------------------------------------------------
> --
> View this message in context:
>
http://osgeo-org.1803224.n2.nabble.com/ogr2ogr-and-spatialite-tp6286920p6286920.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>




More information about the gdal-dev mailing list