2. Project preparation

2.3. Adding a survey layer

Vector layers can be added as survey layer for the Input app.

In this section we'll create a survey layer for collecting groundwater data.

The following steps will be covered:

  • Create a point vector layer with the necessary attributes
  • Styling of the points
  • Make an attributes form using widgets
  • Settings for the Input preview panel
We continue with the same project from the previous section.

Create a point vector layer with the necessary attributes

1. In the Main Menu go to Layer | Create Layer | New GeoPackage Layer....

Create new geopackage layer

2. Click the Browse button Browse button to go to your project folder and choose the GeoPackage from the previous section, in our case bangula_study_area.gpkg.

3. For Table name type Survey. For Geometry type choose Point. Make sure the projection is set to EPSG: 32736.

4. Now we're going to add the attributes. Add the attributes like in the screenshot below. Add them by using the Add to Fields List button.

5. Click OK when done.

6. A popup will ask you if you want to overwrite or add a new layer. Choose Add New Layer so it will be added to the GeoPackage.

Styling of the survey points

The Input app will use the same styling as defined in QGIS. Let's create a point symbology.
7. Click to open the Layer Styling panel.
8. Use the Single symbol renderer and click to add a symbol layer.
9. For the first symbol layer make the Fill color transparent and the Stroke color black. Increase the Size to 4 mm and Stroke width to 1 mm For the second symbol layer choose a cross as marker symbol and choose Stroke color black. Increase the Size to 8 mm and Stroke width to 1 mm.


Make an attribute form using widgets

The next step is to design the attribute form using widgets.
10. Click right on the Survey layer and choose Properties...
11. In the Properties window go to the Attributes Form tab.

Here we can design the form. We'll use the default Autogenerate option. Under fields we see all attributes in the Survey layer.

12. Click on fid. On the right side of the window we can configure the widget. The value of fid is assigned automatically by QGIS to GeoPackage layers and does not need to be edited by user. Set the Widget type to Hidden to make it invisible in the form.

fid

13. Click on Observation ID.  Type for Alias Observation number. This is how it will appear on the form. Choose the Text Edit widget and check the Not null box  and Enforce not null constraint under Constraints. This means that it is a mandatory field. Keep the other fields as default.

Observation number

14. Click on Date. Type Date and time as Alias. Widget Type is automatically set to Date/Time. Change Widget Display to Custom and make it dd-MM-yyyy HH:mm:ss. Check the preview to see how it is formatted. Uncheck the box before Calendar popup. Under Defaults type as default value $now to have the current date/time automatically filled in.

Date and time

15. Click on Observer. At Alias type Observer name. Choose the Text Edit widget and check the Not null box and Enforce not null constraint under Constraints. If you have a default observer you can type his/her name in single quotes under Defaults at Default value. Keep the other fields as default.

Observer

16. Click Picture. For Widget Type choose Attachment. Check the box for Relative paths. Under Integrated document viewer choose Image. At Constraints check the box before Not null.



17. The fields X coordinate and Y coordinate we can keep as default with the Text edit widget and no constraint.

18. Click Z. Set the Alias to Elevation. Keep the Text edit widget and no constraint.

19. For Type give the Alias Feature type. Set the Widget type to Value Map. Fill in the Value Map as the figure below. The user will get these items in a dropdown list and can choose from what is written in the Description column. The corresponding Value will be written to the attribute table. Under Constraints check Not Null and Enforce not null constraint.

Feature type

20. For Depth type as Alias Depth to bottom (m). Keep Widget type as Text edit. We only want this field to be filled in for wells or boreholes. Therefore we add an Expression under Constraints:
  "Type"  = 'Wells' OR "Type" = 'Boreholes'.
Check the box to Enforce expression constraint.

Depth

21. For GW level type the Alias Water Level (m). Keep Widget type as Text edit. We only want this field to be filled in for wells or boreholes. Therefore we add an Expression under Constraints:
  "Type"  = 'Wells' OR "Type" = 'Boreholes'
Check the box to Enforce expression constraint.

Water level

22. For Name keep the default Text edit widget and no constraint.

23. For Address keep the widget as Text edit but check the Multiline box to allow for multiple lines.


24. For Remarks keep the widget as Text edit but check the Multiline box to allow for multiple lines.

25. Click OK to close the window and apply the changes.

26. Open the attribute table of the Survey layer and switch to Form View using to check the widgets.

Attribute table form view

Settings for the Input preview panel

Similar to Google maps, when a feature is identified on the map a preview panel will appear. To enable a layer being identified, the option should be enabled in QGIS desktop, under Project properties.

27. For setting the preview panel, you need to click right on the Survey layer in the Layers panel and choose Properties. Then select the Display tab.

28. Change Display Name to Observation ID. This will show the Observation ID when you tap a surveyed point.

29. Add the following lines under HTML Map Tip:

# image
file:///[%@project_folder%]/[% "Picture" %]

This will be interpreted by the Input app to show the picture when the surveyed point is tapped.

30. Click OK to close the dialogue.

Our Survey layer is ready now.

In the next section we'll do some final settings of the project.