eyecatch

How to Attach Photos and Videos in QField

Published: Last updated:
This article uses QGIS 3.40. The current LTR is 3.44.

What you'll learn


  • How to set up attachment attributes in QGIS
  • Steps for linking files such as photos, videos, and audio to features in QField
  • Tips for using attachments to make field surveys more efficient

Recommended for


  • Anyone struggling to organize the photos and notes they take during field surveys
  • Anyone who wants to get more out of QField's useful features
  • Anyone who wants to move from paper field notebooks to digital data collection

Introduction

During a field survey, you often need to photograph the site as well as enter what you find into attributes. QField makes it easy to attach photos, videos, audio, and other files to features. This greatly improves the efficiency of data collection and management.

Example of a photo linked to a feature in QField (created by processing Geospatial Information Authority of Japan (GSI) Tiles)
Example of a photo linked to a feature in QField (created by processing Geospatial Information Authority of Japan (GSI) Tiles)

This article shows how to attach photos and other files to features in QField, along with tips for using attachments more efficiently.

How to create an attachment attribute in QGIS

To use this feature in QField, you first need to set up a file attachment attribute on the target layer in QGIS.

Open the QGIS project and add a text attribute (media in this example). Then open the properties of the target layer and select the attribute on the Attributes Form tab. For Widget Type, select Attachment.

Setting the widget type to Attachment in the QGIS attributes form
Setting the widget type to Attachment in the QGIS attributes form

Once this is set, the attribute form shows a ... button for the target attribute when you edit a feature. Use it to choose a file to attach.

The text attribute now appears as an attachment
The text attribute now appears as an attachment

For more details on configuring attribute forms, see the following article.

Attach files to attribute values in QField

Attach a file to a feature in QField

Next, check how the attribute looks in the QField app. Save the QGIS project and transfer it to your mobile device.

For details on transferring projects, see the following article.

After the transfer, open the project in QField. In edit mode, tap a feature to see the attribute ready for an attachment.

An attachment attribute displayed in QField (created by processing GSI Tiles)
An attachment attribute displayed in QField (created by processing GSI Tiles)

Tap the file icon to choose a file on the mobile device and attach it to the feature.

Tapping the file icon in the attribute panel (created by processing GSI Tiles)
Tapping the file icon in the attribute panel (created by processing GSI Tiles)

For example, when you select a photo, the image appears in the attribute panel.

A photo attached to a feature (created by processing GSI Tiles)
A photo attached to a feature (created by processing GSI Tiles)

You can also tap the ... button to the right of the attribute to show media attachment options for taking photos, recording video, and recording audio. This lets you link files in many formats directly to a feature.

The menu of attachment options (created by processing GSI Tiles)
The menu of attachment options (created by processing GSI Tiles)

Supported file types

This section introduces the types of media you can attach in QField.

Photo files

You can attach images already saved on the device, or take a photo on site and attach it directly.

A photo attached (created by processing GSI Tiles)
A photo attached (created by processing GSI Tiles)

Tap the curved-line icon at the top right of the cell to add a sketch directly on the image. This is handy for marking up a photo with annotations such as arrows and circles.

Annotations added to an image (created by processing GSI Tiles)
Annotations added to an image (created by processing GSI Tiles)

Video files

Attaching a video to a feature lets you record the surroundings in detail and view the subject from various angles.

A video attached (created by processing GSI Tiles)
A video attached (created by processing GSI Tiles)

Audio files

You can attach an audio file to a feature or record audio directly on site. This is especially useful for capturing ambient sounds, or for recording detailed observations by voice when typing is difficult.

A recording attached (created by processing GSI Tiles)
A recording attached (created by processing GSI Tiles)

Hand-drawn sketches

QField has a hand-drawn sketch feature. It is useful when you want to illustrate site conditions or complex layouts that are hard to explain with photos or text alone.

A sketch attached (created by processing GSI Tiles)
A sketch attached (created by processing GSI Tiles)

Document files

Besides multimedia files, you can attach document files such as PDFs. This lets you link materials such as analysis reports and specifications directly to your data.

A PDF file attached (created by processing GSI Tiles)
A PDF file attached (created by processing GSI Tiles)

Check attachments in QGIS

Next, check the files you attached in QField from QGIS.

Transfer the QField project package from the mobile device to your computer and open the project file in QGIS. You can also synchronize with the original QGIS project using the QFieldSync plugin.

Open the attribute table for the features you edited in QField to see the paths of the attached files.

The attachment preview does not appear because the attribute form settings do not specify Image as the viewer type. The next section explains how to set this.
The paths of the attached files displayed (created by processing GSI Tiles)
The paths of the attached files displayed (created by processing GSI Tiles)

