spatial
spatial copied to clipboard
wof-import: convert iso2 abbr to iso3 for countries and dependencies
I'm trying to add more consistency in abbreviations. In WOF data we can find countries and dependencies with iso2 and iso3 abbreviations.
In pelias/whosonfirst we are using only iso3 abbreviation, I'm porting this feature to spatial (see pelias/whosonfirst/peliasDocGenerators.js)
Seems like an error in the data if the wof:country_alpha3
field is 2 chars 🤔
Any idea how widespread this issue is?
The wof:country_alpha3
is used when the wof:placetype
is country
, otherwise it will use the wof:shortcode
if present, then the wof:abbreviation
if present and then the wof:country
.
The shortcode is not always a iso3 since it's also used for regions etc. Here the issue mainly affects dependencies, I found this thanks to an acceptance test on Guam (85632163
) which returns GU
instead of GUM
and this breaks the use of boundary.country
.
Here is the list of all 2 char abbreviations I found in the database:
id |
name |
placetype |
country_alpha3 |
shortcode |
abbreviation |
country |
---|---|---|---|---|---|---|
85632733 | Somaliland | country | XS | XS | ||
102312305 | United Nations | country | UN | UN | ||
85632163 | Guam | dependency | GU | US | ||
85632169 | United States Virgin Islands | dependency | VI | US | ||
85632199 | Saint Barthelemy | dependency | SB | FR | ||
85632205 | Turks and Caicos Islands | dependency | TC | GB | ||
85632211 | Falkland Islands | dependency | FK | GB | ||
85632239 | Heard Island and McDonald Islands | dependency | HM | AU | ||
85632283 | Anguilla | dependency | AI | GB | ||
85632301 | South Georgia and South Sandwich Islands | dependency | GS | GB | ||
85632333 | United States Minor Outlying Islands | dependency | UM | US | ||
85632387 | Dhekelia | dependency | XEB | GB | ||
85632421 | Northern Mariana Islands | dependency | MP | US | ||
85632459 | British Indian Ocean Territory | dependency | IO | GB | ||
85632473 | New Caledonia | dependency | NC | FR | ||
85632481 | Cook Islands | dependency | CK | NZ | ||
85632485 | Saint Helena | dependency | SH | GB | ||
85632493 | Niue | dependency | NU | NZ | ||
85632517 | Norfolk Island | dependency | NF | AU | ||
85632549 | French Southern and Antarctic Lands | dependency | TF | FR | ||
85632585 | Wallis and Futuna | dependency | WF | FR | ||
85632587 | Pitcairn Islands | dependency | PN | GB | ||
85632611 | Cayman Islands | dependency | KY | GB | ||
85632613 | Ashmore and Cartier Is. | dependency | AU | |||
85632617 | Coral Sea Islands | dependency | CR | AU | ||
85632649 | Guantanamo Bay USNB | dependency | 99 | US | ||
85632653 | French Polynesia | dependency | PF | FR | ||
85632677 | Montserrat | dependency | MS | GB | ||
85632689 | Clipperton Island | dependency | CI | FR | ||
85632697 | American Samoa | dependency | AS | US | ||
85632731 | Bermuda | dependency | BM | GB | ||
85632743 | Akrotiri | dependency | XWB | GB | ||
85632789 | Aland | dependency | AX | FI | ||
85633153 | Faroe Islands | dependency | FO | DK | ||
85633167 | Gibraltar | dependency | GI | GB | ||
85633729 | Puerto Rico | dependency | PR | US | ||
136251281 | Caribbean Netherlands | dependency | BES | NL | NL | |
1126128723 | Saint Martin | dependency | MF | |||
1158821473 | Tokelau Islands | dependency | TK | TK | ||
1175747295 | Australian Indian Ocean Territories | dependency | CCK | CC | CC |