MeridianMERIDIAN

UN/LOCODE

geography.transportation.unlocode

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).

Worked samples

DuckDB 1.5.5 · finetype 0.6.64

ValueAs VARCHARcountrylocation
USLAXUSLAXUSLAX
GBLONGBLONGBLON
DEHAMDEHAMDEHAM
SGSINSGSINSGSIN
NLRTMNLRTMNLRTM
Membership list
unlocode

Shape

Pattern
^[A-Z]{2}[A-Z2-9]{3}$
ValueLengthShape
USLAX5matches
GBLON5matches
DEHAM5matches
SGSIN5matches
NLRTM5matches
USLA4rejected: one character short

Background

Origin

Work on the United Nations Code for Trade and Transport Locations (UN/LOCODE) was started in 1972 by the UNECE Working Party on Facilitation of International Trade Procedures.[1] The UNECE Working Party on Facilitation of International Trade Procedures was the predecessor of the United Nations Centre for Trade Facilitation and Electronic Business (UN/CEFACT).[1] The first edition of Recommendation No. 16 on UN/LOCODE was released in 1980, after consultation with international organisations that included ECLAC, ESCAP and IATA.[1] A second edition of Recommendation No. 16, which included a manual on maintenance procedures, was published in 1995.[1]

Recommendation No. 16 explains that the names of trade locations are often spelled in different ways, and that the same location is sometimes given different names in different languages.[1] Recommendation No. 16 proposes agreed, uniquely coded designations as the way to identify each location involved in international trade without ambiguity.[1]

Recommendation No. 16 defines UN/LOCODE as a five-character geographic coding scheme developed and maintained by UNECE through UN/CEFACT.[1] The first two characters of a UN/LOCODE are the ISO 3166-1 alpha-2 country code.[1] The last three characters of a UN/LOCODE represent the place name and normally comprise three letters.[1] Where no ISO 3166 country code element is available, as for installations in international waters, Recommendation No. 16 makes the code element XZ available for user assignment.[1]

Recommendation No. 16 says a UN/LOCODE identifies an administrative or economic area relevant to international trade and transport, understood in the sense of a city or a town.[1] Recommendation No. 16 provides for child codes, built on a UN/LOCODE, to identify facilities such as container terminals inside a location.[1] Recommendation No. 16 says codes that have been used for deleted entries should not be reused for future locations.[1]

Use

UNECE's foreword to Recommendation No. 16 says UN/LOCODE is widely used by customs administrations, statistics departments, the transport industry and the manufacturing industry.[1] UNECE describes the official UN/LOCODE publication as biannual.[2]

The downloadable UN/LOCODE files in CSV, TXT and MS Access split the code into a Country field and a Location field.[3]

IMO's SN/Circ.244 recommends using the UN/LOCODE to enter both the port of departure and the next port of call in a ship's AIS destination field.[4] SN/Circ.244 gives AE DXB>NL RTM as the destination entry for a ship leaving Dubai bound for Rotterdam.[4] SN/Circ.244 says ?? ??? should be entered when the next port of call is unknown.[4] SN/Circ.244 says XX XXX should be entered when the port of departure has no designated UN/LOCODE.[4] Treat AIS destinations as hand-typed text: pull the codes out with a pattern that tolerates the space and the > separator, and read XX XXX and ?? ??? as missing values rather than as locations. (Meridian's view)

Recommendation No. 16 says a code with status RQ, a request under consideration, should not be used in international electronic communication until the request has been validated.[1] Recommendation No. 16 says entries to be deleted are marked with change indicator X and status XX, and are deleted from the subsequent version.[1]

Where you'll meet it

The DCSA data model gives BEANR, for the city of Antwerp in Belgium, as an example UN Location Code.[5] IMO's Maritime Safety Committee approved the guidance in SN/Circ.244 in December 2004 and encouraged the use of the UN/LOCODE.[4]

Detection notes

UNECE Recommendation 16. Over 100,000 locations worldwide. Used in shipping, trade documentation, and customs declarations.

Use it

CLI · DuckDB
$ finetype infer -i "USLAX" --mode column
→ geography.transportation.unlocode

SELECT ft_infer('USLAX');
-- → 'geography.transportation.unlocode'
Cast expression
UPPER(CAST({col} AS VARCHAR))

Schema

https://meridian.online/schemas/geography.transportation.unlocode · Frictionless type string

finetype taxonomy geography.transportation.unlocode -o json-schema

Aliases

un_locode

Type Registry