Tutorial: Create a field data collection app with QGIS and Mergin Maps

Site: OpenCourseWare for GIS
Course: Land-Cover Mapping with QGIS
Book: Tutorial: Create a field data collection app with QGIS and Mergin Maps
Printed by: Guest user
Date: Wednesday, 15 April 2026, 3:57 AM

1. Introduction

In this tutorial we're going to use Mergin Maps to create a field data collection app. With Mergin Maps you can setup a field mapping project in QGIS, synchronize the project with the cloud and with your mobile phone. The Mergin Maps app is available on Android, iOS and Windows.

You can use the app with online and offline maps in the field. It also allows you to collaborate in field survey projects and takes care of the version management.

After data collection, you can synchronize the project in QGIS and use the data for further processing.

This tutorial will guide you through the steps for creating a field data collection app for crop mapping.

Mergin Maps Ecosystem

The tools are open source. Here we'll use the free plan for the cloud service provided by Mergin Maps, which offers 100 MB storage. If you need more, you can install the service on your own server or choose a paid plan.


2. Install the Mergin Maps app and create an account

Before we start our mapping project, we'll install the Mergin Maps app on our mobile phone and create an account.

1. Download Mergin Maps to your Android device, iPhone or iPad. You can find it in the app store of your platform:

Download on the App Store Get it on Google Play Available on Windows
 
2. Open Mergin Maps on your device.
 
 
The trial workspace is limited. Click the picture below to request for the academic plan and fill in the form.
Use your IHE Delft e-mail address!
 
 
Now we're ready to set up a mapping project in QGIS.

3. Configure the Mergin Maps plugin for QGIS

The next step is to install the Mergin plugin in QGIS. With the plugin we can:

  • Initialize a field survey project for Mergin Maps
  • Synchronize the project with the Mergin cloud service
1. Start QGIS Desktop with an empty project.
2. Go to the Plugins manager: in the main menu choose Plugins | Manage and install plugins...


3. Search for the Mergin plugin and click Install Plugin.

4. After installation click Close to close the dialog.

The plugin adds some icons to the Toolbar:
We'll use these later.

The plugin also adds a Mergin Maps folder to the Browser panel. There we need to make a connection with our account first.



5. In the Browser panel, right-click on Mergin Maps and choose Configure from the context menu.

6. In the Mergin Settings dialog fill in your credentials. Check the box to Save credentials, so you don't have to type them each time you use Mergin Maps.


7. Click Test Connection.

8. If it returns OK, you can close the dialog by clicking OK, otherwise check your credentials or recover your password.

Now you can see your project in the Browser panel in the Mergin Maps folder:



In the next section we'll create a new Mergin Maps project.

4. Create a new Mergin Maps project

In this section we'll initialize our Mergin Maps project in QGIS.
Although it is possible to use an existing project, it is recommended to create a project from scratch, initialized by the Mergin plugin.
 
1. In the Toolbar click  the Create Mergin Maps Project icon.
2. In the Create Mergin Maps project dialog, choose New basic QGIS project.
3. Keep the workspace with your user name and type for Project Name: Crop_Mapping. You can change the location of the project or keep the default.
 
 
4. Click Finish.
 
The new project loads.
 
5. Click Close to close the dialog that informs you that the Mergin Maps project has been created and uploaded successfully.
 
In the Browser panel you'll now find your new project in the folder Mergin Maps | Crop_Mapping. The folder contains the QGIS project Crop_Mapping and a GeoPackage with the name Survey_points.gpkg, which contains a layer Survey_points with some predefined fields.
 
In the Layers panel you can see the Survey point vector layer and a backdrop with vector tiles from OpenStreetMap.
 
 
6. Zoom to your study area.
 
In the next sections we'll customize this survey project.
 

5. Add online background layers

For our crop mapping survey it's useful to add some layers to orient ourselves.

We're going to add Google Satellite. We can use the QuickMapServices plugin to load the layer.

  1. In the main menu go to Plugins | Manage and install plugins....
  2. Install the QuickMapServices plugin and close the dialog after installing.
  3. In the main menu, go to Web | QuickMapServices | Google | Google Satellite.

 
 
