[GIS] Failed connection with .sqlite file in QGIS converted from osm by spatialite

qgisspatialite

I have converted a *.osm file to a *.sqlite file using the spatialite_tool i.e sspatialite_osm_map..

Now I want to view the map using QGIS. However, at the time of using the add spatialite table option I am getting an error:

Failure while connecting .sqlite file – seems to be a valid SQLite DB,
but not a SpatiaLite one …

Best Answer

The spatialite OSM tools write to a spatialite v4 database. Unfortunately, QGIS 1.8.0 is not able to read this database version.

You can try spatialite_convert from this page to convert the database back to v3, which should be readable with QGIS.

See also

Can't open Spatialite db from openstreetmap in Quantum GIS

Why are layers imported into a DB with Spatialite-Gui locked from editing?

https://www.gaia-gis.it/fossil/libspatialite/wiki?name=switching-to-4.0

Related Question