Support ISO 3166 alpha-3 codes on world map visualization

Currently, Metabase’s built-in world map visualization only supports alpha-2 codes (eg US, IL). The data set we would like to visualize currently stores alpha-3 codes (eg USA, ISR) – we use these to interact with a third-party system. However, this means that we cannot visualize this data in Metabase without converting.

The conversion from alpha-3 to alpha-2 is unfortunately not as simple as substr(alpha3, 1, 2), as the IL vs ISR example for Israel shows. 93/249 countries in the ISO-3166-1 database on my system have this property.

We have a couple of obvious options:

  • Create a table of the ISO-3166-1 data and join against it
  • Change the data representation to use alpha-2 codes and convert when we need to talk to the third-party API
  • Create a custom map that uses alpha-3 codes

We’ll probably do the second, but it would be even better if Metabase transparently understood alpha-3 codes.

I found a previous thread where someone was surprised that three-letter ISO country codes aren’t supported: