Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GPS metadata to image reflecting the time the photo was snapped #4699

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading