# Exif Metadata
EXIF is a file format for storing metadata in image files, such as the camera settings, image metrics, date and time or location information (see, e.g., Wikipedia (opens new window)). Mergin Maps Input supports some default value expression functions that can be used to read EXIF metadata and store their values in the fields of your survey layer.
To store GPS EXIF metadata, both Mergin Maps Input and your camera app have location permissions allowed on your mobile device.
Clone documentation/exif-metadata (opens new window) to see how it works!
# How to use EXIF metadata
To store EXIF metadata values in the fields of your survey layer:
In QGIS, open the Properties of your survey layer and navigate to the Attributes Form tab.
Now we need to set the default values of fields that should store EXIF metadata.
Supported EXIF functions are listed below. In general, EXIF functions looks like this:
This expression requires the absolute path to an image. The absolute path can be defined using the field where the image is stored (here:
photo, this is a text field with attachment widget) and the
@project_homevariable that refers to the project home folder.
For example, the default value expression for the direction of the image (EXIF tag
GPSImgDirection) can be defined as follows:
read_exif(@project_home + '/' + "photo", 'GPSImgDirection')
The preview shows a warning Function is not known. This is OK, Mergin Maps Input will know what to do with it!
Save and sync your project.
Open the project in Mergin Maps Input. Once you capture a photo during the field survey, the EXIF metadata values will be automatically filled in:
# Supported EXIF functions
EXIF function supported by Mergin Maps Input:
read_exif_img_direction('<ABSOLUTE_PATH_TO_IMAGE>')returns the direction of the image when captured. The direction is represented by a number.
read_exif_latitude('<ABSOLUTE_PATH_TO_IMAGE>')returns GPS Latitude as a decimal number.
read_exif_longitude('<ABSOLUTE_PATH_TO_IMAGE>')returns GPS Longitude as a decimal number.
read_exif('<ABSOLUTE_PATH_TO_IMAGE>', '<EXIF_TAG_STRING>'), where EXIF tag string defines the EXIF property, such as:
GPSImgDirectionreturns the direction of the image when captured as a rational. The direction is represented by a rational, e.g. 350/1.
GPSLatitudereturns GPS Latitude as rationals, e.g. 48/1, 6/1, 309275/10000.
GPSLongitudereturns GPS Longitude as rationals, e.g. 17/1, 6/1, 244907/10000.
ImageWidthreturns the image width in pixels.
Note that some of the tag names listed in ExifTool documentation (opens new window) can differ from the EXIF specification. As an example, while
ImageWidth tag is valid,
ImageHeight is not and you have to use
ImageLength tag name (defined by EXIF specification) when recording EXIF metadata in Mergin Maps Input.
EXIF tags that can be retrieved from your images can vary depending on how they were created (e.g. what type of device you used to capture photos). EXIF tags that are recorded in your image can be displayed, e.g., using ExifTool (opens new window):
exiftool -n -S <PATH_TO_IMAGE>
However, keep in mind that the EXIF tag names that you get from ExifTool can differ from EXIF specification. To store EXIF metadata using Mergin Maps, you have to use the latter.
# Allowing location tags
Location tags have to be allowed in the camera settings to store GPS EXIF metadata.
Android: Open Camera app -> Camera settings -> Location tags.
iOS: Open Settings -> Privacy -> Location Services -> Camera (app).