Thursday, 1 October 2015

qgis - Using GeoPackage instead of SpatiaLite, and vice-versa?


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?



Answer



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)


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...