QGIS – Difference Between SQLite and SpatiaLite Export Formats

file formatsqgisspatialitesqlite

When exoprting data in QGIS, I can choose between SpatiaLite and SQLite files. Both files get the file extension .sqlite.

What is the difference between these export formats?
Is it a different data structure or something? How does someone else know, whether I am providing a SpatiaLite or a SQLite file? Are there any differences in compatibility or performance?

Googling the difference only gives confusing answers that SpatiaLite is a spatial extension to SQLite. But why then can I export spatial content to a SQLite file?

Best Answer

The GDAL driver page gives rather good explanation https://gdal.org/drivers/vector/sqlite.html. SQLite database gives the platform and there are different ways to store geospatial data into SQLite database. SpatiaLite is one solution, GeoPackage another one. What QGIS calls just .sqlite and GDAL as Regulas SQLite database https://gdal.org/drivers/vector/sqlite.html#regular-sqlite-databases is a third variant. There are more, for example MBTiles.

The one who receives a .sqlite database can distinguish "Regular SQLite", SpatiaLite, and GeoPackage by checking the structure of the database. Each format use different supporting metadata tables. GDAL, QGIS, ESRI etc. have internal methods for that so normally users do not need to bother.

Related Question