I'm having issues with a .sqlite database that I generate from PostGIS using ogr2ogr. The data appears to export into SQLite properly, and it loads in TileMill fine, but when I try to add any of the layers in QGIS it tells me:

Invalid layer. <layer name> is an invalid layer and cannot be loaded.

I was thinking that maybe my version of QGIS is running a slightly older version of SpatiaLite, so I decided to try exporting the data to a different version of SpatiaLite database. Is this an option in ogr2ogr?

  • 1
    You can check if indeed the problem is with the Spatilite version by converting your .sqlite database to version 3 after the export. You would use the spatialite_convert tool: spatialite_convert -v 3 -d your.sqlite If that does open in QGIS then you have a newer GDAL (ogr2ogr) which is building a version 4 spatialite database - not readable by QGIS 1.8.0. – Micha Sep 20 '13 at 12:23
  • Thank you for the advice. I discovered that my issue was that the data didn't have an SRID specified. Once I fixed that in PostGIS, the SQLite export opened fine in QGIS. – Tanner Sep 20 '13 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.