29.2.4. Offline Editing Plugin

For data collection, it is a common situation to work with a laptop or a cell phone offline in the field. Upon returning to the network, the changes need to be synchronized with the master datasource (e.g., a PostGIS database). If several persons are working simultaneously on the same datasets, it is difficult to merge the edits by hand, even if people don’t change the same features.

The offlineEditingCopy Offline Editing Plugin automates the synchronisation by copying the content of the datasource to a SpatiaLite or GeoPackage database and storing the offline edits to dedicated tables. After being connected to the network again, it is possible to apply the offline edits to the master dataset.

To use the plugin:

  1. Open a project with some vector layers (e.g., from an Esri Shapefile, PostGIS or WFS-T datasource).

  2. Assuming you have already enabled the plugin (see Core and External plugins) go to Database ► Offline Editing ► offlineEditingCopy Convert to offline project. The eponym dialog opens.

  3. Select the Storage type. It can be of GeoPackage or SpatiaLite database type.

  4. Use the Browse button to indicate the location of the database in which to store the Offline data. It can be an existing file or one to create.

  5. In the Select remote layers section, check the layers you’d like to save. The content of the layers is saved to database tables.

    Note

    Since target database formats do not have native list support, the offline editing plugin transforms {string, number} list fields into string fields where values are separated by commas. This allows reading and edit of the contents of those fields when offline.

    If you would like to handle both the field from the original layer and the offline layer, you can rely on the try() and array expression functions, e.g.:

    try(array_contains("field",1),array_contains(string_to_array("field"),1))
    
  6. You can check checkbox Only synchronize selected features if a selection is present allowing to only save and work on a subset. It can be invaluable in case of large layers.

    This is all!

  7. Save your project and bring it on the field.

  8. Edit the layers offline.

  9. After being connected again, upload the changes using Database ► Offline Editing ► offlineEditingSync Synchronize.

Note

Layers that are used offline are marked with the indicatorOffline icon in the Layers panel.

../../../../_images/create_offline_project.png

Fig. 29.13 Create an offline project