Bug 410425 - Wishlist: Reverse geocoding to IPTC/XMP location fields.
Summary: Wishlist: Reverse geocoding to IPTC/XMP location fields.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Geolocation-ReverseGeoCoding (show other bugs)
Version: 6.2.0
Platform: Appimage Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-30 19:21 UTC by MarcP
Modified: 2022-12-04 08:46 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description MarcP 2019-07-30 19:21:00 UTC
SUMMARY

The Edit Geolocation tool has a function to perform reverse geocoding and works quite well. It saves the location of the picture's GPS coordinates as hierarchical keywords. However, there are already some IPTC and XMP fields available for that information (which can be filled using templates, or the metadata editor).

I think it could be useful if the reverse geocoding tool could save the City, State/Province and Country to the IPTC fields. Or even a button in the Metadata Editor to fill these fields based on geolocation.

This is a feature I saw in the software Photo Mechanic, and I think some people could find useful.
Comment 1 Israel G. Lugo 2020-01-17 02:34:54 UTC
Please, do implement this. I used this feature regularly in Lightroom.

It is definitely really nice to have the option of creating actual tags. 
But it would be even better to have the option to enable both the tags and the XMP location fields. Location fields have semantic meaning, which can be interpreted e.g. for location-based searches.

There could be a couple of checkboxes in the GUI:
  [ ] Store location in a tag tree
  [ ] Store location in XMP location fields

To clarify, these would be the City/Sublocation/State/Province/Country fields in "Edit Metadata->XMP->Origin".

See https://iptc.org/std/photometadata/specification/IPTC-PhotoMetadata

Ideally, there would be support for the less ambiguous LocationShown and LocationCreated, but that may be out of scope.

There was some discussion about this here: http://digikam.1695700.n4.nabble.com/Automatic-filling-of-IPTC-XMP-location-tags-based-on-GPS-coordinates-tp2164284p2165222.html

I was misled by the "Write tags to XMP" checkbox, thinking it would do what MarcP asked for. But enabling it seemed to have no effect. I have no idea what that checkbox does. Looking at the code, it seems to store tags in some "Xmp.digiKam.TagsList" field, which seems unrelated to this.
Comment 2 MarcP 2020-01-17 02:40:27 UTC
Regarding you last paragraph, the "Write tags to xmp" saves the reverse geolocation information as nested keywords (you previously need to define where and which ones by right clicking on the tag tree on top). It's quite useful and I use it often.