3. Drag the Survey layer to the top.
 
 
These layers are online, so when use them in the field, we need an internet connection. In the next section, we'll convert the online layer to an offline layer.
 
4. Save the project.

6. Add offline background layers

In the previous section we've added an online background layer to our survey project. Sometimes we don't have internet in the field. For those cases we can create offline layers from the online layers and we can add other layers that we need. Note that the storage in the free plan of Mergin Maps is 100 MB, so you can't have too many detailed offline layers.

Let's create an offline layer of the Google Satellite layer.

1. Make sure that in the Layers panel only the Google Satellite layer is visible, zoomed in to your study area.

2. Go to the Processing Toolbox.

3. Go to Raster Tools | Generate XYZ tiles (MBTiles).

4. In the Generate XYZ Tiles (MBTiles) dialog choose the Map Canvas Extent as Extent.

5. Here we keep the Minimum zoom and Maximum zoom level at 17. You can give a range, but then also the file size will increase.

6. Save the result (satellite.mbtiles) to the same folder as your Mergin Maps project. Only then it will be later synchronized.

7. Click Run.

8. Click Close to close the dialog after the processing has completed.

9. In the Browser panel go to Project Home to see all the files in your project folder and drag the satellite.mbtiles layer to the map canvas. You might need to click refresh to see the layer.

10. Check the result.

Of course we can also add any existing raster layers to our project, such as NDVI, WaPOR layers, etc.

Next, we'll setup the survey layer.

7. Setup the Survey Layer

The default project already has a Survey point layer. You can use any vector layer for surveying, but here we'll add fields to the existing Survey point layer.

1. Open the attribute table of the Survey layer: in the Layers panel right-click on the Survey layer and choose Open Attribute Table from the context menu.

You can see that it already has some attributes: fid, date, notes, photo. Let's add a few more, related to crop mapping.

2. Click to switch to editing mode.

3. Click to add a new field.

Let's add a field for an observation number.

4. In the Add Field dialog type Obs for the Name, use Text (string) for type (in that way we can add alphanumeric codes for our observation numbers) and use a Length of 5 characters.

5. Click OK to add the new field to the attribute table.

6. Repeat this for the following attributes:

 
Field name Type Length
Name Text (string) 50
LandCover Text (string) 50
Crop Text (string) 50
WaterSource Text (string) 50
IrriMethod Text (string) 50
Coverage Decimal number (real)  


7. Click to toggle off editing and save the changes.

Now let's create the widgets for the observation form.

Mergin Maps supports many widgets. You can check them here.

8. To setup the Form Widgets, right-click on the Survey layer in the Layers panel and choose Properties... from the context menu.

9. In the Layer Properties dialog go to the Attributes Form tab and choose Drag and Drop Designer from the drop-down menu.

In this dialog we can interactively create our field form with the widgets.

10. First, we don't want to use the fid field. Select fid from the Form Layout panel and click the icon.

11. Lets rearrange the items. You can drag and drop the items rearrange. Here we use this order:

Now we'll configure the form widgets.

12. Click on Obs in the Form Layout panel.

Now you can see the widget settings in the right panel of the dialog.

13. We can give more human readable names to the fields using and alias. In the Alias field of Obs type Observation number.

14. Under Constraints we check the boxes for Not null and Unique, to make sure that a value is filled in and that the code is unique. Also check the boxes to enforce the constraints. Keep the rest as default.

15. Now click the date field in the Form Layout panel.

16. For Alias type Date/Time.

17. For Widget Display choose Custom and type dd-MM-yyyy HH:mm:sss for the format You can see the result in the Preview.

18. Set the Contraints to Not null.

19. Under Defaults we can set an expression so the current date and time are used. Type

$now


20. Now choose Name from the Form Layout. Use the following settings:

21. For the photo field we should keep the default settings, so the relative path to the picture is stored and the Integrated Document Viewer is used to show the image. Only type Picture at Alias.

