[gdal-dev] How to recognize FDO style SQLite db?

Even Rouault even.rouault at spatialys.com
Fri May 27 05:40:28 PDT 2016


On Friday 27 May 2016 12:09:42 Jukka Rahkonen wrote:
> Hi,
> 
> User in gis.stackoverflow tried to use SQL "select ST_Union(geometry)" for
> the Natural Earth SQLite db file from
> http://naciscdn.org/naturalearth/packages/natural_earth_vector.sqlite.zip.
> 
> The query yields an empty geometry because the NE database is written with
> FDO geometries instead of SpatiaLite geometries. What I wonder is that does
> GDAL user have any simple mean for getting informed if SQLite db is FDO or
> Spatialite.

This probably doesn't completely fullfil the requirement of "simple mean" ;-), 
but if you enable the debug messages from GDAL with "--debug on", you should 
see :
"OGR style SQLite DB found !"

whereas a Spatialite one will trigger :
"SpatiaLite v4 DB found !" (or "Spatialite DB found" for spatialite 2 or 3)

> If SpatiaLite is present a clever enough user can use ogrinfo
> and check from
> https://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html#p16fdo that
> value 2 is returned in case when "both tables exist, and their layout is the
> one used by FDO/OGR"
> 
> ogrinfo -sql "select CheckSpatialMetaData()"
> natural_earth_vector.sqlite
> INFO: Open of `natural_earth_vector.sqlite'
>       using driver `SQLite' successful.
> 
> Layer name: SELECT
> Geometry: None
> Feature Count: 1
> Layer SRS WKT:
> (unknown)
> CheckSpatialMetaData(): Integer (0.0)
> OGRFeature(SELECT):0
>   CheckSpatialMetaData() (Integer) = 2
> 
> 
> However, the one who knows to do that must be somewhat advanced GDAL and
> Spatialite user.
> 
> -Jukka Rahkonen-
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list