Skip to content

Commit

Permalink
Add GPS metadata to image reflecting the time the photo was snapped
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Oct 29, 2023
1 parent 383893d commit 333f08f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/qml/imports/QFieldControls/+Qt5/QFieldCamera.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Popup {
property bool isPortraitMode: mainWindow.height > mainWindow.width

property string currentPath
property var currentPosition

signal finished(string path)
signal canceled()
Expand Down Expand Up @@ -246,6 +247,7 @@ Popup {
onClicked: {
if (cameraItem.state == "PhotoCapture") {
camera.imageCapture.captureToLocation(qgisProject.homePath+ '/DCIM/')
currentPosition = positionSource.positionInformation
} else if (cameraItem.state == "VideoCapture") {
if (camera.videoRecorder.recorderState == CameraRecorder.StoppedState) {
camera.videoRecorder.record()
Expand All @@ -260,7 +262,7 @@ Popup {
} else if (cameraItem.state == "PhotoPreview" || cameraItem.state == "VideoPreview") {
if (cameraItem.state == "PhotoPreview") {
if (settings.geoTagging && positionSource.active) {
FileUtils.addImageMetadata(currentPath, positionSource.positionInformation)
FileUtils.addImageMetadata(currentPath, currentPosition)
}
}
cameraItem.finished(currentPath)
Expand Down
4 changes: 3 additions & 1 deletion src/qml/imports/QFieldControls/+Qt6/QFieldCamera.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Popup {
property bool isPortraitMode: mainWindow.height > mainWindow.width

property string currentPath
property var currentPosition

signal finished(string path)
signal canceled()
Expand Down Expand Up @@ -210,6 +211,7 @@ Popup {
onClicked: {
if (cameraItem.state == "PhotoCapture") {
captureSession.imageCapture.captureToFile(qgisProject.homePath+ '/DCIM/')
currentPosition = positionSource.positionInformation
} else if (cameraItem.state == "VideoCapture") {
if (captureSession.recorder.recorderState === MediaRecorder.StoppedState) {
captureSession.recorder.record()
Expand All @@ -224,7 +226,7 @@ Popup {
} else if (cameraItem.state == "PhotoPreview" || cameraItem.state == "VideoPreview") {
if (cameraItem.state == "PhotoPreview") {
if (settings.geoTagging && positionSource.active) {
FileUtils.addImageMetadata(currentPath, positionSource.positionInformation)
FileUtils.addImageMetadata(currentPath, currentPosition)
}
}
cameraItem.finished(currentPath)
Expand Down

1 comment on commit 333f08f

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.