22. For LandCover type the Alias Land cover type.

For the land cover types we would like to use a drop-down menu. We can define that with the Value Map widget.

23. Under Widget Type choose Value Map and use the following Value/Description combinations:

 
Value Description
Cropland Cropland
Tree Cover Tree Cover
Shrubland Shrubland
Grassland Grassland
Wetland Wetland
Artificial Artificial
Bare soil Bare soil
Fallow land Fallow land
Seasonal water Seasonal water
Permanent water Permanent water


24. Use the Not Null Constraint.

25. For Crop use the Alias Crop type.

26. Also here use the Value Map widget. Use the following Value/Description combinations:

 
Value Description
Wheat Wheat
Maize Maize
Rice Rice
Barley Barley
Soy beans Soy beans
Pulses Pulses
Cotton Cotton
Potatoes Potatoes
Alfalfa Alfalfa
Sorghum Sorghum
Other Other
 
27. We only want the crop type when the land cover type is crops. Therefore, we'll add an Expression under Constraints. Click  to open the Expression Dialog.
28. In the Expression Dialog compose the following expression:
"LandCover" = 'Cropland'
Note that you can double click on the field name in the middle panel to add the field name to the expression with double quotes. Single quotes are used for strings.
 
29. Click OK.
 
 
 
30. For WaterSource use the following settings:
 
Note that you can add the same expression for the constraint as was used for the crop type by choosing the expression under Recent in the Expression Dialog.
 
 
32. For IrriMethod use the following settings:
 
You can compose expression in the Expression Dialog in the following way:
 
33. For Coverage we're going to use a slider. Use the following settings:
 
34. For notes, use Alias Notes and set the Text Edit widget to Multiline.
 
 
On your mobile device you can see a preview of the survey point. We can setup this preview so we can see the observation number and the picture.
 
36. Go to the Display tab.
 
37. Under Display Name, use the drop-down list to choose the Observation number.
 
38. Under HTML Map Tip write the following expression:

# image
file:///[%@project_folder%]/[% "photo" %]
This refers to the image path in the photo field in the attribute table.
 
39. Click OK to apply and close the dialog.
 
Don't forget to regularly save the project.
 
The field form for the Survey point layer is now ready.
 

8. Create Map Themes

In Mergin Maps, you can use different map themes. This is ideal for switching between different background maps (e.g. cartography map and aerial photography). The map themes should be first set up in QGIS.

Let's start with making a map theme with the Google Satellite in the background.

1. Make sure the Survey layer is visible (box checked) in the Layers panel. In all map themes this layers needs to be checked.

2. Hide all other layers except the one we want to show as a backdrop. Here we check the box for Google Satellite.

3. Click the Manage Map Themes   icon and choose Add Theme... from the context menu.

4. In the Map Themes popup call the the new theme Satellite Online and click OK.

5. Now hide (uncheck the box) for Google Satellite and check the box for satellite.

6. In the same way now create a Map Theme with the name Satellite Offline.

Now you can find both themes:

7. Switch between the two Map Themes and check the result.

8. In the same way add the Map Themes with the OpenMapTiles (OSM) layer and name it OpenStreetMap.

In the end you'll have the following Map Themes:

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

9. Setup the Project Properties

Now the survey layers have been defined, we need to change some settings in the Project Properties to indicate that these layers are survey layers. We can also set there the spatial extent of the project and some synchronisation options.

1. In the main menu go to Project | Properties....

2. Go to the Data Sources tab. There you have to make sure that the survey layer is not set to Read-only. Layers set to Read-only can not be edited in the field and will be visible as background layers. These can be any vector or raster layer.

3. Next go to the View Settings tab.

Here you can set the spatial extent of the project. That will determine the extent when you zoom to full extent.

