|
| 1 | +--- |
| 2 | +description: See how to set up an image guide in the attributes form to display reference pictures while collecting data in the field. |
| 3 | +outline: deep |
| 4 | +--- |
| 5 | + |
| 6 | +# How to Use Image Guides in the Form |
| 7 | + |
| 8 | +When collecting data in the field, it may be useful to have a visual guide as a reference to ensure that correct information is entered in the form. For example, when collecting information about trees, it may help to see a reference photo of the tree trunk to identify the type of tree correctly. |
| 9 | + |
| 10 | +:::tip Example project available |
| 11 | +Clone <MerginMapsProject id="documentation/image_guide" /> to explore this setup. |
| 12 | +::: |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +## Data, layers, and attributes |
| 17 | +In this scenario, we want to include a photo guide in the form so that users can compare the type of a tree trunk to a reference picture while collecting data in the field. |
| 18 | + |
| 19 | +The <MainPlatformName /> project contains: |
| 20 | +- a survey layer (here: `trunk_type.gpkg`) with the form configured to display or hide the image guide |
| 21 | +- a table (here: `list.gpkg`) that is used as a [value relation](../value-select/#value-relation) in the survey layer's attributes form, so that users can choose a tree type from a drop-down menu |
| 22 | +- a reference photo for each type of tree, stored in the <MainPlatformName /> project folder and packaged with the project |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +The survey layer (here: `trunk_type`) has following fields: |
| 27 | +- `type` to store a the tree type |
| 28 | +- `photos` to store a photo of the surveyed tree |
| 29 | +- `display` used to display or hide the image guide |
| 30 | +- `date` to store the survey date |
| 31 | +- `image_guide_xy` to display the reference image of the specific tree trunk type. There is a separate field for each type. |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +## Attributes form configuration in QGIS |
| 36 | + |
| 37 | +We use the **Drag and Drop Designer** option in the **Attributes Form** tab of **Layer Properties** to configure the form. |
| 38 | + |
| 39 | +The image guide is set up as follows: |
| 40 | +- The `display` field uses the [checkbox](../checkbox/) widget with *true* and *false* values. |
| 41 | + |
| 42 | + The alias of the field is set to *Show me photo guide*. |
| 43 | + |
| 44 | +  |
| 45 | + |
| 46 | +- The [tab](../tabs-and-groups/) named `Photo guide` is used to group all `image_guide_xy` fields. |
| 47 | + |
| 48 | + The tab uses [conditional visibility](../conditional-visibility/) so that the image guide is displayed only when `display = 'true'` |
| 49 | + |
| 50 | +  |
| 51 | + |
| 52 | +- The photo guide fields `image_guide_xy` use the [Attachment](../photos/#photo-attachment-widget-in-qgis) widget with *Relative* paths. |
| 53 | + |
| 54 | + The [Integrated Document Viewer](../photos/#displaying-photos-in-qgis) is set to *Image* to display the picture in the form. |
| 55 | + |
| 56 | + The [default values](../default-values/) contain the name of the reference picture (such as `scots_pine.png`). This ensures that the image guide is present when a new feature is created. |
| 57 | + |
| 58 | +  |
| 59 | + |
| 60 | +## Image guide in the mobile app |
| 61 | + |
| 62 | +When the form is opened in the <MobileAppNameShort />, the image guide can be easily displayed and hidden by toggling the **Show me photo guide** checkbox. |
| 63 | + |
| 64 | + |
0 commit comments