Writes the GeoPackage Mergin Maps appends a track to when a field crew stops recording. The schema is fixed by the app, not a choice: the QGIS plugin creates exactly this and the mobile app writes to exactly this.
Arguments
- path
Character. Where to write the GeoPackage. Convention is
tracking_layer.gpkgat the project root - not underbackground_layers/, because the app looks for it beside the.qgs.- overwrite
Logical. Replace an existing file. Default
FALSE, because a tracking layer that already exists holds field data.
Details
| file / table | tracking_layer.gpkg / tracking_layer, at the project root |
| geometry | LineStringZM, EPSG:4326 |
| fields | tracking_start_time, tracking_end_time, total_distance, tracked_by |
Per vertex you get X, Y, Z and M and nothing else. Z is ellipsoidal
altitude; M is the UTC timestamp in Unix epoch seconds. There is no
accuracy, speed, bearing or satellite count. A track is therefore a line whose
nodes each carry a time - recover it with datetime_from_epoch(m * 1000).
One feature per session, appended once when the user taps Stop. There is no periodic flush, so a crash before Stop loses the whole session (mobile#3555).
Two deliberate differences from what the plugin writes
Both were measured against a layer the plugin made
(hornby_2026/tracking_layer.gpkg, 5 recorded sessions), and both are
improvements rather than drift:
The
gpkg_contentsbounding box is left NULL, where the plugin writes0,0,1,1. That is a placeholder it never updates - hornby still carries it after 5 real tracks - and it is a wrong claim about where the layer is, in the one place a reader consults for an extent without scanning. Zoom-to-layer honours it and lands in the Gulf of Guinea. Same rule as a form shipping with no seeded extent (#49).The
geomcolumn's declared type isGEOMETRY, where the plugin declaresLINESTRING.gpkg_geometry_columnsis the authority and carriesLINESTRINGwithz = 1, m = 1either way; 9 of 13 rfp-written layers in a real project declareGEOMETRYand all render correctly. Changing it would mean rebuilding the table, which destroys the rtree spatial index and its 18 triggers.
