Skip to content

Commit 1f43314

Browse files
authored
#327 custom photo names (#331)
* custom photo names * photo names separate page * fix * fix * typo fix * Update index.md removed info about doc viewer
1 parent f40290b commit 1f43314

20 files changed

+136
-16
lines changed

src/.vuepress/sidebar/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ module.exports = {
5757
'/gis/search_data',
5858
'/gis/settingup_background_map',
5959
'/gis/setup_themes',
60+
'/gis/photo-names/',
6061
'/gis/enable_digitising',
6162
'/gis/snapping/',
6263
'/gis/proj',

src/gis/enable_digitising.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# How to Enable Digitising
22

3-
1. Open QGIS Desktop with your <MainPlatformName /> Project
4-
2. Navigate to the **Data Sources** in the **Project Properties**
3+
1. Open your <MainPlatformName /> Project in QGIS
4+
2. Navigate to **Project Properties**
5+
![QGIS Project Properties](./qgis-project-properties.jpg "QGIS Project Properties")
6+
7+
3. Inspect **Layers Capabilities** in the **Data Sources** tab.
8+
9+
At least one layer in your project needs to have no check in the **Read-only** column, otherwise it cannot be edited.
10+
511
![QGIS data sources enable digitising](./qgis_digitising.jpg "QGIS data sources enable digitising")
6-
You need to have at least one layer without "Read-only" check
7-
3. **Apply** the changes. Don't forget to save and sync your project!
12+
13+
4. **Apply** the changes. Don't forget to save and sync your project!

src/gis/features.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ In [Creating a Project in QGIS](../tutorials/creating-a-project-in-qgis/) you wi
1616
## Background layers
1717
Various online and offline maps can be used as background layers for navigation during the field survey. You can find more information in [Background Maps](./settingup_background_map/).
1818

19-
## Project extent
20-
In <MobileAppName />, there is an option to [zoom to the project extent](../field/input_ui/#zoom-to-project-browse-features-map-themes-settings).
21-
22-
To set the project extent, navigate to **Project** > **Properties**. Select **View Settings** and check the **Set Project Full Extent** option. Here, either enter the coordinate extent of your project bounding box or use the map canvas extent.
23-
24-
![QGIS set project extent](./qgis-project-extent.jpg "QGIS set project extent")
25-
26-
If not set, <MobileAppName /> zooms to all visible layers. This is not particularly convenient when you have a layer with a large/global extent (e.g. Open Street Map).
2719

2820
## Project settings
2921
- Ensure the paths are set to *Relative* in the **General** tab in Project Properties. All paths to the project data in <MobileAppName /> are relative to the project location.
@@ -35,8 +27,23 @@ If not set, <MobileAppName /> zooms to all visible layers. This is not particula
3527

3628
![QGIS Layer Capabilities](./qgis_project_properties.jpg "QGIS Layer Capabilities")
3729

38-
### Map themes
39-
[Map Themes](./setup_themes/) make possible to switch between different background maps in <MobileAppName /> (e.g. cartography maps and aerial imagery)
30+
### Project extent
31+
In <MobileAppName />, there is an option to [zoom to the project extent](../field/input_ui/#zoom-to-project-browse-features-map-themes-settings).
32+
33+
If the project extent is not set, <MobileAppName /> zooms to all visible layers. This is not particularly convenient when you have a layer with a large/global extent (e.g. Open Street Map).
34+
35+
To set the project extent:
36+
1. Navigate to **Project** > **Properties**.
37+
![QGIS Project Properties](./qgis-project-properties.jpg "QGIS Project Properties")
38+
39+
2. Select **View Settings** and check the **Set Project Full Extent** option.
40+
41+
Here, either enter the coordinate extent of your project bounding box or use the map canvas extent. The extent can be also calculated from a layer in your project.
42+
43+
![QGIS set project extent](./qgis-project-extent.jpg "QGIS set project extent")
44+
45+
3. Click **Apply** to save the changes
46+
4047

4148
### Photo quality
4249
<SinceBadge type="Plugin" version="2022.3.2" /><SinceBadge type="App" version="1.5.1" />
@@ -48,6 +55,17 @@ Don't forget to save and sync your project!
4855

4956
![Mergin Maps set photo quality](./project_resize_pics.jpg "Mergin Maps set photo quality")
5057

58+
### Photo names
59+
<SinceBadge type="Plugin" version="2023.2.0" /> <SinceBadge type="App" version="v2.2.0" />
60+
61+
Names of the photos that are captured in the field using <MobileAppName /> can be customised. The name format can be set in QGIS with <QGISPluginName />.
62+
63+
::: tip
64+
[How to Set Photo Names Format](../gis/photo-names/) will guide you through the setup and provide examples of expressions that can be used to name your photos.
65+
:::
66+
67+
![Mergin Maps Plugin photo name setup with custom folder](./plugin-photo-name-settings.jpg "Mergin Maps Plugin photo name setup with custom folder")
68+
5169
### Snapping
5270
<SinceBadge type="Plugin" version="2022.5" /><SinceBadge type="App" version="1.6.0" />
5371
If you want to use snapping in <MobileAppName /> during the field survey, you need to set it up in the **<MainPlatformName />** tab in **Project properties**.
@@ -62,6 +80,9 @@ The snapping options are:
6280
[How to Set Up Snapping for <MobileAppName />](./snapping/) contains detailed steps that may help you with the snapping setup.
6381
:::
6482

83+
### Map themes
84+
[Map Themes](./setup_themes/) make possible to switch between different background maps in <MobileAppName /> (e.g. cartography maps and aerial imagery)
85+
6586
## Survey layers
6687
Vector layers can be used as survey layers in <MobileAppName />. You can apply styles and set up the forms to make your field survey easier.
6788

src/gis/photo-names/index.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# How to Set Photo Names Format
2+
<SinceBadge type="Plugin" version="2023.2.0" /> <SinceBadge type="App" version="v2.2.0" />
3+
4+
[[toc]]
5+
6+
Names of the photos that are captured in the field using <MobileAppName /> can be customised. The name format can be set in QGIS with <QGISPluginName />.
7+
8+
To use this option, make sure that the [photo widget](../../layer/settingup_forms_photo/#attachment-widget-in-qgis) of the fields you use for taking pictures is set up correctly, i.e. using the attachment widget, storing relative paths and, if needed, with a [custom folder](../../layer/settingup_forms_photo/#how-to-set-up-a-custom-folder-for-storing-photos) for storing photos.
9+
10+
To set up custom photo names:
11+
1. Open your <MainPlatformNameLink /> project in QGIS and navigate to **Project Properties**
12+
![QGIS Project Properties](../qgis-project-properties.jpg "QGIS Project Properties")
13+
14+
2. In the **Mergin Maps** tab, you can see the list of layers and their fields with correctly configured photo attachment widgets.
15+
16+
Select a layer from the list and click on the **Expression builder** icon.
17+
![Mergin Maps Plugin Custom photo name setup](./plugin-photo-name-available-layers.jpg "Mergin Maps Plugin Custom photo name setup")
18+
19+
3. In the **Expression Dialog** window, enter the expression that should be used as the photo's name. Please, keep in mind [basic recommendations](#best-practice-for-photo-name-expressions) to make sure the naming works as intended.
20+
21+
Here we use a combination of the layer's name, <MainPlatformName /> username and current timestamp (other examples ale listed [below](#examples-of-photo-names-expressions)):
22+
` @layer_name + '-' + @mergin_username + '-' + format_date(now(),'yyMMddhhmmss')`
23+
24+
Example result is displayed in the **Preview**: `hedges-sarah-230707194052`
25+
26+
![QGIS Expression for custom photo name](./plugin-photo-name-expression-builder.jpg "QGIS Expression for custom photo name")
27+
28+
Click **OK** to confirm the expression.
29+
30+
4. Set up the photo name format for other fields and layers.
31+
32+
The **Preview** in **Mergin Maps** tab includes the [custom folder for photos](../../layer/settingup_forms_photo/#how-to-set-up-a-custom-folder-for-storing-photos), if you have set it up. Otherwise you will see only the sample name of a photo.
33+
34+
![Mergin Maps Plugin photo name setup with custom folder](./plugin-photo-name-format-folder.jpg "Mergin Maps Plugin photo name setup with custom folder")
35+
![Mergin Maps Plugin Custom photo name setup without custom folder](./plugin-photo-name-format.jpg "Mergin Maps Plugin Custom photo name setup without custom folder")
36+
37+
### Best practice for photo name expressions
38+
There are some tips to keep in mind when creating the expression for your photo name:
39+
40+
:white_check_mark: **Each photo needs to have a unique name** to avoid issues during synchronisation and ensure that photos and features are linked correctly.
41+
42+
Therefore, we recommend using combinations of variables that will ensure that there would not be multiple photos with the same name, such as the current date and time `now()`, <MainPlatformName /> username `@mergin_username`, layer name `@layer_name` or a field value.
43+
44+
:white_check_mark: The file extension (`.jpg`) is added automatically.
45+
46+
:white_check_mark: When using a field value in the expression, make sure that it is a field that will be filled out during the survey, e.g. by using [constraints](../../layer/settingup_forms_settings/#constraints). If the field is empty, the expression won't work!
47+
48+
:white_check_mark: If you want to use a [numeric field](../../layer/settingup_forms/#numbers) or other non-text fields in your expression, you need to convert it to a string first using the `to_string()` function
49+
50+
:no_entry_sign: The expression is evaluated with the **current** field values. The name of the photo will stay the same even if you change the value of the field later.
51+
52+
:no_entry_sign: The setup needs to be saved and synchronised. Only photos that are taken after synchronisation will have the name defined by the expressions. Existing photos will keep their original names.
53+
54+
In general, it is useful to use some of these variables:
55+
- Current timestamp `now()` is a good starting point to ensure uniqueness of the name of the photo.
56+
57+
It can be variously reformatted using the `format_date()` function. See <QGISHelp ver="latest" link="/user_manual/expressions/functions_list.html#format-date" text="See QGIS User manual" /> for more details.
58+
59+
- When working in a team, consider using <MainPlatformName /> username `@mergin_username`.
60+
61+
Even if multiple team members capture a photo at the same time, the name will be different. Also, it makes it easy to sort photos based on who took them.
62+
63+
- Layer name `@layer_name` or a field value.
64+
65+
Depending on the layers in your project and their fields, it can help create a unique photo name when taking multiple pictures in a row. It can also help to make it easier to browse pictures in your <MainPlatformNameLink /> project.
66+
67+
68+
### Examples of photo names expressions
69+
Here are some example expressions that can be used or modified to fit your needs:
70+
71+
- Expression: ` @layer_name + '-' + @mergin_username + '-' + format_date(now(),'yyMMddhhmmss')`
72+
- Preview: `hedges-sarah-230707154052.jpg`
73+
- Description: This is a combination of the name of a layer (`hedges`), <MainPlatformName /> username (`sarah`) and reformatted timestamp that starts with the year and ends with seconds.
74+
75+
- Expression: ` "species" + format_date( now(),'-yyyyMMdd-hhmmss')`
76+
- Preview: `Silver birch-20230707-154052.jpg`
77+
- Description: `Silver birch` is a value of the `species` field. Current timestamp is reformatted with added hyphens to separate the date and time.
78+
79+
- Expression: `'photo-' + format_date( now(),'ssmmhhddMMyy')`
80+
- Preview: `photo-520415070723.jpg`
81+
- Description: A string can be added to the photo name (here: `photo-`). The order of the timestamp is reversed (compared to the previous examples), starting from seconds.
82+
83+
- Expression: `@layer_name + ' ' + to_string("house-number") + ' at ' + format_date( now(),'ssmmhh') + ' on '+ format_date( now(),'ddMMyy')`
84+
- Preview: `house 41 at 520415 on 070723.jpg`
85+
- Description: Here we use the name of a layer (`house`), followed by a string adding space. A numeric field (`house-number`) is converted to a string. The timestamp is divided to display the time and date separately, with added strings `at` and `on` to make the photo name more readable.
Loading
Binary file not shown.
Loading
Binary file not shown.
Loading
Binary file not shown.
Loading
70.9 KB
Binary file not shown.
217 KB
Loading
220 KB
Binary file not shown.

src/gis/project_resize_pics.jpg

114 KB
Loading

src/gis/project_resize_pics.xcf

83.4 KB
Binary file not shown.

src/gis/qgis-project-properties.jpg

203 KB
Loading

src/gis/qgis-project-properties.xcf

602 KB
Binary file not shown.

src/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ The ecosystem consist of various components:
5757
- [Searching for Values in Attribute Fields](./gis/search_data/)
5858
- [Background Maps](./gis/settingup_background_map/)
5959
- [Map Themes](./gis/setup_themes/)
60+
- [How to Set Photo Names Format](./gis/photo-names/)
6061
- [How to Enable Digitising](./gis/enable_digitising/)
6162
- [How to Set Up Snapping for <MobileAppName />](./gis/snapping/)
6263
- [Custom Projections](./gis/proj/)

src/layer/settingup_forms_photo.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,15 @@ To set up a custom folder:
6060

6161
8. **Apply the changes**. Don't forget to save and sync your project!
6262

63-
6463
## Resizing pictures automatically
65-
Photos that are captured during the field survey or uploaded using <MobileAppName /> can be automatically resized, e.g. to save up storage space. The quality of the photos can be set up in the [Mergin Maps project properties](../gis/features/#photo-quality) using <QGISPluginName />.
64+
Photos that are captured during the field survey or uploaded using <MobileAppName /> can be automatically resized, e.g. to save up storage space. The quality of the photos can be set up in the [<MainPlatformName /> project properties](../gis/features/#photo-quality) using <QGISPluginName />.
65+
66+
## Customising photo name format with expressions
67+
Photos taken in the field using <MobileAppName /> can be automatically renamed. This can be useful when browsing pictures in your <MainPlatformNameLink /> project and keeping them organised.
68+
69+
::: tip
70+
[How to Set Photo Names Format](../gis/photo-names/) will guide you through the setup and provide examples of expressions that can be used to name your photos.
71+
:::
6672

6773
## Photos in Mergin Maps Input
6874
Using the photo widget in <MobileAppName />, you will have two options:

0 commit comments

Comments
 (0)