Published

UN-LOCODE Codelist

11K
7.4K

The United Nations Code for Trade and Transport Locations is a code list mantained by UNECE, United Nations agency, to facilitate trade. Data comes from the UNECE page, released at least once a yea...

API Access

Access dataset files directly from scripts, code, or AI agents.

Browse dataset files
Dataset Files

Each file has a stable URL (r-link) that you can use directly in scripts, apps, or AI agents. These URLs are permanent and safe to hardcode.

/core/un-locode/
https://datahub.io/core/un-locode/_r/-/.gitignore
https://datahub.io/core/un-locode/_r/-/Makefile
https://datahub.io/core/un-locode/_r/-/README.md
https://datahub.io/core/un-locode/_r/-/UPDATE_SCRIPT_MAINTENANCE_REPORT.md
https://datahub.io/core/un-locode/_r/-/data/alias.csv
https://datahub.io/core/un-locode/_r/-/data/code-list.csv
https://datahub.io/core/un-locode/_r/-/data/country-codes.csv
https://datahub.io/core/un-locode/_r/-/data/function-classifiers.csv
https://datahub.io/core/un-locode/_r/-/data/status-indicators.csv
https://datahub.io/core/un-locode/_r/-/data/subdivision-codes.csv
https://datahub.io/core/un-locode/_r/-/datapackage.json
Key Files

Start with these files — they give you everything you need to understand and access the dataset.

datapackage.jsonmetadata & schema
https://datahub.io/core/un-locode/_r/-/datapackage.json
README.mddocumentation
https://datahub.io/core/un-locode/_r/-/README.md
Typical Usage
  1. 1. Fetch datapackage.json to inspect schema and resources
  2. 2. Download data resources listed in datapackage.json
  3. 3. Read README.md for full context

Data Previews

code-list

Loading data...

Schema

nametypedescriptionpattern
Changestring+ (newly added); X (to be removed); | (changed); # (name changed); = (reference entry); ! (US location with duplicate IATA code)
CountrystringISO 3166 alpha-2 Country Code, defined in countryCodes.csv[A-Z]{2}
Locationstring[A-Z2-9]{3}
Namestring
NameWoDiacriticsstring
SubdivisionstringDefined in subdivisionCodes.csv
StatusstringDefined in statusIndicators.csv
FunctionstringDefined in functionClassifiers.csv[01-][2-][3-][4-][5-][6-][7-][B-]
Datestringym[0-9]{4}
IATAstringIATA code if different from LOCODE
CoordinatesstringDDMM[N/S] DDDMM[W/E][0-9]{4}[NS] [0-9]{5}[WE]
Remarksstring

country-codes

Loading data...

Schema

nametype
CountryCodestring
CountryNamestring

function-classifiers

Loading data...

Schema

nametype
FunctionCodestring
FunctionDescriptionstring

status-indicators

Loading data...

Schema

nametype
STStatusstring
STDescriptionstring

subdivision-codes

Loading data...

Schema

nametype
SUCountrystring
SUCodestring
SUNamestring

Data Files

FileDescriptionSizeLast modifiedDownload
code-list
7.4 MB28 days ago
code-list
country-codes
4.18 kB28 days ago
country-codes
function-classifiers
300 B28 days ago
function-classifiers
status-indicators
827 B28 days ago
status-indicators
subdivision-codes
133 kB28 days ago
subdivision-codes
alias
4.77 kB28 days ago
alias
FilesSizeFormatCreatedUpdatedLicenseSource
67.54 MB5 days agoOpen Data Commons Public Domain Dedication and License v1.0UNECE

badge

The United Nations Code for Trade and Transport Locations is a code list mantained by UNECE, United Nations agency, to facilitate trade.

Data

Data comes from the UNECE page, released at least once a year.

Preparation

As the original release files have encoding problems, we need to process both the mdb and the csv release. To build the dataset we use the csv version of the current edition.

Tools needed: MDBTools and CSVKit. Download the current edition from UNECE and put it into the root directory. Then execute bash scripts/prepare_edition_mdb.sh loc{ed}mdb.zip, where {ed} identify the release.

To integrate the data from the csv then run the python file

Prerequisites:

pip install pandas titlecase

Run:

python scripts/integrate.py loc232csv.zip

The provided prepare.py file would work alone when the original csv file will be fixed upstream.

License

All data is licensed under the ODC Public Domain Dedication and Licence (PDDL).