Bug 467623

Summary: I do "Item > Write Metadata to File" = Erases the Altitude field and leaves Altitude at Zero(0)
Product: [Applications] digikam Reporter: Galen Adams <gadams3rd>
Component: Maintenance-MetadataAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: metzpinguin
Priority: NOR    
Version First Reported In: 7.10.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 8.0.0
Sentry Crash Report:
Attachments: 2023-03-09_144709_S90_0001_A.jpg
2023-03-09_144748_S90_0002_A.jpg
2023-03-09_144807_S90_0003_A.jpg
2023-03-09_144709_S90_0001_B.jpg
2023-03-09_144748_S90_0002_B.jpg
2023-03-09_144807_S90_0003_B.jpg
2023-03-09_144709_S90_0001_C.jpg
2023-03-09_144748_S90_0002_C.jpg
2023-03-09_144807_S90_0003_C.jpg
2023-03-09_144709_S90_0001_A.jpg
2023-03-09_144748_S90_0002_A.jpg
2023-03-09_144807_S90_0003_A.jpg
2023-03-09_144709_S90_0001_B.jpg
2023-03-09_144748_S90_0002_B.jpg
2023-03-09_144807_S90_0003_B.jpg
2023-03-09_144709_S90_0001_C.jpg
2023-03-09_144748_S90_0002_C.jpg
2023-03-09_144807_S90_0003_C.jpg
attachment-1231486-0.html
attachment-1232424-0.html
attachment-1232817-0.html
attachment-1521683-0.html

Description Galen Adams 2023-03-20 18:58:13 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Prior to digiKam, all GPS information is embedded in the jpeg file; checking digiKam metadata shows the correct Altitude.

I do "Item > Write Metadata to File" = Erases the Altitude field and leaves Altitude at Zero(0)

It happens with a single jpeg or a whole batch and it happens every time.
Comment 1 Maik Qualmann 2023-03-20 19:46:27 UTC
I can't reproduce the problem here with digiKam-8.0.0.
The problem can actually only occur if the geolocation metadata has not been correctly read into the database. First look in the right sidebar in the map view. Is the altitude displayed correctly? Then perform a metadata write operation. Is their altitude actually reset then? If yes, we need a sample image with which the problem occurs.

Maik
Comment 2 Galen Adams 2023-03-20 22:18:15 UTC
Created attachment 157456 [details]
2023-03-09_144709_S90_0001_A.jpg

Okay, I tested another bunch of jpegs.
Before doing anything in digiKam, embedded GPS data was showing the correct
Altitudes in every of several programs I checked including ExifToolGUI and
in digiKam itself.
These three image files "A" are BEFORE; note that Metadata > Exif > Global
Positioning System GPS Altitude is showing 314.2 m; whereas, in Map,
Altitude is showing "Undefined"
[image: 2023-03-09_144709_S90_0001_A.jpg]
[image: 2023-03-09_144748_S90_0002_A.jpg]
[image: 2023-03-09_144807_S90_0003_A.jpg]

These are the same files, now "B", after "Item > Write Metadata to Selected
Files" : note that Metadata > Exif > Global Positioning System GPS Altitude
and Map are both now showing Zero (0) m; now, every program I check shows
the Altitude to be Zero (0).

[image: 2023-03-09_144748_S90_0002_B.jpg]
[image: 2023-03-09_144807_S90_0003_B.jpg]
[image: 2023-03-09_144709_S90_0001_B.jpg]

Here are the same three files, now "C", after restoring the correct
Altitude in ExifToolGUI and doing "Item > Reread Metadata from Files" ;
correct Altitude is displaying in all programs and MAP is still insisting
Altitude is Zero (0).

[image: 2023-03-09_144748_S90_0002_C.jpg]
[image: 2023-03-09_144807_S90_0003_C.jpg]
[image: 2023-03-09_144709_S90_0001_C.jpg]

Last, although the Altitude was displaying correctly in every other
program, I loaded the files in "Item > Edit Geolocation" and manually
entered the Altitude there; it would only allow me to do them one at a
time; then, and only then, did the correct Altitude finally show up in Map.

This behavior has to be some sort of glitch in digiKam properly recognizing
the Altitude.

Thanks for taking the time to investigate this.



