Mohan
Mohan

Reputation: 8843

Country code for international waters

I am implementing an API and C++ SDK that will return two-letter country codes like "US" for a given latitude/longitude. These ISO 3166-1 alpha-2 are well documented, but there is no code for international waters. Is there a convention for what should be returned in this case?

Upvotes: 4

Views: 1403

Answers (2)

Jonas Köritz
Jonas Köritz

Reputation: 2644

Your API could return a 404 not found or an empty string for such a location, this way it would be clear that no country code can be retrieved for the given location. There seems to be no real convention for assigning any kind of code to international waters.

In case of a C++ API, consider adding some kind of status to your returned value to indicate if the lookup has been successful.

Error should always be an option in any API design!

Upvotes: 3

Adam Millerchip
Adam Millerchip

Reputation: 23091

The User-assigned code element section of the Wikipedia ISO 3166-1 alpha-2 article could be useful. Specifically:

UN/LOCODE assigns XZ to represent installations in international waters.

It's not part of ISO 3166, but at least there's an example of how another implementation handled it.

Upvotes: 7

Related Questions