If you check the QField project folder in a file explorer, you can see that the attached files are stored in the files folder.

The attached files stored in the files folder
The attached files stored in the files folder
If you have not set the Integrated Document Viewer type in the attribute form, attachments are saved to the files folder by default. If you set the viewer type to Image, Video, or Audio, the default folders are DCIM, video, and audio, respectively.

Tips for getting the most out of attachments

This section introduces a few practical tips for entering data in QField more efficiently.

Record photos and videos with one tap

In the attribute form settings of the layer properties in QGIS, you can set the Integrated Document Viewer type to the kind of file content: image, audio (recording), or video.

With this setting, QField adds a shortcut button to the attachment attribute, so you can record a specific kind of multimedia with one tap.

Selecting Image as the Integrated Document Viewer type
Selecting Image as the Integrated Document Viewer type

For example, if you select Image, a camera button replaces the file attachment icon, and you can take a photo on site with one tap.

The camera button displayed (created by processing GSI Tiles)
The camera button displayed (created by processing GSI Tiles)
Tap the ... button to attach other types of files, such as video and audio.

Setting the Integrated Document Viewer type also lets you see images registered in QField in the QGIS attribute form.

An image registered in QField displayed in the QGIS attribute form
An image registered in QField displayed in the QGIS attribute form

Set a maximum size for attached images

Setting a maximum size for attached images saves project storage. You make this setting in QGIS.

From the menu bar, choose Project → Properties.

Clicking Properties in the Project menu (created by processing GSI Tiles)
Clicking Properties in the Project menu (created by processing GSI Tiles)

In the project properties dialog, select the QField tab. This tab appears once you install the QFieldSync plugin.

Click the Attachments and Directories tab to set Maximum allowed width or height (in pixels) of image attachments.

Setting the maximum allowed width or height of image attachments
Setting the maximum allowed width or height of image attachments

For example, if you set the maximum size to 800 pixels, images registered afterward are automatically compressed to that size.

An image automatically compressed to 800 pixels
An image automatically compressed to 800 pixels

Add location and a timestamp to attached photos

You can automatically add the shooting time, location, and other custom information to photos.

To set this up, select the QField tab in the QGIS project properties and click the Attachments and Directories tab. Then click the Settings button for Customize image stamping details.

Clicking the Settings button for Customize image stamping details
Clicking the Settings button for Customize image stamping details

Check Always stamp images taken using the QField camera to show information such as the date, time, and coordinates. You can also customize the information shown by editing the expression in Details template.

Checking the Always stamp images taken using the QField camera option
Checking the Always stamp images taken using the QField camera option

With this setting applied in QField, photos you take automatically include information such as the shooting date, the latitude and longitude of the location, and the altitude.

Information automatically added to the photo
Information automatically added to the photo

Customize attachment file names and folders

By default, an attachment file name follows the format “layer name_date and time_attachment file name”. However, you may want to base file names on the value of a specific attribute. You can change this on the QField tab in the properties of the target layer.

For example, to name files in the files folder in the format “attribute value_date and time.extension”, go to Attachments Settings and click the ε button in the Naming Expression column of the row for the target attribute. Then enter 'files/' || "attribute_name" || '_' || format_date(now(),'yyyyMMddhhmmss') || '.{extension}'.

Entering a naming expression in the attachment settings
Entering a naming expression in the attachment settings

With this setting, attachments are automatically named by combining the attribute value of the feature with the date and time.

Registered files automatically named by combining the feature name and the date and time (created by processing GSI Tiles)
Registered files automatically named by combining the feature name and the date and time (created by processing GSI Tiles)

To organize attachments into folders by registration date, enter the expression 'files/' || format_date(now(),'yyyyMMdd') || '/' || format_date(now(),'yyyyMMddhhmmss') || '.{extension}'.

An expression that automatically organizes folders by registration date
An expression that automatically organizes folders by registration date

This sorts attachments into folders automatically, by the date you registered the photos.

Attachments automatically organized into folders by date
Attachments automatically organized into folders by date

Conclusion

This article showed how to set up attachment attributes in QField and how to use photos, videos, recordings, sketches, and other media in field surveys. These features make it possible to collect more accurate and detailed data than with traditional paper-based surveys.

The image attachment feature also offers more advanced options. For details, see the following page.

About the author
QGIS LAB Editorial Team
QGIS LAB Editorial Team

QGIS LAB is a comprehensive information hub for QGIS, the open-source GIS software. Under the concept of “Geospatial for Greater Good,” we share the knowledge and skills to open up the world through location data.