opengisch / QField

A simplified touch optimized interface for QGIS
http://www.qfield.org
GNU General Public License v2.0
793 stars 218 forks source link

Support positioning functions in attachment file name expressions #5447

Open cruelaid opened 1 month ago

cruelaid commented 1 month ago

Describe the issue

Positioning functions such as @gnss_orientation do not work as expected within the attachment naming expression.

Reproduction steps

Steps to reproduce the behavior:

  1. Setup a geometry layer in QGIS with a field for attachments.
  2. In the Qfield tab of the layer properties, use 'DCIM/layer_' || @gnss_orientation || '.{extension}' or a similar expression as the attachment naming scheme.
  3. Open the project in Qfield and use the camera widget to snap a photo
  4. View the file name of the photo.

Expected behavior

The file should have a name such as layer_25.416004835.jpg

Observed behavior

The image name reverts to the default naming scheme, indicating an error or null value in the expression.

Desktop (please complete the following information)

Mobile (please complete the following information)

Additional information

Storing the device's orientation at the moment the photo is taken is useful for a variety of applications. Extracting exif data from photos taken with the Open Camera app used to be the way to do this, but the app is apparently unable to interact with Qfield as of Android 11. Qfield's built-in camera and many native cameras also do not appear to store this exif data. Merely creating a field with @gnss_orientation as the default value would store the device orientation when the feature was added, not when the photo was taken. An alternative solution would be to add the exif data to Qfield's built-in camera widget.

nirvn commented 1 month ago

@cruelaid , transformed that into an enhancement request, it is indeed the case that the attachment file naming does not yet support positioning (and qfieldcloud) scopes.