Bug 326406 - A picture without geolocalisation is localized in North Pole
Summary: A picture without geolocalisation is localized in North Pole
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Gps (show other bugs)
Version: 4.14.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-21 20:24 UTC by Nicofo
Modified: 2017-12-29 20:03 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.8.0


Attachments
DK pre5.8 picture with no GPS (192.80 KB, image/png)
2017-12-26 11:08 UTC, Nicofo
Details
Comparaison DK5.7 and DK pre5.8 (422.32 KB, application/x-troff-man)
2017-12-26 11:10 UTC, Nicofo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicofo 2013-10-21 20:24:21 UTC
When my camera fails to geolocalize a picture, digikam thinks the picture has been taken in North Pole (instead of saying "there is no geolocation information").

An example of such picture is given:
http://nicofo.tuxfamily.org/tmp/panasonic-tz40-no-GPS.JPG
-> see Geolocation tab (on the right tab in digikam)

Reproducible: Always




Bug present with digikam 3.5 and 3.4 (not tested with older versions)
Comment 1 caulier.gilles 2013-10-21 20:30:26 UTC
This want mean that GPS info set by camera when sync with satellites is not done are set to north pole.

With my A77, in this case, sometimes GPS info do not exist, or GPS info are set in equator (Africa).
This depend of status of GPS sync when picture have been taken.

Are you sure that GPS info do not exist in image ? Look in Exif metadata viewer, in full display mode.

Gilles Caulier
Comment 2 Nicofo 2013-10-21 21:21:05 UTC
There are indeed GPS info in the picture, but they are not relevant and should therefore not be considered by digikam.
The GPS tags are given below: there are enough information that inform digikam that it should not take the GPS infomation into account:
- GPS date = 0
- GPS time = 0
- GPS Data Degree of Precision : 0/10       <----- good clue ;-)
_______________________________________________________________
>>> Global Positioning System <<<

GPS Version ID : 2.3.0.0
GPS Time Stamp : 00:00:00
GPS Status : Measurement Interoperability
GPS Processing Method : 65 83 67 73 73 0 0 0 71 80 83 0 0 0
GPS Measure Mode : Two-dimensional measurement
GPS Map Datum : WGS-84
GPS Longitude Reference : East
GPS Longitude : 16777215deg 16777215' 167772.150"
GPS Latitude Reference : North
GPS Latitude : 16777215deg 16777215' 167772.150"
GPS Image Direction Reference : Magnetic direction
GPS Image Direction : 6750/100
GPS Date Stamp : 0000:00:00
GPS Data Degree of Precision : 0/10
GPS Area Information : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
GPS Altitude Reference : Above sea level
GPS Altitude : 0 m
Comment 3 caulier.gilles 2013-10-22 05:08:24 UTC
That i suspected.

I don't know tag titled "GPS Data Degree of Precision". This can be a good clue to know if GPS info are suitable or not. I take a look

Note : can you share some pictures to test here ?

Gilles Caulier
Comment 4 Nicofo 2013-10-22 11:53:39 UTC
(In reply to comment #3)
> I don't know tag titled "GPS Data Degree of Precision". This can be a good
> clue to know if GPS info are suitable or not. I take a look
> 
> Note : can you share some pictures to test here ?

Yes: the first picture has no relevant GPS information; the second one has GPS:
http://nicofo.tuxfamily.org/tmp/panasonic-tz40-no-GPS.JPG
http://nicofo.tuxfamily.org/tmp/panasonic-tz40-GPSinfo.JPG
Thanks !
Comment 5 Nicofo 2014-08-22 17:54:33 UTC
This bug is still present with DK 4.2.

I have 2 more pictures to share:

 - here the GPS is not activated on the camera: http://nicofo.tuxfamily.org/tmp/panasonic-tz40-GPS NOT ACTIVE.JPG -> digikam displays it in Africa - equator
 - here the GPS is activated, but no signal is found (similar with panasonic-tz40-no-GPS.JPG): http://nicofo.tuxfamily.org/tmp/panasonic-tz40-GPS ACTIVE BUT NO SIGNAL.JPG -> digikam displays it in North Pole
Comment 7 caulier.gilles 2015-05-11 14:50:19 UTC
Nicofo,

Which value of "GPS Data Degree of Precision" tag can we use to considerate that GPS location measured are acceptable or not ?

With your image a non suitable GPS info is for these conditions :

- GPS Data Degree of Precision do not exist
- GPS Data Degree of Precision = 0

Right ?

Gilles Caulier
Comment 8 Nicofo 2015-05-11 20:14:21 UTC
Yes, this is correct:
- GPS Data Degree of Precision do not exist (when GPS not activated -> as a result the localization is Equator)
- GPS Data Degree of Precision = 0 (when GPS activated, but localisation not performed -> as a result localisation is North Pole)

Thanks for investigating this bug, it would really help me to sort geolocalised files ;)
Comment 9 caulier.gilles 2015-05-12 05:06:03 UTC
The tag GPS Data Degree of Precision is this one :