On Mon, Mar 20, 2023 at 2:46 PM Maik Qualmann <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=467623
>
> Maik Qualmann <metzpinguin@gmail.com> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|                            |metzpinguin@gmail.com
>
> --- Comment #1 from Maik Qualmann <metzpinguin@gmail.com> ---
> I can't reproduce the problem here with digiKam-8.0.0.
> The problem can actually only occur if the geolocation metadata has not
> been
> correctly read into the database. First look in the right sidebar in the
> map
> view. Is the altitude displayed correctly? Then perform a metadata write
> operation. Is their altitude actually reset then? If yes, we need a sample
> image with which the problem occurs.
>
> Maik
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 3 Galen Adams 2023-03-20 22:18:15 UTC
Created attachment 157457 [details]
2023-03-09_144748_S90_0002_A.jpg
Comment 4 Galen Adams 2023-03-20 22:18:15 UTC
Created attachment 157458 [details]
2023-03-09_144807_S90_0003_A.jpg
Comment 5 Galen Adams 2023-03-20 22:18:15 UTC
Created attachment 157459 [details]
2023-03-09_144709_S90_0001_B.jpg
Comment 6 Galen Adams 2023-03-20 22:18:15 UTC
Created attachment 157460 [details]
2023-03-09_144748_S90_0002_B.jpg
Comment 7 Galen Adams 2023-03-20 22:18:15 UTC
Created attachment 157461 [details]
2023-03-09_144807_S90_0003_B.jpg
Comment 8 Galen Adams 2023-03-20 22:18:15 UTC
Created attachment 157462 [details]
2023-03-09_144709_S90_0001_C.jpg
Comment 9 Galen Adams 2023-03-20 22:18:15 UTC
Created attachment 157463 [details]
2023-03-09_144748_S90_0002_C.jpg
Comment 10 Galen Adams 2023-03-20 22:18:15 UTC
Created attachment 157464 [details]
2023-03-09_144807_S90_0003_C.jpg
Comment 11 Galen Adams 2023-03-20 22:27:44 UTC
Created attachment 157465 [details]
2023-03-09_144709_S90_0001_A.jpg

A suggestion --- use ExifTool, ExifToolGUI, or XnViewMP to add GPS and
Altitude values in some test files - NOT in digiKam itself --- and then see
if digiKam Map will display the Altitude.
Thanks.


On Mon, Mar 20, 2023 at 5:17 PM Galen Adams <gadams3rd@gmail.com> wrote:

> Okay, I tested another bunch of jpegs.
> Before doing anything in digiKam, embedded GPS data was showing the
> correct Altitudes in every of several programs I checked including
> ExifToolGUI and in digiKam itself.
> These three image files "A" are BEFORE; note that Metadata > Exif > Global
> Positioning System GPS Altitude is showing 314.2 m; whereas, in Map,
> Altitude is showing "Undefined"
> [image: 2023-03-09_144709_S90_0001_A.jpg]
> [image: 2023-03-09_144748_S90_0002_A.jpg]
> [image: 2023-03-09_144807_S90_0003_A.jpg]
>
> These are the same files, now "B", after "Item > Write Metadata to
> Selected Files" : note that Metadata > Exif > Global Positioning System GPS
> Altitude and Map are both now showing Zero (0) m; now, every program I
> check shows the Altitude to be Zero (0).
>
> [image: 2023-03-09_144748_S90_0002_B.jpg]
> [image: 2023-03-09_144807_S90_0003_B.jpg]
> [image: 2023-03-09_144709_S90_0001_B.jpg]
>
> Here are the same three files, now "C", after restoring the correct
> Altitude in ExifToolGUI and doing "Item > Reread Metadata from Files" ;
> correct Altitude is displaying in all programs and MAP is still insisting
> Altitude is Zero (0).
>
> [image: 2023-03-09_144748_S90_0002_C.jpg]
> [image: 2023-03-09_144807_S90_0003_C.jpg]
> [image: 2023-03-09_144709_S90_0001_C.jpg]
>
> Last, although the Altitude was displaying correctly in every other
> program, I loaded the files in "Item > Edit Geolocation" and manually
> entered the Altitude there; it would only allow me to do them one at a
> time; then, and only then, did the correct Altitude finally show up in Map.
>
> This behavior has to be some sort of glitch in digiKam properly
> recognizing the Altitude.
>
> Thanks for taking the time to investigate this.
>
>
>
> On Mon, Mar 20, 2023 at 2:46 PM Maik Qualmann <bugzilla_noreply@kde.org>
> wrote:
>
>> https://bugs.kde.org/show_bug.cgi?id=467623
>>
>> Maik Qualmann <metzpinguin@gmail.com> changed:
>>
>>            What    |Removed                     |Added
>>
>> ----------------------------------------------------------------------------
>>                  CC|                            |metzpinguin@gmail.com
>>
>> --- Comment #1 from Maik Qualmann <metzpinguin@gmail.com> ---
>> I can't reproduce the problem here with digiKam-8.0.0.
>> The problem can actually only occur if the geolocation metadata has not
>> been
>> correctly read into the database. First look in the right sidebar in the
>> map
>> view. Is the altitude displayed correctly? Then perform a metadata write
>> operation. Is their altitude actually reset then? If yes, we need a sample
>> image with which the problem occurs.
>>
>> Maik
>>
>> --
>> You are receiving this mail because:
>> You reported the bug.
>
>
Comment 12 Galen Adams 2023-03-20 22:27:45 UTC
Created attachment 157466 [details]
2023-03-09_144748_S90_0002_A.jpg
Comment 13 Galen Adams 2023-03-20 22:27:45 UTC
Created attachment 157467 [details]
2023-03-09_144807_S90_0003_A.jpg
Comment 14 Galen Adams 2023-03-20 22:27:45 UTC
Created attachment 157468 [details]
2023-03-09_144709_S90_0001_B.jpg
Comment 15 Galen Adams 2023-03-20 22:27:45 UTC
Created attachment 157469 [details]
2023-03-09_144748_S90_0002_B.jpg
Comment 16 Galen Adams 2023-03-20 22:27:45 UTC
Created attachment 157470 [details]
2023-03-09_144807_S90_0003_B.jpg
Comment 17 Galen Adams 2023-03-20 22:27:45 UTC
Created attachment 157471 [details]
2023-03-09_144709_S90_0001_C.jpg
Comment 18 Galen Adams 2023-03-20 22:27:45 UTC
Created attachment 157472 [details]
2023-03-09_144748_S90_0002_C.jpg
Comment 19 Galen Adams 2023-03-20 22:27:45 UTC
Created attachment 157473 [details]
2023-03-09_144807_S90_0003_C.jpg
Comment 20 Maik Qualmann 2023-03-21 07:10:10 UTC
Thanks for the sample images. With which program or device was the GPS information written into your images? The problem is that Exif.GPSInfo.GPSAltitudeRef is not present in your images. So the specification below or above sea level. Therefore we ignore the altitude in the images when importing. We can of course simply assume above sea level as a bug fix if GPSAltitudeRef is not available. I have never seen that the GPSAltitudeRef information is missing if altitude is available.

Maik
Comment 21 Galen Adams 2023-03-21 07:19:14 UTC
Created attachment 157484 [details]
attachment-1231486-0.html

>>" With which program or device was the GPS
information written into your images?"<<

Some were written with ExifToolGUI and some were written with XnViewMP.

I checked some that were written with the onboard GPS in my 7DMkII and they
work fine in digiKam Map.

I would have thought that below sea level altitudes would have negative
values; but then, I haven't taken any pictures under the ocean's surface.

On Tue, Mar 21, 2023 at 2:10 AM Maik Qualmann <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=467623
>
> --- Comment #20 from Maik Qualmann <metzpinguin@gmail.com> ---
> Thanks for the sample images. With which program or device was the GPS
> information written into your images? The problem is that
> Exif.GPSInfo.GPSAltitudeRef is not present in your images. So the
> specification
> below or above sea level. Therefore we ignore the altitude in the images
> when
> importing. We can of course simply assume above sea level as a bug fix if
> GPSAltitudeRef is not available. I have never seen that the GPSAltitudeRef
> information is missing if altitude is available.
>
> Maik
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 22 Maik Qualmann 2023-03-21 07:31:51 UTC
Git commit 40e0023d0c2695f9399d2e939dd41a89253933ff by Maik Qualmann.
Committed on 21/03/2023 at 07:30.
Pushed by mqualmann into branch 'master'.

if AltitudeRef is not present assume above sea level
FIXED-IN: 8.0.0

M  +1    -2    NEWS
M  +43   -39   core/libs/metadataengine/engine/metaengine_gps.cpp

https://invent.kde.org/graphics/digikam/commit/40e0023d0c2695f9399d2e939dd41a89253933ff
Comment 23 Galen Adams 2023-03-21 07:35:24 UTC
Created attachment 157485 [details]
attachment-1232424-0.html

Awesome, thanks!  Much Appreciated

