This post was written some time ago.
Please refer to the Mergin Maps documentation for the most current information.

Recording tracks using QGIS and Input app

MARCH 26, 2020 Geodiff Input Mergin qgis

In this post, we will use Input app to record tracks. The first step is to set up a project in QGIS.

Quick recap

In the previous tutorial, we set up a simple QGIS project and transferred it to our devices using the Mergin service.

In this tutorial we are going to set up a new survey project with more advanced features:

  • Forms with more options
  • Different background layers (aerial imagery and street map)
  • Using different geometry type of survey layer
  • Exploring other Input app functions

Software needed

To start with, you will need to install the following software applications:

In addition, you will need to register with the Mergin service. The Mergin service allows you to transfer data between your PC/laptop and mobile/table via the cloud. Note that after signing up to the Mergin service, you have to activate the account by clicking on the link sent to your email.

Configuring QGIS project

Similar to the previous tutorial, we are going to start with a blank QGIS project. All the data and the project will be stored locally on a folder called recording tracks.

First, start a QGIS project and add the OpenStreetMap layer under XYZ Tiles. You can add also add aerial imagery as an XYZ layer to your QGIS.

Project setup

Save your project as tracks in the recording tracks folder.

In addition, we need to create a Geopackage survey layer. Below are the attribute columns for your survey layer. Also note that need to select Line as geometry type.

To create a survey layer, in QGIS, from the main menu select Layer > Create Layer > New Geopackage Layer …. A new window will appear:

For Database click on and select the recording tracks folder then type survey.gpkg for the name of your database.

For Table name, type tracks.

For Geometry type, select Line.

You can select the option to Include Z dimension. The upcoming version of Input app supports capturing altitude from your device (or external GPS device tethered with your phone/tablet).

For Coordinate Reference System (CRS), select WGS 84 / Pseudo-Mercator EPSG:3857.

Add the following Fields. Note, different field types:

  • Type field type as text
  • Public field type as Boolean or bool
  • Photo field type as text
  • Date field type as Date & time

Geopackage survey layer

Click OK to create and add the layer to your QGIS session.

Styling layers and setting up forms

We are going to style the tracks layer based on Type field and use four categories:

  • Footpath
  • Byway
  • Cycle path
  • Bridle way

In the Layer Panels right-click on tracks layer and select Properties. A new window will appear. From the left panel, select Symbology. Change the styling from Single to Categorized on the top left section of the window. For the Value, select Type from the drop-down menu.

In the bottom-left section of the window, click on Classify. Then add 4 classes (by adding the green plus adjacent to Classify) for track types. In addition, we can add another class for Other types. Adjust the colours and line style accordingly:

Setting up style

To set up the form, select Attribute forms from the left panel of the layer properties window. Adjust the Widget type as below:

  • For fid, select Hidden
  • For Type, select Value map and add the 5 categories (Footpath, Byway, Cycle path, Bridle way and Other) for Value and Description section (see image below)
  • For Public, select Checkbox
  • For Photo, select Attachment and select the option for Relative path
  • For Date, select Date/Time

Setting up forms

Input app allows you to have a custom pop-up drawer window when you tap on feature. To customise that, you can change the Display settings under the layer properties window. For Display name select Type and in the HTML Map Tip section type:

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

Custom pop-up

Setting up map themes

We can set up two different map themes: one with aerial imagery and one with street map. To do that, ensure you have only the following layers are set to visible in your layer panel:

  • tracks
  • Aerial images

Layer visibility

On top of the layers panel, select Manage Map Themes > Add Theme …

Creating a new theme

A new window will appear. Type Aerial photo for the name of your map theme and press OK.

Now, turn off your Aerial images layer in the layer panel and turn on the OpenStreetMap layer:

OSM theme in QGIS

You can now add a new map theme and call it Street map.

Save your project and transfer your data and project to your phone through the Mergin service as described in the previous tutorial.

If you missed a step, you can see the final version of the project here. You can also skip the above section by cloning the project in the above link.

Recording tracks using Input app

In Input app, download and open Tracks project.

Downloading a project

Map view in Input

You can easily change between different map themes in Input, by going to (… More) > Map Themes:

Selecting theme in Input

OSM map theme

To capture tracks, press Record button in the lower panel in Input. A green cross will appear, centred on your GPS location. You can capture a line in two different methods:

  • Adding points to form the line by moving the map and pressing Add Point
  • Streaming GPS location while moving to form a line. To do that, press and hold GPS icon on the bottom left of your screen (see image below)

Streaming GPS

You can change the frequency of adding points when streaming GPS location, under Settings in Input. Also note that the GPS streaming can be done for polygon survey layer.

Once you finished capturing the track, press Done and you will be presented with a form:

Forms

You can easily fill the form using the drop-down menu for Type and checkbox option for Public.

By tapping on tracks on the map, you will should be able to see a small preview window presenting Type and Photo:

Preview panel

After completion of the survey, you can synchronise your data back through the Mergin and see the results in QGIS desktop.


Posted by Saber Razmjooei