Warning: String too short (minlen is 3) for IPTC:Country-PrimaryLocationCode

Started by WHA1949, December 18, 2012, 08:47:06 AM

Previous topic - Next topic

WHA1949

ExifTool 9.09 with Windows XP

Using Program GeoSetter (which in turn uses ExifTool) gives Warnings, and doesn't write data,  when 2 letter code is used for country code. According to IPTC Specs this should be allowed:
QuoteGeneric Specification
2descr
Name
Country Code (legacy)
Definition
Code of the country the content is focussing on -- either the country shown in visual media or referenced in text or audio media. This element is at the top/first level of a top-down geographical hierarchy. The code should be taken from ISO 3166 two or three letter code. The full name of a country should go to the "Country" element.
Photo Definition
Code of the country of the location shown in the image. This element is at the top/first level of a top-down geographical hierarchy. The code should be taken from ISO 3166 two or three letter code. The full name of a country should go to the "Country" element.
Photo Help Text
Enter the 2 or 3 letter ISO 3166 Country Code of the Country pictured in this image

It would be nice if also 2 letter codes could be supported without warning.

Phil Harvey

From the IPTC IIM version 4.1 specification:


2:100Country/ Primary
Location Code
Not repeatable, three octets consisting of alphabetic characters.

Indicates the code of the country/primary location where the intellectual property of the objectdata was created, e.g. a photo was taken, an event occurred.

Where ISO has established an appropriate country code under ISO 3166, that code will be used. When ISO3166 does not adequately provide for identification of a location or a new country, e.g. ships at sea, space, IPTC will assign an appropriate three-character code under the provisions of ISO3166 to avoid conflicts. (see Appendix D)

Examples:
  "USA" (United States)
  "FRA" (France)
  "XUN" (United Nations)

It is fairly clear that this field must be 3 characters long.

I suggest that you add a space to the end if you really need to use a 2-character code.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

WHA1949

QuoteIt is fairly clear that this field must be 3 characters long.

I don't agree that it is fairly clear:

0. I admit that your docs reference this IIM specs. But it seems they are outdated (1999).
1. As I cited above from:
Quotehttp://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata-201007_1.pdf
, there exist other documents.
2. Standard use in Adobe Photoshop is 2 letter country code. But I have to admit that Adobe even allows 4 letter country codes (e.g. non existing codes)
3. In
Quotehttp://www.iptc.org/std/photometadata/documentation/IPTC-CS5-FileInfo-UserGuide_6.pdf
they say:
QuoteCountry Code (legacy) [CountryCode]
Enter the Country Code of the country pictured in the photograph. This field is at the top/ first level of a top-down geographical hierarchy. Country codes should be displayed as upper-case letters (US not us), and may be either two- or three-letter codes as defined by the ISO 3166 standard. The two-letter code (3166-2) is freely available from the http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html site. The full name of a country should go to the "Country" field. If both the Country and Country Code fields are used, the Country Code is the authoritative reference.

So to summarize: To me things seem a little complicated. There exist contradicting specifications.

Phil Harvey

OK, I see the problem.

You are confusing the two IPTC specifications.  The older IPTC specification uses the IIM format which specifies a 3-character field (IPTC:Country-PrimaryLocationCode).  The newer IPTC specification that you referenced uses XMP format where there is no length restriction (XMP:CountryCode).  It sounds like you meant to use this one.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).