Python wrap module for UN/LOCODE
0.9
- data from UN ECE
- reference data from CSV "{yyyy}-{v} SubdivisionCodes.csv" & "{yyyy}-{v} UNLOCODE CodeListPart?.csv"
- parse CSV files and store into sqlite DB
- store the country/subdivision/location in UTF-8 encoding
- initialize sqlite DB
$ python pyunlocode.py
- query city or country name by code
import pyunlocode
u = pyunlocode.PyUnLocode()
u.init()
print u.get_country_name('US')
print u.get_city_name('TW', 'TPE')
u.close()
- country
field | type |
---|---|
code | text (PK) |
name | text |
- subdivision
field | type |
---|---|
country_code | text (PK) |
subdivision_code | text (PK) |
name | text |
- location
field | type |
---|---|
country_code | text (PK) |
location_code | text (PK) |
name | text |
subdivision | text |
status | text |
iata | text |
coordinate | text |
remark | text |
is_port | int |
is_airport | int |
is_road_terminal | int |
is_rail_terminal | int |
is_postal_exchange_office | int |
is_border_cross | int |