http://www.awaresystems.be/imaging/tiff/tifftags/privateifd/gps/gpsdop.html

Technically, it's DOP feature explained in these pages :

http://en.wikipedia.org/wiki/Dilution_of_precision_%28GPS%29
http://www.radio-electronics.com/info/satellite/gps/accuracy-errors-precision.php

Now, look exactly the possible values of DOP and the accuracy of GPS measurement :

http://en.wikipedia.org/wiki/Dilution_of_precision_%28GPS%29#Meaning_of_DOP_Values

You can see : < 1 best values !!! This is the opposite of the fact listed in this file. I'm lost.

Note : If i want to patch code to take a care about DOP before to register or use GPS info, this will very easy. I just to add a test in this method about DOP :

https://projects.kde.org/projects/kde/kdegraphics/libs/libkexiv2/repository/revisions/master/entry/libkexiv2/kexiv2gps.cpp#L43

The method return boolean value is GPS info are valid or not in metadata. Testing DOP here is easy but which rules i need to plug in code exactly ?

Gilles Caulier
Comment 10 caulier.gilles 2015-05-12 05:18:20 UTC
There is another problem :

My photo taken with iPhone 5s which are geo-localized do not have DOP tag, but GPS info are correct. I have a lots of images in this case...

So the DOP tag presence or not is not enough to validate or not that GPS info are valid or not.

The only possible rules with DOP is :

- If tags is present, check the value to see if accuracy is enough to accept GPS info.
- If tags is not present, take GPS info a well (current implementation rules)

The question about the condition to check DOP value to still open. What do you think about these rules :

DOP = 0 => GPS info not valid.
0 < DOP < 10 => GPS Info suitable. (see documentation about meaning DOP value in wikipedia)

Gilles Caulier
Comment 11 Nicofo 2015-05-18 21:17:09 UTC
Hi Gilles, 
I have checked other pictures and indeed DOP is confusing:

