UN/LOCODE
United Nations Code for Trade and Transport Locations. 5-character code: 2-letter ISO 3166-1 country code followed by 3-character location code (uppercase letters or digits 2-9).
UN/LOCODE
geography.transportation.unlocodeUnited Nations Code for Trade and Transport Locations. 5-character code: 2-letter ISO 3166-1 country code followed by 3-character location code (uppercase letters or digits 2-9).
Domain
geography
Category
transportation
Casts to
VARCHAR
Scope
Universal
Try it
CLI
$ finetype infer -i "USLAX"
→ geography.transportation.unlocodeDuckDB
Detect
SELECT finetype('USLAX');
-- → 'geography.transportation.unlocode'Cast expression
UPPER(CAST({col} AS VARCHAR))Safe cast pipeline
-- Normalise and cast in one step
SELECT TRY_CAST(finetype_cast(my_column) AS VARCHAR) AS clean_value
FROM my_table
WHERE finetype(my_column) = 'geography.transportation.unlocode';Struct Expansion
Expression
country: SUBSTRING({col}, 1, 2)
location: SUBSTRING({col}, 3, 3)JSON Schema
finetype schema geography.transportation.unlocode
{
"$id": "https://meridian.online/schemas/geography.transportation.unlocode",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "United Nations Code for Trade and Transport Locations. 5-character code: 2-letter ISO 3166-1 country code followed by 3-character location code (uppercase letters or digits 2-9).",
"examples": [
"USLAX",
"GBLON",
"DEHAM",
"SGSIN",
"NLRTM"
],
"pattern": "^[A-Z]{2}[A-Z2-9]{3}$",
"title": "UN/LOCODE",
"type": "string",
"x-finetype-broad-type": "VARCHAR",
"x-finetype-transform": "UPPER(CAST({col} AS VARCHAR))"
}Examples
USLAXGBLONDEHAMSGSINNLRTMAliases
un_locode