How to obtain more location-related metadata, and what do those items mean?

Started by MrPete, March 24, 2024, 03:26:18 AM

Previous topic - Next topic

MrPete

I am coming up to speed on this amazing app, at long last  :)

I have a strong desire to incorporate the official 1st and 2nd level "Administrative Areas" in location info. There are many reasons for this... 1st is often called State or Province. 2nd level may be County, District, Zone or other terms.

This post will begin with a few questions, then provide some info below.

QUESTIONS
* What are "Composite" and "MWG" in "Composite\MWG-State..." etc?
* What is "MD" in "File.MD.city"? (suggested keyword expression), and is "NO CITY" defined/documented somewhere? ;)
* How hard would it be to obtain (as a built-in variable) some of the other metadata available from GeoNames queries? I'll give an example below.

EXAMPLE:
This sample query,
http://api.geonames.org/extendedFindNearby?lat=37.451&lng=-122.18&username=xyzzyProduces the following result:
<geonames>
<address>
<street>Roble Ave</street>
<mtfcc>S1400</mtfcc>
<streetNumber>649</streetNumber>
<lat>37.45127</lat>
<lng>-122.18032</lng>
<distance>0.04</distance>
<postalcode>94025</postalcode>
<placename>Menlo Park</placename>
<adminCode2>081</adminCode2>
<adminName2>San Mateo</adminName2>
<adminCode1>CA</adminCode1>
<adminName1>California</adminName1>
<countryCode>US</countryCode>
</address>
</geonames>

adminName1 or adminCode1 are of course the State.
adminName2 is the County
AND this gives full street and mailing address...

WHY IS THIS USEFUL?

Turns out that 2nd level admin areas are of growing importance in many contexts. So much so, that the UN is working to ensure every nation on earth eventually provides public digital maps with 1st and 2nd level regions. Yes, it's like pulling teeth in some places. (And completely unnecessary in others: small island nations have neither one LOL!)

* Do you take nature photos? 2nd level (ie Counties) are how we organize the scientific data behind databases of living things. 
  * Thus, my wife MUST have the County for every bird photo submitted to the popular eBird collection.
* Want a topo map? USGS organizes them by State, then County, then finer grain... ;) you will see county names and outlines on the interactive online map (here)
* Do you like demographic info? Market your photos? In the USA, marketing (and census and more) focuses on MSA's which are one or more counties combined (Metro Statististical Areas)
* Do you care about local licenses and legal permission? Yep, our courts are organized by 2nd level districts. Where you took that photo just might matter to the county judge.

Etc. :)

In my case, it's because of my sweetie who takes great nature photos and needs the info for that.

sinus

Boah, interesting, but I understand only half of them. Sorry, but it is my poor english.

I wonder, what about shown and created city, location and so on? 
Best wishes from Switzerland! :-)
Markus

Mario

QuoteWhat are "Composite" and "MWG" in "Composite\MWG-State..." etc?
Tags ExifTool makes up on-the-fly from various sources. https://exiftool.org/TagNames/Composite.html
IMatch does not use these for most things, except for historical/downwards-compatibility reasons.

QuoteWhat is "MD" in "File.MD.city"..
All Metadata Tag ShortCodes start with {File.MD...

QuoteHow hard would it be to obtain (as a built-in variable) some of the other metadata available from GeoNames queries? I'll give an example below.
IMatch supports GeoNames.org, Google and HERE for reverse geocoding.
All services return different information about the requested location in different formats.
IMatch unifies the varying metadata fields returned by these providers and fills the location tags most useful for the majority of users from this information.
This includes data points like country, city, location etc. Note that not all services deliver the same information for the same place.

IMatch fills the official XMP location shown and XMP location created tags from this information.
Switch the Metadata Panel to the "6 IPTC Location" layout to see this information. Don't use Composite tags.

IMatch's own Locations are designed to contain the same information as the unified data IMatch produces from reverse geocoding (plus some extras) and fills the same tags when you apply a location to a file.

If you have use for specific metadata returned by one of these 3 providers, I recommend you either use a dedicated geo app that specializes in reverse geocoding and mapping or you write your own custom IMatch script / app that interfaces with the geo provider that provides the data you're after and then uses IMWS in IMatch to store this data into metadata tags or Attributes.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo


If interested in writing your own app to extract API results, and parse them into your own tags - check out my Super GeoLocator app that I wrote years ago before HERE was integrated into IMatch... should be easy to adjust to other Geo Data providers provide they have a robust API with good documentation.  Enjoy!

https://www.photools.com/community/index.php?msg=68650

jmsantos

I have never been able to get reverse geocoding to work with HERE, despite following the instructions over and over again. Every time I tried it I got a message about connection problems. At HERE they have migrated the accounts from developer.here.com to platform.here.com and I think the problem may be related to that.

Mario

HERE works just fine, just tested again.
If you get connection problems, make sure your account is valid, the API ID / App Code is valid (maybe recreate one) etc.
If you get error messages from HERE, IMatch is just he middleman, sending the request with your credentials and forwarding the results or error message.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Quote from: jmsantos on March 25, 2024, 12:32:26 PMI have never been able to get reverse geocoding to work with HERE, despite following the instructions over and over again. Every time I tried it I got a message about connection problems. At HERE they have migrated the accounts from developer.here.com to platform.here.com and I think the problem may be related to that.


Problems with the services are almost always related to API keys.. either outdated versions or a modification to how they are generated. Many companies don't announce API changes unless you are signed up for developer emails, notifications, etc... it's happened to me a few times in the past!

MrPete

Thanks, Mario! I've obviously got a lot to learn. As a SW Dev who was a sr architect on the first interactive GIS (1.5 million lines of code... still can't believe we did that!) I want to say I am TOTALLY impressed with what you have accomplished in this app! For an app with this amount of power, it is amazingly consistent and usable, even though there are an incredible number of capabilities exposed. YOWZA!