(In reply to Nicofo from comment #8)
> - GPS Data Degree of Precision do not exist (when GPS not activated -> as a result the localization is Equator)
> - GPS Data Degree of Precision = 0 (when GPS activated, but localisation not performed -> as a result localisation is North Pole)
This is correct, but I have to add that for the pictures that are well localized, GPS Data Degree of Precision can 0 as well !! (I have pictures with values from 0 to 25, ...)

So I would NOT use the DOP parameter (moreover, as you mentioned with iphone, this parameter is not managed by every device).

There are 2 cases that must be detected and discarded because the picture doesn't contain GPS information:
1) GPS is not activated (or the camera does not contain a GPS): in that case a lot of GPS tags are not present. In the case of my camera (panasonic tz40), there is no "GPS Latitude", "GPS Longitude" tags.
Note however that there could be some GPS tags even when GPS is not activated: like "GPS altitude" (=0), "GPS Version ID", "GPS Image Direction" (I guess if there is a compass, working even if GPS not active).
2) GPS is activated but localisation not done. In my case, all the GPS tags are present, but some tags are NULL:
- DOP (but we know now that this tag cannot be used)
- GPS Date Stamp
- GPS Time Stamp
- GPS Area information
[See comment #6 for pictures examples]

To summarize, I would consider GPS info is not valid if one of the following condition is met:
- tag "GPS Latitude" or "GPS Longitude" is not present
- tag "GPS Date Stamp" = 0000:00:00
(to check with other devices, but this seems to be generic).
Comment 12 caulier.gilles 2015-05-19 07:26:42 UTC
>- tag "GPS Latitude" or "GPS Longitude" is not present

This is already done in libkexiv2.

>- tag "GPS Date Stamp" = 0000:00:00

Well for this condition, i have plenty of valid geolocalized images without this tag. I collected these files from digiKam users in time... So we cannot use this one.

Gilles
Comment 13 Nicofo 2015-05-23 19:39:58 UTC
(In reply to Gilles Caulier from comment #12)
> >- tag "GPS Latitude" or "GPS Longitude" is not present
> 
> This is already done in libkexiv2.
No, it is not I think because I have pictures without these tags that are geolocalised by digikam (in Africa Equator). See example in picture [1] from comment #6


> >- tag "GPS Date Stamp" = 0000:00:00
> 
> Well for this condition, i have plenty of valid geolocalized images without
> this tag. I collected these files from digiKam users in time... So we cannot
> use this one.
Ok, we'll have to find another solution. When I'll have time, I'll make a full comparison between photos well geolocalised and not well geolocalised ...
Comment 14 Nicofo 2015-06-22 20:42:58 UTC
Hi Gilles,

I come back on this bug and reply to your last message with new thoughts:

To summarize, I would consider GPS info is not valid if one of the following condition is met:
- tag "GPS Latitude" or "GPS Longitude" is not present
> This is already done in libkexiv2.
As I said my previous comment, this is not true in my case. Can you check on your side ? Using digikam 4.10, the picture from comment #6 [1] (without "GPS Latitude" tag) appears to be geolocalised in Equator ...

- tag "GPS Date Stamp" = 0000:00:00
> Well for this condition, i have plenty of valid geolocalized images without
> this tag. I collected these files from digiKam users in time... So we cannot
> use this one.
OK, very well. If I understand you well, you have pictures that DOES NOT contain the tag "GPS Date Stamp" at all but are valid geolocalised ? What I say is different:
IF tag "GPS Date Stamp" exists BUT is null (0000:00:00), THEN the geolocalisation has failed and must be discarded.
OTHER SOLUTION, probably far easier : in this case (when GPS is active but geolocalisation not done -> digikam localises it in North Pole): the GPS Latitude/Longitude is 16777215°16777215'16777215"150 [note that 16777215 is 1111 1111 1111 1111 in binary] which is an impossible value for latitude and longitude:
- latitude range is 0 (equator) to 90 (pole)
- longitude range is -180 to 180
So if out of these ranges -> must be discarded ! Easy no ? ;)
Comment 15 caulier.gilles 2015-10-02 15:21:11 UTC
*** Bug 353456 has been marked as a duplicate of this bug. ***
Comment 16 Nicofo 2016-06-07 09:13:29 UTC
Hi Gilles,

what do you think about my previous suggestion ?

IF         tag "GPS Latitude" or "GPS Longitude" is not present
OR       tag is present but out of range (latitute [0-90] North/South ; longitude [-180 -180])
THEN  photo not geolocalised

Seems easy to implement ? (for a non-developper at least ;) )
Any chance to see that in Digikam 5.0 ?
Comment 17 Nicofo 2017-12-26 11:08:40 UTC
Created attachment 109525 [details]
DK pre5.8 picture with no GPS
Comment 18 Nicofo 2017-12-26 11:09:28 UTC
There is a little improvement with DK 5.8 (pre version 12/12/2017).

With DK 5.7, when GPS is not active with my camera, the picture:
 (1) had an indication 'geolocalised' (little map in the top-tight corner of the thumbnail)
 (2) appeared in Equator in the Map ('Map' button on the right panel)
 (3) appeared in Equator in the Map ('Map' view in the top panel, between 'Preview' and 'Table')

