Set up a shared annotations layer
Your team can mark up a site on one layer, with a colour for each mark. For example, they can mark a first-aid tent as a point, a fence as a line and a car park as a polygon. This tutorial sets up that layer from a template of two files. To see the result first, open the Annotations demo map.
Download the template
Download both files, and save them in the same folder:
- annotations.qgs is the QGIS project. It gives the layer its style, its labels and its form.
- annotations.geojson holds the annotations.
The GeoJSON file holds three examples on a showground in Mudgee, New South Wales: a point, a line and a polygon. QGIS reads the fields of a GeoJSON file from its features, so the examples give QGIS the fields. Delete the examples after your team adds its own annotations.
Learn the fields
Each annotation has these fields:
| Field | What it holds | Who fills it in |
|---|---|---|
label | The text on the map beside the annotation, such as First aid | Your team |
color | The colour of the annotation, as #rrggbb, such as #ff0029 for red | Your team |
symbol | The symbol of a point, such as circle or star, or none for a label with no symbol | Your team |
notes | Any notes about the annotation | Your team |
uuid | A unique ID for the annotation | Groundwork, when someone adds an annotation |
created | The date and time when someone added the annotation | Groundwork, when someone adds an annotation |
last_edited | The date and time of the last save | Groundwork, each time someone saves the annotation |
Each field has an icon beside its name, such as a palette beside Colour. The template sets them as layer variables, as Show an icon beside a field describes.
The form shows the color field as Colour, with a swatch of the colour, and your team picks a colour from a set. Groundwork draws a point, a line or the outline of a polygon in its colour. It fills a polygon in the same colour at 15% opacity, and draws the label in it too. A new annotation starts in the blue #377eb8, which your team can change. If the field is empty or holds no colour, Groundwork uses the colour of the symbol in the project.
The form shows symbol as Symbol, a list of symbols that ends with Text only. A Text only annotation shows its label over the point, with no symbol. Groundwork does not save one with no label, and QGIS Desktop does not either. If the map’s labels are off, a Text only annotation shows nothing. The template puts symbol in a form group that shows only for a point. The form of a line or a polygon does not show it.
When someone adds an annotation, the drawing panel offers Text first, then Point, Line and Polygon. Text adds a point with the symbol Text only. A new point starts with the symbol of the last one that someone added, or Circle for the first. It starts on Circle after a Text only annotation too. Your team cannot change uuid, created or last_edited.
Put the files in a cloud folder
Make a folder for the two files:
site-annotations/
+-- annotations.qgs
`-- annotations.geojsonCopy the folder into Dropbox. Use a private Dropbox folder, and add each editor to it as a member with edit access. Publish to a cloud folder gives the details.
Open the map in Groundwork
- Open Groundwork.
- Click the map name at the top of the right-hand panel.
- Choose Create new map.
- Under Or connect your own data, choose Dropbox.
- If Groundwork asks you to sign in, sign in.
- Choose
annotations.qgsfrom the folder.
The map opens on the examples. It has one layer, Annotations, that holds points, lines and polygons. The layer has no legend, because the template gives it a transparent legend picture. To show only some colours or symbols, press the Filter button and choose Colour or Symbol. To open the map on your own area, move the QGIS canvas there and save the project. Or set the view in Groundwork, as Configure the map describes.
Check the colours
- Add a polygon around a part of your site.
- In Colour, pick a green.
- Save the annotation.
- Make sure that its outline is green.
- Delete the three examples.
Add a field in QGIS
QGIS shows the template as three layers called annotations, in a group called Annotations. One layer shows the points, one the lines and one the polygons. All three read the same file, so a field that you add to one layer is in the file for all three.
- Open
annotations.qgsin QGIS. - In the Layers panel, open the Annotations group.
- Double-click the point layer to open its properties.
- Select the Fields tab.
- Press Toggle editing mode.
- Press New field.
- In the Add Field dialog, type the Name and choose the Type.
- Press OK.
- Press Toggle editing mode again, and save the changes.
- Give the new field a value on at least one feature.
- Save the project.
- Close the project, and open it again.
- Make sure that the line layer and the polygon layer show the new field on their Fields tab.
- Save the project again.
QGIS reads the fields from the features in the file, so a field needs a value on a feature. Groundwork reads the fields from the project, so the project must be saved after the change.
Keep the three layers
Groundwork shows the three QGIS layers as one layer only while their sources differ by geometry type alone. So keep these rules:
- Keep all three layers. If you remove one, Groundwork shows only the geometry types that are left. In a cloud folder, that layer is read-only.
- Do not add a filter to one layer. A layer with a filter stays a separate layer in Groundwork.
- Keep the three layers as the whole of the group. The layer in Groundwork then takes the name of the group.
To change the colour of a symbol or its label, change each of the three layers.
The geometry types entry
The GeoJSON file has a "geometry_types" entry, beside "type":
"geometry_types": ["Point", "LineString", "Polygon"],The entry lets your team add a line or a polygon to the layer, even when the file holds none. Each time Groundwork saves an edit, it writes this entry into the file. Other software may not keep the entry when it saves the file. Let a layer hold points, lines and polygons gives the details.