Participatory GIS and Mobile Field Sync for Heritage Projects

Modern excavation and survey teams no longer record features on paper and transcribe them at the end of the day. They capture geometry and attributes directly on tablets in the trench, often with volunteers and community participants working alongside professional staff, then reconcile every device’s edits into a single authoritative store overnight. This shift toward participatory GIS and offline-first mobile capture is powerful, but it introduces failure modes that desktop-only workflows never encounter: divergent copies of the same layer, silent attribute-form mismatches, conflicting edits to the same feature from two collectors, and provenance that evaporates the moment a delta is flattened into the master table. This section of Heritage GIS Architecture & Fundamentals is the field-to-archive playbook for building that pipeline so it is reproducible, auditable, and defensible.

The two dominant toolchains here are QField with QFieldSync (a headless-scriptable QGIS packaging and reimport cycle) and Mergin Maps (a hosted delta-synchronisation service built on GeoPackage and the geodiff change engine). Both let you scope which layers, attributes, and forms reach the device, both work fully offline, and both give you back a change set rather than a whole new dataset. What differs is the synchronisation model and where conflicts surface. This overview frames the decisions; the four guides below implement them end to end: packaging offline field projects with QFieldSync, resolving Mergin Maps delta-sync conflicts, merging field audit trails into the master database, and comparing GeoPackage and PostGIS for field-to-archive handoff.

Participatory field capture and sync pipeline A master PostGIS store is packaged to devices, edited offline by field teams, then synchronised back through conflict detection into an audited master. Field-to-archive sync loop Master store PostGIS / GPKG Package offline project Capture devices, offline volunteers Sync + merge delta, conflict, audit reconciled edits flow back to the master

Prerequisites

Library / tool Version Purpose
QGIS (PyQGIS) 3.34 LTR Headless project packaging and layer/form definition
qfieldsync plugin 4.8.0 Offline packaging, base-map generation, device export/import
mergin-client 0.9.2 Python client for Mergin Maps pull/push/conflict handling
geodiff 2.0.2 Binary change engine backing GeoPackage delta sync
GDAL/OGR 3.8.4 ogr2ogr conversions between GeoPackage and PostGIS
PostgreSQL / PostGIS 16 / 3.4 Concurrent multi-user master store and audit triggers
psycopg 3.1.18 Python driver for appending device edits into PostGIS

Assume a target CRS of EPSG:27700 (British National Grid) throughout; substitute your site’s EPSG. Field teams need write access to a synchronisation endpoint (a Mergin workspace or a shared package drop), and the master store lives on a server the archive maintainer controls. Volunteers should never hold credentials to the master database directly — they sync to a mediated layer only.

Implementation

1. Define the master schema with sync-safe identifiers

Before anything reaches a device, every editable layer needs a stable, globally unique feature identifier that survives a round trip. Auto-incrementing integer primary keys collide the moment two devices each insert “feature 501”. Add a UUID column and treat it as the sync key.

-- PostgreSQL 16 / PostGIS 3.4
CREATE EXTENSION IF NOT EXISTS "pgcrypto";

CREATE TABLE finds (
    fid          bigserial PRIMARY KEY,        -- local db key, never synced across devices
    uuid         uuid NOT NULL DEFAULT gen_random_uuid() UNIQUE,
    site_id      text NOT NULL,
    feature_type text,
    collector_id text,
    recorded_at  timestamptz,
    geom         geometry(Point, 27700)        -- substitute your site's EPSG
);
CREATE INDEX finds_geom_gix ON finds USING GIST (geom);

2. Package the offline project

Scope the device project to only the layers, attributes, and forms a collector needs, generate an offline copy, and bake in a base map so the tablet works with no signal. This is fully scriptable through PyQGIS and qfieldsync; the full headless routine is in packaging offline field projects with QFieldSync.

# requirements.txt
# run inside the QGIS 3.34 Python environment
# qfieldsync==4.8.0
# PyQGIS 3.34 — invoke via qgis_process or the QGIS Python console
from qgis.core import QgsProject
from qfieldsync.core.offline_converter import OfflineConverter
from qfieldsync.core.project import ProjectConfiguration

project = QgsProject.instance()
project.read("/data/site/master.qgz")
cfg = ProjectConfiguration(project)
cfg.offline_copy_only_aoi = True          # clip to the area of interest polygon
# remaining packaging parameters covered in the QFieldSync guide

3. Capture in the field, offline

Collectors edit the packaged GeoPackage on the device. QField and Mergin Maps both record every insert, update, and delete as a change against the packaged baseline rather than rewriting the layer, which is what makes a small, reviewable delta possible on sync. Attribute forms carry the discipline here: constrain categorical fields to value maps, make the mandatory provenance fields non-nullable on the form itself, and default the collector identity from the device profile so a volunteer cannot forget to record who they are. A well-scoped form is the cheapest quality control you will ever deploy, because it prevents bad data at the point of capture instead of quarantining it three steps downstream.