Now with DK pre-5.8:
 (1) OK  no more 'geolocalised' icon
 (2)NOK  still appears in Equator in the Map ('Map' button on the right panel)
 (3) OK  does not appear in Equator in the Map ('Map' view in the top panel, between 'Preview' and 'Table')

See attachment: the result is not consistent: on one side the picture is not geolocalised (no top-right icon), but on the other hand the picture appears on the map. But as said above, it appears only in (2), not in (3): very strange ...
Comment 19 Nicofo 2017-12-26 11:10:42 UTC
Created attachment 109526 [details]
Comparaison DK5.7 and  DK pre5.8

For information, comparaison DK 5.7 and pre 5.8 (12/12/2017)
Still problem also with pictures i North Pole
Comment 20 Maik Qualmann 2017-12-26 11:45:32 UTC
Is the latitude or longitude outside the valid range as in your sample image?

Maik
Comment 21 Maik Qualmann 2017-12-26 12:13:05 UTC
Git commit 88d97268df820436d23554607df0f4484693f6d2 by Maik Qualmann.
Committed on 26/12/2017 at 12:12.
Pushed by mqualmann into branch 'master'.

check valid range for longitude and latitude

M  +10   -0    libs/dmetadata/metaengine_gps.cpp

https://commits.kde.org/digikam/88d97268df820436d23554607df0f4484693f6d2
Comment 22 Maik Qualmann 2017-12-26 12:16:22 UTC
A new reading of the metadata of the wrong images is necessary. Can you send me the last image as an email to test?

Maik
Comment 23 Maik Qualmann 2017-12-26 17:26:13 UTC
Git commit 67b348d8a86d53cc754e16394160c81f78531bc8 by Maik Qualmann.
Committed on 26/12/2017 at 17:24.
Pushed by mqualmann into branch 'master'.

fix map view from the right sidebar if image has only altitude and no coordinates
FIXED-IN: 5.8.0

M  +2    -1    NEWS
M  +1    -1    libs/imageproperties/imagepropertiessidebardb.cpp

https://commits.kde.org/digikam/67b348d8a86d53cc754e16394160c81f78531bc8
Comment 24 Maik Qualmann 2017-12-26 17:27:47 UTC
Thanks for the test images.

Maik
Comment 25 Nicofo 2017-12-28 23:11:14 UTC
Hello Maik,

thanks for the correction, I have tested the new appimage of Digikam (digikam-5.8.0-20171227T061903-x86-64): it works well with the pictures I sent you !

However there is a regression with some other pictures (from another camera) that do not contain valid GPS data:

    with DK 5.7 no problem (not geolocalised)
    with DK 5.8, when I refresh the metadata, the picture is now geolocalised in Equator :(

I sent you by mail an example of such picture.
GPS data is:
    GPS Altitude (0/0)
    GPD Latitude (0/0 0/0 0/0)
Comment 26 Maik Qualmann 2017-12-29 11:27:23 UTC
Git commit 871e904bb00ae53d3ad60f0b247200df8d35c606 by Maik Qualmann.
Committed on 29/12/2017 at 11:25.
Pushed by mqualmann into branch 'master'.

check denominators from the latitude and longitude if invalid
FIXED-IN: 5.8.0

M  +4    -4    libs/dmetadata/metaengine_gps.cpp

https://commits.kde.org/digikam/871e904bb00ae53d3ad60f0b247200df8d35c606
Comment 27 Maik Qualmann 2017-12-29 12:01:00 UTC
Unfortunately, reloading the metadata does not help here to correct the values in the database. For this, the bug 380876 must first be closed.

Maik
Comment 28 Nicofo 2017-12-29 16:02:18 UTC
Great, thanks for your reactivity !

Strange that reloading the metadata will not help because it worked for my other pictures in NorthPole and your code modification is related to the same functions (getGPSLatitudeNumber, ...)
Well I will see with next version of DK.
Thanks again :-)
Comment 29 Maik Qualmann 2017-12-29 20:03:35 UTC
The problem with this image is, all GPS data is invalid. Also for the altitude the denominator is 0. If there is no valid value, the record is ignored and not written to the database. The old problem, that the database will not be overwriten if the information is not included in the image.

Maik