Author Topic: Country Codes used in the Reverse Geocoding and Edit Locations dialogs  (Read 684 times)

Tveloso

  • Full Member
  • **
  • Posts: 238
This isn't really a legitimate feature request...it's really just a Change Request that's rather trivial, and maybe not even worth the time.  But nevertheless, the ScreenShot in this post:

Screenshot 1 shows the reverse geocoding after coordinates are applied...

...reminded me about the "issue" I occasionally have with Country Codes.

The vast majority of the photos in my IMatch Database were taken in the US, and a large majority of those, get their location data at ingest, by virtue of a few IMath Locations, where the available Counry Codes are the 3-Bytes Codes...(so these files will get a Country Code of "USA").

When we do a Reverse Geocode, the service returns the 2-Byte Country Codes.  But in this dialog too, it's actually the 3-byte codes that are available in the Dropdown (I imagine that both dialogs use the same data source for that dropdown):

       

...yet it's the 2-Byte code returned by the Service that's actually assigned to the file.

So it's Country Code "US" that my files get, when the location data comes from a Reverse Geocode operation, and "USA" when the location data comes from from an IMatch Location.

Could the Country Codes returned by those two dialogs be synchronized?...either by simply replacing the contents of the dropdown with the 2-Byte Codes, or by creating a configuration option to allow the user to select between the 2-Byte and 3-Byte codes?...

Again, it's not at all important to have this change - IMatch makes it very easy for us to update the Country Codes that are actually in our files, so it's easy to synchronize them afterwards.
--Tony

Jingo

  • Super Hero
  • ****
  • Posts: 1785
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #1 on: January 12, 2021, 02:52:06 PM »
I knew this sounded familiar - you asked a similar question back in 2019 to request a 2 digit code  8)

https://www.photools.com/community/index.php?topic=8879 - interestingly enough, Mario stated a 3 digit code is the XMP standard so something must have changed between versions to store the 2 digit code internally though the 3 digit code is showing in the dialog.
« Last Edit: January 12, 2021, 02:55:12 PM by Jingo »

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 28532
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #2 on: January 12, 2021, 03:59:31 PM »
IMatch uses 3-letter codes. Geocoding services use whatever they like, no standard. By default the geo-coding uses what the service has delivered. You can change that in the drop-down if you like.
I could maybe add a 2->3 mapping (as an option) in this dialog if there is sufficient interest. Not sure. Let's see.

bekesizl

  • Jr. Member
  • *
  • Posts: 92
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #3 on: January 12, 2021, 04:13:47 PM »
+1 on the 2->3 mapping.

It would be good to have the same results from all services in the database.

Tveloso

  • Full Member
  • **
  • Posts: 238
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #4 on: January 12, 2021, 06:16:39 PM »
I knew this sounded familiar - you asked a similar question back in 2019 to request a 2 digit code  8)

https://www.photools.com/community/index.php?topic=8879 - interestingly enough, Mario stated a 3 digit code is the XMP standard so something must have changed between versions to store the 2 digit code internally though the 3 digit code is showing in the dialog.

Wow, great memory!

I forgot that I had posted about that previously...(at the time, I was interested only in "converting" to the 2 character codes exclusively).  As with other (more significant) things in IMatch, as I have learned more about IMatch, and gained insights from the posts in this great community, I have changed the way I'm doing things...sometimes going back an forth between approaches.

I did that with the Country Codes...(going back an forth between all 2-character, and all 3-character codes), and have settled on using the 3 character codes.  So another +1 on the 2->3 mapping.

--Tony
--Tony

jch2103

  • Oldtimer
  • ****
  • Posts: 2191
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #5 on: January 12, 2021, 07:41:51 PM »
+1 on the 2->3 mapping.

It would be good to have the same results from all services in the database.

I agree. Would simplify things.
John

BanjoTom

  • Sr. Member
  • **
  • Posts: 380
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #6 on: January 12, 2021, 08:42:32 PM »
Another +1 on 2 to 3 mapping.  Always seems good if things can be kept consistent...
Quote
+1 on the 2->3 mapping.
— Tom, in Lexington, Kentucky, USA

nacho02

  • Jr. Member
  • *
  • Posts: 63
  • Imatch User since 2005
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #7 on: January 12, 2021, 11:18:10 PM »
+1 to the mapping. I've got lots of mixed 2 & 3 digits.

Thx!
Ignacio

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 28532
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #8 on: January 17, 2021, 08:55:13 AM »
I've looked into this.

The interactive reverse geocoding dialog now automatically maps 2-letter country codes ("US") to their respective 3-letter code ("USA") using a A2/A3 country code table IMatch maintains as part of its resources, if the service does not deliver a 3-letter code. This is done before presenting the results in the dialog.

IMatch does this mapping already when you use the automatic reverse geocoding option available for the Map Panel.
In this automatic mode, IMatch takes the first/best match provided by the geocoding service provider but performs some additional checks and clean-up before writing the address record to the database. Part of this process is the mapping of the A2 ISO code to the A3 ISO code via an internal table if the service does not deliver an A3 code.

In interactive mode, IMatch did not perform this mapping or checks and used the data 'as-delivered' by the service, adding it to the A2 to the drop-down country code selector list in the dialog if needed.

Tveloso

  • Full Member
  • **
  • Posts: 238
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #9 on: January 17, 2021, 01:04:29 PM »
Thank you so much Mario!
--Tony

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 28532
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #10 on: January 17, 2021, 02:02:40 PM »
Thank you so much Mario!

Tip: If you have two-digit codes in your database and you want to consolidate, you can easily find them via a data-driven category based on this tag.
Select all files with US, change the value to USA in the Metadata Panel and the metadata is consistent again. Repeat with other country codes as needed.

jch2103

  • Oldtimer
  • ****
  • Posts: 2191
Re: Country Codes used in the Reverse Geocoding and Edit Locations dialogs
« Reply #11 on: January 17, 2021, 08:38:19 PM »
Thank you so much Mario!

Tip: If you have two-digit codes in your database and you want to consolidate, you can easily find them via a data-driven category based on this tag.
Select all files with US, change the value to USA in the Metadata Panel and the metadata is consistent again. Repeat with other country codes as needed.

Thank you! I just had a few hundred 2-character country codes, for two countries, but this change will keep things cleaner in the future.

BYW, for anyone looking to use a data-driven category for this, the tag is XMP::iptcCore\CountryCode\CountryCode\0.
John