But in addition to this, it would be cool if that information could also be saved in the fields explicitly dedicated to that.
Comment 3 jm7@acm.org 2022-08-31 23:28:42 UTC
(In reply to Israel G. Lugo from comment #1)
> Please, do implement this. I used this feature regularly in Lightroom.
> 
> It is definitely really nice to have the option of creating actual tags. 
> But it would be even better to have the option to enable both the tags and
> the XMP location fields. Location fields have semantic meaning, which can be
> interpreted e.g. for location-based searches.
> 
> There could be a couple of checkboxes in the GUI:
>   [ ] Store location in a tag tree
>   [ ] Store location in XMP location fields
> 
> To clarify, these would be the City/Sublocation/State/Province/Country
> fields in "Edit Metadata->XMP->Origin".
> 
> See https://iptc.org/std/photometadata/specification/IPTC-PhotoMetadata
> 
> Ideally, there would be support for the less ambiguous LocationShown and
> LocationCreated, but that may be out of scope.
> 
> There was some discussion about this here:
> http://digikam.1695700.n4.nabble.com/Automatic-filling-of-IPTC-XMP-location-
> tags-based-on-GPS-coordinates-tp2164284p2165222.html
> 
> I was misled by the "Write tags to XMP" checkbox, thinking it would do what
> MarcP asked for. But enabling it seemed to have no effect. I have no idea
> what that checkbox does. Looking at the code, it seems to store tags in some
> "Xmp.digiKam.TagsList" field, which seems unrelated to this.

Location Created is in one set of IPTC Geolocation tags (lat, long).  Location shown is in a separate set of Geolocation tags.  Very few photographs use the later set, but any camera with a GPS, or synced with a GPS track will populate the former.  Yes, it would be cool, but.
Comment 4 Jonkeren 2022-12-02 09:29:46 UTC
Yes, please let Digikam automatically also fill the following fields when reverse-geotagging:

- IPTC:City
- IPTC:Sub-location
- IPTC:Province-State
- IPTC:Country-PrimaryLocationCode
- IPTC:Country-PrimaryLocationName

I guess there should also be some kind of small interface / setting where can be defined "what" will be taken for these values.
Like there currently is now, when reverse-geocoding (you will have to set the "tree" for the following tags first) -> These will then get saved to XMP, in the digikam tag tree.

In Digikam, we see: 
1. Country
2. State
3. State district
4. City
5. City district
6. Suburb
7. Place
8. Village
9. area

So 9 possible fields; if all are filled // data retrieved. There should be some interface where we can define _which_ of these will be filled to the 4 IPTC fields; i think.
Comment 5 Maik Qualmann 2022-12-03 17:12:13 UTC
Git commit 08af94d617c41413e3835c1e40e5948d45e8a09b by Maik Qualmann.
Committed on 03/12/2022 at 17:10.
Pushed by mqualmann into branch 'master'.

first step to write basic locations metadata
Related: bug 351987

M  +80   -21   core/utilities/geolocation/geoiface/items/gpsitemcontainer.cpp
M  +6    -0    core/utilities/geolocation/geoiface/items/gpsitemcontainer.h
M  +21   -17   core/utilities/geolocation/geoiface/reversegeocoding/rgwidget.cpp

https://invent.kde.org/graphics/digikam/commit/08af94d617c41413e3835c1e40e5948d45e8a09b
Comment 6 Maik Qualmann 2022-12-03 19:14:03 UTC
Git commit 34e985a2cf9a433db5c0084f7c5d20b3c47d44e7 by Maik Qualmann.
Committed on 03/12/2022 at 19:13.
Pushed by mqualmann into branch 'master'.

write location infos to the database
Related: bug 351987

M  +9    -2    core/libs/database/item/containers/itemgps.cpp
M  +38   -36   core/utilities/geolocation/geoiface/items/gpsitemcontainer.cpp
M  +5    -0    core/utilities/geolocation/geoiface/items/gpsitemcontainer.h

https://invent.kde.org/graphics/digikam/commit/34e985a2cf9a433db5c0084f7c5d20b3c47d44e7
Comment 7 Maik Qualmann 2022-12-03 22:47:58 UTC
Git commit 136af4080854ef89023135c016eba87e60056b22 by Maik Qualmann.
Committed on 03/12/2022 at 22:46.
Pushed by mqualmann into branch 'master'.

first step to get country code
We still need a function to convert the two-digit
country code to the three-digit country code.
Related: bug 351987

M  +18   -9    core/libs/database/item/containers/itemgps.cpp
M  +3    -2    core/utilities/geolocation/geoiface/backends/backend-geonames-rg.cpp
M  +3    -3    core/utilities/geolocation/geoiface/backends/backend-geonamesUS-rg.cpp
M  +1    -0    core/utilities/geolocation/geoiface/backends/backend-osm-rg.cpp
M  +8    -1    core/utilities/geolocation/geoiface/items/gpsitemcontainer.cpp
M  +20   -6    core/utilities/geolocation/geoiface/reversegeocoding/parsetagstring.h
M  +9    -4    core/utilities/geolocation/geoiface/reversegeocoding/rgtagmodel.cpp
M  +24   -8    core/utilities/geolocation/geoiface/reversegeocoding/rgwidget.cpp

https://invent.kde.org/graphics/digikam/commit/136af4080854ef89023135c016eba87e60056b22
Comment 8 Maik Qualmann 2022-12-04 08:35:58 UTC
Git commit 8c6b332ee8c9dc0465d2fa9532b29f5996c094c5 by Maik Qualmann.
Committed on 04/12/2022 at 08:34.
Pushed by mqualmann into branch 'master'.

add support for country codes
Related: bug 351987, bug 366286

M  +6    -1    core/utilities/geolocation/geoiface/items/gpsitemcontainer.cpp
M  +309  -52   core/utilities/geolocation/geoiface/reversegeocoding/rgwidget.cpp
M  +4    -0    core/utilities/geolocation/geoiface/reversegeocoding/rgwidget.h

https://invent.kde.org/graphics/digikam/commit/8c6b332ee8c9dc0465d2fa9532b29f5996c094c5