The practical decision between the two toolchains comes down to connectivity and team topology. QField with a manual QFieldSync round trip suits teams that return to a base each evening and reconcile in a controlled office session, with no hosted service to pay for or administer. Mergin Maps suits distributed teams that sync opportunistically over patchy mobile data throughout the day and want change-level history brokered automatically. Both leave you with the same obligation: the delta must be validated and stamped before it touches the archive.

4. Synchronise deltas and detect conflicts

On return to connectivity, each device pushes its change set. With Mergin Maps the mergin-client library performs the pull then push, and any edit that lost a race with the server is written to a *_conflict_* copy for you to resolve deterministically. That resolution logic is the subject of resolving Mergin Maps delta-sync conflicts.

5. Merge into the audited master

Finally, the reconciled device edits are appended to the master PostGIS store, stamped with editor, timestamp, and provenance, and captured by a trigger-based audit log so every archived feature can be traced to the person and device that recorded it. The append-and-reconcile SQL and Python is in merging field audit trails into the master database.

CRS & Geometry Validation

Offline packaging is where CRS drift most often creeps in. QField will happily display a layer in the project CRS while the device GPS delivers EPSG:4326; if the layer geometry column is declared as EPSG:27700 the on-the-fly transform is applied on capture, but a mislabelled layer stores raw degrees as if they were metres. Validate on reimport before you trust anything:

-- PostgreSQL 16 / PostGIS 3.4
-- catch coordinates that are plausibly lat/lon sitting in a metric column
SELECT uuid, ST_X(geom) AS x, ST_Y(geom) AS y
FROM finds
WHERE ST_SRID(geom) = 27700
  AND ABS(ST_X(geom)) < 1000 AND ABS(ST_Y(geom)) < 1000;

Any row returned means a feature holds single- or double-digit “metre” coordinates — almost certainly ungrounded degrees. Reproject the source and reload. For the transform quality itself, a Helmert-based datum shift for EPSG:27700 should stay within its published accuracy; residuals above roughly 0.5m0.5\,\text{m} against a known control point signal the wrong transformation pipeline was selected.

Automated QA/QC

Gate every sync before promotion to the archive. A device change set is promoted only if it passes: schema conformance (no unexpected columns from an out-of-date form), UUID uniqueness against the master, geometry validity (ST_IsValid), CRS match, and controlled-vocabulary checks on categorical fields. Route failures to a quarantine table keyed by device and sync timestamp rather than rejecting the whole batch — one bad find should not block a day’s legitimate records. Record each promotion decision (accepted / quarantined / conflict-held) in the audit log so the archive maintainer can reconstruct exactly which edits entered the master and when.

The gate should also reconcile the shape of the incoming form against the master schema, because the most common silent corruption is a stale device: a tablet packaged three weeks ago still carries the old form, so a field renamed in the master arrives under its former name and is dropped on load without warning. Compare the incoming column set against the expected schema and fail loudly on any mismatch rather than coercing it away. Treat form-version skew as a first-class error class, version your form definitions, and refuse a sync from a device whose form predates the current schema so no edit is quietly discarded on the way into the archive.

Field note. Volunteer-captured points cluster suspiciously around the site hut and the coffee area — devices left recording while idle log a stream of near-duplicate positions. Always package a "recording paused by default" form and validate for duplicate geometries within a small radius (say 0.3 m) on reimport, or your artefact-density surface will show a phantom hotspot exactly where nobody was digging.

Integration with adjacent workflows

The sync-safe schema you define here should be scoped during Project Scoping & Data Governance, where coordinate precision, controlled vocabularies, and role assignments are fixed before a single device is provisioned. The provenance and identifier fields you carry through every delta must satisfy the documentation requirements set out in Metadata Standards for Archaeological Data, so that a synced find arrives archive-ready rather than needing retrospective enrichment. Downstream, the reconciled master feeds artefact-distribution and stratigraphic analysis in the spatial database design workflows.

Troubleshooting

  • qgis.core.QgsOfflineEditing reports “Could not create offline copy” — the layer has no primary key OGR can use; add the UUID column and set it as the feature ID before packaging.
  • Mergin push fails with You do not have permission to access this project — the device is authenticated as a volunteer with read-only workspace role; grant writer on the mediated project, never on the master.
  • geodiff aborts with GEODIFF ERROR: geometry type mismatch — the device form allowed a MultiPoint where the schema expects Point; force single-part geometry in the layer definition and re-package.
  • Reimported features silently overwrite newer master edits — the merge used fid instead of uuid as the key; always join on the UUID sync key.
  • ST_SRID returns 0 after import — the GeoPackage layer was created without an assigned CRS; run ogr2ogr -a_srs EPSG:27700 to stamp it before load.

Compliance notes

Every synced feature must carry the provenance fields that heritage documentation standards require: an originator (collector_id mapped to a real person or team), an acquisition date (recorded_at), a collection method, and a positional accuracy statement. Under MIDAS Heritage these map to the recorder and event-date elements; under ISO 19115 they populate the lineage and data-quality sections; and the UUID sync key gives each record the stable, globally resolvable identifier that FAIR principles expect. Retain the raw device change sets alongside the merged master — the delta is the audit evidence that the archived geometry is what the collector actually recorded.

Part of Heritage GIS Architecture & Fundamentals.