50

I am using now QGIS 2.18, which includes support for GeoPackage format.

I know that GeoPackage is like a replacement for Shapefile but not quite so, as GeoPackage has database capabilities. At same time, GeoPackage isn't a full replacement for SpatiaLite, because it doesn't have spatial queries and functions. Also, Spatialite supports GeoPackage.

So, in the context of QGIS editing, when does it make sense to use GeoPackage (and access GeoPackage from SpatiaLite for Spatial SQL tasks), and when is better to use just Spatialite?

5
  • 3
    I am interested in this question, too. Keep in mind that geopackage-support is currently limited due to a locking bug after the first edit.
    – hilpers
    Commented Feb 13, 2017 at 13:19
  • But this was solved already?! Did not encouter Problems with the 2.18.
    – Matte
    Commented Feb 13, 2017 at 15:16
  • Unfortunately, I do using 2.18.3
    – hilpers
    Commented Feb 13, 2017 at 21:07
  • I did test it with 2.18.3 with the procedure written in the old bug tracker and could not reproduce it. In what circumstances you got the problem?
    – Matte
    Commented Feb 14, 2017 at 7:13
  • I also experience the locking bug after the first edit with GeoPackage but only when I use the new DWG/DXF import in 2.18.3. I can successfully import the DWG and initially edit the GeoPackage created (e.g., to georeference it with Vector Bender plugin). But once I close the QGIS project and reopen the toggle editing button is greyed out and GeoPackage can not be edited again. Commented Feb 24, 2017 at 16:50

1 Answer 1

44

A small comparison between GeoPackage and SpatiaLite in QGIS. Right to the moment it is not really productive to use GeoPackage with QGIS. May change pretty fast though (see addtions!).

Some additions regarding new QGIS 2.99 alias QGIS 3, Nov. 2017 (also added in comparison): GeoPackage now works nearly without any problems in QGIS 3. Did encounter some minor issues that may regard to QGIS developer version. Also the most problematic issue for SpatiaLite is solved. Columns can be deleted now without any additional workarounds. Both still does not support raster writing via the GUI which is not a big issue as rasters in a database is not the main intention. Both formats are a really good working formats. The focus for GeoPackage is transport-format and for SpatiaLite an easy file based database system with many tools for building a local data storage (as it is more of a RDBMS than file-format).

Both have:

  1. transactional
  2. SQL and views (but views are differently implemented in the using software)
  3. "all in one" vector-layers, symbology and text, raster
  4. attribut-tables with nearly no restrictions compared to shapefile
  5. do need a VACUUM from time to time (database specific data storage)
  6. most geometry types (like curves)

GeoPackage:

  1. is a OGC standard based on SQLite, means the implementation should be more consistent in different software; for example the symbology might work in QGIS and ArcMap in the future when SLD-Styles are used
  2. pretty young (2014), quite some problems with it in QGIS up to 2.18 (update: good support in QGIS 3)
  3. allows easy removal of columns in QGIS for "normal" users opposing SpatiaLite
  4. right now DB-Manager does not work very well with it and raster support is limited to reading a single integrated raster (no writing into it) (using QGIS 2.18.3) (update: DB-Manager works now good with geopackage)
  5. views not working in QGIS, but via virtual-layer not too much of a problem when not used for sharing between many users (update: still no views as QGIS 3 can actually create views but can´t read them afterwards)
  6. geoprocessing tools does not allow appending to existing file (only replaces the whole file) (update: works now)

SpatiaLite:

  1. is an extension to SQLite, differently implemented in GI-software (mostly due to driver and version issues)
  2. much older and up to now better integrated into QGIS
  3. in QGIS you can´t delete columns without a SQL-Query that is not complicated, but for some users already too much "code" (update: QGIS 3 does this now)
  4. pretty big file when only having a hand full of geometries, not quite good as transport format but for local database storage (it starts with something around 5MB)
  5. Lots of additional tools (views, may create road networks, many import/export formats, ST_Queries and more)
6
  • Do you plan to use GeoPackage or SpatiaLite only with QGIS, or with other software as well? SpatiaLite also supports all this gaia-gis.it/gaia-sins/spatialite-sql-latest.html standalone without QGIS.
    – user30184
    Commented Feb 13, 2017 at 17:59
  • I use mostly SpatiaLite together with QGIS, but also with the SpatiaLite-GUI. I do introduce it in my training courses for QGIS. The only point there is the problem of deleting columns for the beginners. I do not introduce it in the ArcGIS trainings as they have the FileGeodatabase there that is in some authorities mandatory (in the 10% where it is not the shapefile that is still state of the art...). I started to announce GeoPackage in the advanced QGIS courses, but with the draw backs written above. But as GDAL has a good implementation, it can´t be long until QGIS has the needed buttons.
    – Matte
    Commented Feb 14, 2017 at 7:08
  • As you tell, your comparison is about QGIS usage. I would like to emphasize that judging if SpatiaLite or GeoPackage is better by the "drop column" case is very QGIS specific. SQLite itself does not support this operation directly sqlite.org/lang_altertable.html. Same workarounds work for both SpatiaLite and GeoPackage even some software may miss the buttons.
    – user30184
    Commented Feb 14, 2017 at 9:17
  • 1
    I put it into the context of the original question where it was about QGIS. The point with the column was one example where i hope the standard will lead to more consistent use in programs as this is a topic for the "normal" user. Not sure if this will be possible with SpatiaLite as the level of integration is so different even after several years. In the end for me it will lead to the point where it might be a new standardized transport format (GeoPackage). SpatiaLite is much more like a GIS with its built in functions (ST-Queries, lots of data import options, network...).
    – Matte
    Commented Feb 14, 2017 at 9:37
  • Both, GeoPackage and SpatiaLite are SQLite based. Commented Apr 5, 2018 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.