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

Jukka Rahkonen jukka.rahkonen at maanmittauslaitos.fi
Fri May 27 05:09:42 PDT 2016


User in gis.stackoverflow tried to use SQL "select ST_Union(geometry)" for
the Natural Earth SQLite db file from

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. 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()"  
INFO: Open of `natural_earth_vector.sqlite'
      using driver `SQLite' successful.

Layer name: SELECT
Geometry: None
Feature Count: 1
Layer SRS WKT:
CheckSpatialMetaData(): Integer (0.0)
  CheckSpatialMetaData() (Integer) = 2

However, the one who knows to do that must be somewhat advanced GDAL and
Spatialite user.

-Jukka Rahkonen-

More information about the gdal-dev mailing list