On Tue, Mar 21, 2023 at 2:31 AM Maik Qualmann <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=467623
>
> Maik Qualmann <metzpinguin@gmail.com> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>    Version Fixed In|                            |8.0.0
>              Status|REPORTED                    |RESOLVED
>          Resolution|---                         |FIXED
>       Latest Commit|                            |
> https://invent.kde.org/grap
>                    |
> |hics/digikam/commit/40e0023
>                    |
> |d0c2695f9399d2e939dd41a8925
>                    |                            |3933ff
>
> --- Comment #22 from Maik Qualmann <metzpinguin@gmail.com> ---
> Git commit 40e0023d0c2695f9399d2e939dd41a89253933ff by Maik Qualmann.
> Committed on 21/03/2023 at 07:30.
> Pushed by mqualmann into branch 'master'.
>
> if AltitudeRef is not present assume above sea level
> FIXED-IN: 8.0.0
>
> M  +1    -2    NEWS
> M  +43   -39   core/libs/metadataengine/engine/metaengine_gps.cpp
>
>
> https://invent.kde.org/graphics/digikam/commit/40e0023d0c2695f9399d2e939dd41a89253933ff
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 24 Maik Qualmann 2023-03-21 07:38:56 UTC
Note that if a digiKam version is available with this fix, you will need to re-read the metadata of images that do not contain an AltitudeRef so that writing metadata does not result in zero altitude.

Maik
Comment 25 Galen Adams 2023-03-21 07:43:12 UTC
Created attachment 157486 [details]
attachment-1232817-0.html

Got it. Thanks for alerting me as I would probably not have thought about
that myself before I messed up.

On Tue, Mar 21, 2023 at 2:38 AM Maik Qualmann <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=467623
>
> --- Comment #24 from Maik Qualmann <metzpinguin@gmail.com> ---
> Note that if a digiKam version is available with this fix, you will need to
> re-read the metadata of images that do not contain an AltitudeRef so that
> writing metadata does not result in zero altitude.
>
> Maik
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 26 Galen Adams 2023-03-24 21:54:38 UTC
I have tested the fix = this is what is happening now when Write Metadata to Selected Files:

When I choose a file(s) that lacks the Altitude reference, it changes the Altitude to Zero(0) and adds the reference Above Sea Level.

Thanks
Comment 27 Maik Qualmann 2023-03-24 22:45:12 UTC
I can't reproduce the problem. Note that XMP-GPS metadata takes precedence over Exif because of sidecars. Your sample images also have GPS metadata in XMP. Otherwise send me a sample image that should not have any altitude information and with which the problem occurs.

Maik
Comment 28 Galen Adams 2023-03-24 22:53:24 UTC
Created attachment 157558 [details]
attachment-1521683-0.html

Maybe my explanation was unclear - like before, the affected images do have
Altitude and not Altitude Reference.

When I do Write Metadata to Selected Files, it still changes Altitude to
Zero(0) and now it also fills in the Altitude Reference with Above Sea
Level (which would be fine if it didn't change the Altitude)

I will send more image files soon.

On Fri, Mar 24, 2023 at 5:45 PM Maik Qualmann <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=467623
>
> --- Comment #27 from Maik Qualmann <metzpinguin@gmail.com> ---
> I can't reproduce the problem. Note that XMP-GPS metadata takes precedence
> over
> Exif because of sidecars. Your sample images also have GPS metadata in XMP.
> Otherwise send me a sample image that should not have any altitude
> information
> and with which the problem occurs.
>
> Maik
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 29 Maik Qualmann 2023-03-25 05:18:36 UTC
Git commit 0a08ca0cd21eadf238a12a453b936a5292fd9f71 by Maik Qualmann.
Committed on 25/03/2023 at 05:16.
Pushed by mqualmann into branch 'master'.

check if altitude is present when writing metadata
DIXED-IN: 8.0.0

M  +3    -1    core/libs/fileactionmanager/metadatahub.cpp

https://invent.kde.org/graphics/digikam/commit/0a08ca0cd21eadf238a12a453b936a5292fd9f71
Comment 30 Maik Qualmann 2023-03-25 05:30:21 UTC
Note: With the Geolocation Editor you can remove zero altitudes that have arisen or fill in the altitude automatically via the web service.

Maik
Comment 31 Galen Adams 2023-03-25 05:41:04 UTC
These are the BEFORE images - after the recent fix.

[image: Before_2022-02-21_135925_D7D_0004_I.jpg]
[image: Before_2022-02-21_140020_D7D_0007_I.jpg]
[image: Before_2022-04-15_171811_D7D_0030_I.jpg]
[image: Before.png]

On Sat, Mar 25, 2023 at 12:30 AM Maik Qualmann <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=467623
>
> --- Comment #30 from Maik Qualmann <metzpinguin@gmail.com> ---
> Note: With the Geolocation Editor you can remove zero altitudes that have
> arisen or fill in the altitude automatically via the web service.
>
> Maik
>
> --
> You are receiving this mail because:
> You reported the bug.