Quote from: Mario on March 24, 2024, 08:58:25 AMIMatch does not use these for most things, except for historical/downwards-compatibility reasons.
I'm slightly confused: looking at the list of File.MD aliases, it appears that MWG-* are used by iMatch for all location items today. And weirdly, MWG-* isn't listed by ExifTool. Oh well, mysteries are ok by me :) I have bigger fish to fry right now...

Mario

Many things have changed over the years. IPTC metadata. XMP metadata. ExifTool. ExifTool Composite tags.
It's metadata mess.

IMatch tries to be consistent and if possible, use Metadata Tag ShortCodes when using tags in variables. This allows me to change the source tag under the hood when needed while keeping the variable names valid.

For location data (coordinates, country, city, location etc.) I recommend using the IPTC location shown / location created tags. These tags are used/filled by IMatch in the Map Panel, when running reverse geocoding, when applying locations etc.

This is all quite complex, since some location tags are mapped also into other XMP tags, into EXIF tags, into legacy IPTC and even Photoshop tags! IMatch does this automatically. There was also a mile-long discussion thread about location shown and location created, when to fill which tags to remain backwards-compatible and in-sync with user's workflows and habits. You can find it via the search function and there are also corresponding release notes.

Using the "6 IPTC Location" Metadata to view and edit location data is the recommended approach. Or add the same tags to your own Metadata Panel Layout if desired. These are structured and repeatable tags, which adds even more fun.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

PandDLong

Quote from: MrPete on March 25, 2024, 03:38:46 PMI'm slightly confused: looking at the list of File.MD aliases, it appears that MWG-* are used by iMatch for all location items today. And weirdly, MWG-* isn't listed by ExifTool. Oh well, mysteries are ok by me :) I have bigger fish to fry right now...

Location metadata must be like watching a bouncing ball as standards - both published and convention by usage - change and evolve.  As Mario stated there are location tags scattered around but the suggestion to use the IPTC Extension tags  seem to be the best choice - in terms of both their level of available detail and accepted usage. Not sure on the iMatch short code mapping to MWG tags (which are virtual tags) although under the hood of exiftool, these are mapped to the IPTC Extension codes (and others).

i had a bunch of issues in the past with "disappearing" changes in my location data and it was traced back to how the composite tags work in trying to address inconsistencies when two different tags that should be the same but are not (eg. State is in both the IPTC Extension tag set and the Photoshop tags - and maybe more).  I have solved that by always using the same tags and I also perform some tag synching through a metadata template just to be sure.

The Composite and MWG tags are listed on the Exiftool site - you find them near the end of the list on this page: https://exiftool.org/TagNames/index.html

The MWG tags was a standard for virtual tags that was created by the "Metadata Working Group" as I recall.


I follow Mario's advice and have my location data firmly planted in IPTC Location Shown and Location Created tags. 

However, there are times when I too want one more level of data.  I use one of the otherwise unused tags in the Location Shown and Location Created structures (as a side note I also use the World Region tags).  As these tags are not supported by any of the automation in iMatch, I have to populate them manually but iMatch has so many capabilities I am able to make it relatively effortless.  If you build an API with a geodata source, you could likely automate the populating of a tag of your choice.

The standard warning when repurposing a tag is that others won't use it the same way and other tools/individuals may use it differently creating a potential issue.  For me, all of my files are for family and friends use only so repurposing isn't a problem.

Hope this is helpful.

Michael

MrPete

Quote from: PandDLong on March 25, 2024, 07:25:18 PMThe Composite and MWG tags are listed on the Exiftool site
The funny thing about that: the MWG tags apparently are composite tags, but the Exiftool doesn't list them under composite ;)

Yeah, I know a little about standards. Let's make more standards :)

Funny/ironic story: late 80's, we created the first interactive GIS. And before that in the mid 1980's I was working with a team of volunteers standardizing computerization of coding systems at the country level and below.

A guy on our database team got a call from the US Dept of State Geographer. "Hi, I hear you're tracking the nations of the world, and the codes, on a computer?" "Yeah, sure!" "Can you tell me more about that? I'm still using 3x5 cards."

True story. VERY hard to imagine ~40 years later LOL.