Skip to content

Link records to a feature

To link records to a feature, use a relation in your QGIS project. Examples are the inspections of each tree or the maintenance done on it. Add the relation in Project Properties → Relations.

A relation links two of its layers. The referenced layer holds the features. The referencing layer holds the records that belong to them. Groundwork reads the relation, and shows the records on a tab in the details of each parent feature, with the name of the relation.

The child is also a layer on the map, as any layer in the project is. To keep it to the tab only, tick Private for it, as Private describes. The records do not need a geometry, so a table of records is enough. Save it as a GeoJSON file beside the project, as you do with the data of other layers.

In the QGIS User Guide: Defining 1-N relations.

Match each record to its feature

Groundwork connects a record to its feature when every field pair of the relation matches. Groundwork compares the values as text, without the spaces at the start or end. So 2001 on one side and "2001" on the other still match. A feature with an empty matching field has no records.

Put both layers in the project. Groundwork ignores a relation that refers to a layer that is not in the project. A layer can be the child of more than one relation. A child layer can also be the parent of another relation.

Let your team change records

Your team can change records only when each record has its own id. If a record has no id, or two records have the same id, your team can still add records, but cannot change existing ones. If the layer accepts new records, an open record shows a message about this.

GeoJSON

Give every record in the child layer its own id in the GeoJSON file, and make sure that no two are the same. This is the id of each feature in the file, not a field called id. Then your team can change and add records in Groundwork.

CSV

A CSV file has no id of its own. To let your team change its records, set one field as its id. In Layer Properties → Attributes Form, select the field that names each record, such as job_id. Under Constraints, tick Not null and Enforce not null constraint, and tick Unique and Enforce unique constraint. Groundwork uses the first field set up in this way as the id. A new record opens with the next id in that field, and the field is locked after the record is saved.

If the CSV is also a layer, your team edits its records from the tab, not from the feature list of the layer.

Drag the CSV file into QGIS to add it to the project, so that your team can edit it. QGIS cannot edit a CSV that it reads as Delimited Text, and your team cannot edit it in Groundwork either.

Show a symbol beside each record

To show a symbol beside each record in the panel, style the child layer in QGIS as you style other layers. For example, a style categorised on a condition field gives each condition its own symbol. If Groundwork cannot read a style for the layer, its records show no symbol.

Groundwork reads relations from the project file, so a map connected to QGIS Server does not have them. You cannot delete or share a record in Groundwork.

Next: Publish to a cloud folder.