4. Check the box to Set Project Full Extent. And choose the Map Canvas Extent (make sure you're still zoomed in to the extent of the Smaller study area).

5. Finally, you can go to the Mergin Maps tab.

We'll not change anything here. However, if you have limited space on your phone or bandwidth is a challenge, you can enable Selective sync here or reduce the size of pictures.

6. Click OK to apply the settings and close the dialog.

10. Synchronise the QGIS project with Mergin cloud service

Now our project is setup, we're ready to synchronise it to the Mergin cloud service and then our mobile device. Let's first synchronise the project with the Mergin cloud service.

1. Save your project

2. Click the Synchronise Mergin Maps Project  icon in the Toolbar.

A popup with the status of your project appears:

3. Click the Sync button.

After a while you'll see the popup with the message that the synchronisation was successful.

4. Click Close.

Now your project is in the Mergin Maps cloud.

In the next section we'll synchronise the project from the cloud with our mobile device.

11. Synchronise the Mergin Maps project with a mobile device

Now we can synchronise the project with our mobile device and use it for field data collection.

1. On your mobile device go to the Mergin Maps app.

2. Go to the Projects tab.

3. There look for the new Crop_Mapping project and tap  to download the project to your mobile device.

4. After downloading, go tap the Crop_Mapping project to open it.

Now you'll see the project on your mobile device.

In the next section we'll cover how to use the app for surveying in the field.

12. Using the Mergin Maps app for field surveys

In this section we're going to use the Mergin Maps app on our mobile device for field data collection.

Make sure you see the project on the screen of your device:

You can see the GPS accuracy. Make sure it's good enough for your purpose.

1. Tap the GPS accuracy value. This will give you the GPS reading.

2. Go back to the project by tapping .

3. Tap the GPS   icon to zoom in on your location.

4. Use two fingers to zoom in further. The light green circle gives an indication of the position error, the darker green wedge shows the view direction.

5. Tap the icon and choose Map themes.

6. Try different Map Themes.

Let's take an observation point.

7. Tap Record .

8. The GPS locator changes into a crosshair. You can move the crosshair with your fingers to the location that's representative for your observation. This is particularly useful if you don't have access to a parcel due to fences.

9. If you're okay with the location, tap Record.

10. Fill in the form.

12. Tap in the upper right of the screen to save the observation. Tap Edit geometry if you still want to move your point.

The point is now put on the map with the style from the project. If you tap it you can also see the preview. If you want to edit the point, tap Edit. If you tap you can select multiple points to edit them at the same time or Stake out to help you navigate to the point.

14. Tap to synchronise your changes with the Mergin Maps cloud.

Now we'll go back to QGIS to check our project.

13. Synchronise the survey in QGIS

Back in the office we want to check the data and further process it in QGIS.

1. Open the Crop_Mapping project in QGIS.

2. Click the synchronise icon in the Toolbar.

A popup shows the changes.

3. Click Sync.

After synchronisation a popup will show that the synchronisation was successful.

4. Click Close.

You can now see the survey points on the map.

5. Open the attribute table for the Survey layer.

6.  In the lower right of the attribute table swith to Form View by clicking the icon.

Now you can see your observations also with the form widgets.

You can now use this for further analysis or remote sensing based crop classification.

In the final section of this tutorial you'll learn how to see changes in the dashboard of the cloud service.

14. Monitor the project in the Mergin Maps dashboard

Mergin Maps keeps track of all transaction with the cloud service. You can also work together on a project or create a work space for your organisation. Let's have a look at the dashboard.

1. Go to the Mergin Maps website and login with your credentials.

There you'll see your projects with their size and how many versions are stored.

2. Click on the Crop_Mapping project.

In the Files tab it shows all files of the project.

3. Go to the History tab.

There you can find all versions, when they were created, which user made the changes and what the changes were. You can download previous versions from here too.

4. Click on a version number.

Mergin Maps will show here all changes.

5. Click Show Advanced.

Mergin Maps now shows the changes in the attributes.

For more information on the dashboard, please check the documentation.

15. Conclusion

In this tutorial you've learned to setup a field data collection app with QGIS and Mergin Maps.

This webinar shows a similar application:

Here's a playlist with Mergin Maps videos: