city / README.md
cterdam's picture
Upload dataset
ad453ef verified
metadata
tags:
  - name
  - lang
  - iata
  - city
  - coordinates
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
dataset_info:
  features:
    - name: code
      dtype: string
    - name: name
      dtype: string
    - name: lang
      dtype: string
    - name: name_en
      dtype: string
    - name: name_ru
      dtype: string
    - name: name_zh
      dtype: string
    - name: names_en_alt
      list: string
    - name: names_ru_alt
      list: string
    - name: names_zh_alt
      list: string
    - name: names_other
      list: string
    - name: country
      dtype: string
    - name: region
      dtype: string
    - name: links
      list: string
    - name: lat
      dtype: float64
    - name: lon
      dtype: float64
  splits:
    - name: train
      num_bytes: 2072877
      num_examples: 9026
  download_size: 3416192
  dataset_size: 2072877

IATA City Codes with Lang and Coordinates

IATA city codes with language selection and geographic coordinates.

Fields

  • code (string): IATA metro code (e.g., 'NYC', 'MOW', 'SVO')
  • name (string): Primary name in selected language
  • country (string): ISO 3166-1 alpha-2 country code
  • region (string): ISO 3166-2 subdivision code (if applicable)
  • name_en (string): English name
  • name_ru (string): Russian name
  • name_zh (string): Chinese name
  • lang (string): Language of primary name field (en, ru, or zh)
    • Determined by country's language rule
  • lat (float): Latitude coordinate (decimal degrees, -90 to 90)
  • lon (float): Longitude coordinate (decimal degrees, -180 to 180)
  • names_en_alt (list): Alternative English names
  • names_ru_alt (list): Alternative Russian names
  • names_zh_alt (list): Alternative Chinese names
  • names_other (list): Names in other languages
  • links (list): Reference links

Language Rule

Languages are determined by country using hardcoded mapping (same as iso_3166-1_alpha-2).

Geographic Coverage

  • Coordinates: 99.3% coverage (9057/9123 entries)
  • Format: WGS84 (EPSG:4326)
  • Precision: Approximately city-level

Usage

from datasets import load_dataset

ds = load_dataset('cterdam/iata-metro', split='train')

# Get Moscow metro
moscow = ds.filter(lambda x: x['code'] == 'MOW')[0]
print(moscow)
# {
#   'code': 'MOW',
#   'name': 'Москва',
#   'region': 'RU',
#   'subdiv': 'RU-MOW',
#   'lang': 'ru',
#   'lat': 55.7558,
#   'lon': 37.6173,
# }

# Find metros in China
china_metros = ds.filter(lambda x: x['country'] == 'CN')
print(f"Found {len(china_metros)} city entries in China")

# Geographic queries
nearby = ds.filter(lambda x: abs(x['lat'] - 40.7) < 1 and abs(x['lon'] + 74.0) < 1)

See Also

  • cterdam/iso_3166-1_alpha-2: Countries/regions with lang
  • cterdam/iso_3166-2: Subdivisions with lang

Invariants

All entries in this dataset maintain the following invariants (verified by test/test_invariants.py):

Name Fields

  • Required: Every entry has a name field, plus all three of name_en, name_ru, name_zh (no nulls in any of the three)
  • Constraint: name always equals one of name_en, name_ru, or name_zh (based on lang)
  • Example: If lang: ru, then name == name_ru
  • Sourcing: Names are sourced in priority order from Wikipedia langlinks, then Wikidata labels, then machine translation (used only as a last resort for obscure entries)

Lang Field

  • Required: Every entry has a lang field
  • Values: One of en, ru, or zh
  • Determination: Hardcoded by region (not inferred from text)
    • Slavic regions (RU, UA, BY, KZ, etc.) → lang: ru
    • Sinophone regions (CN, TW, HK, JP, etc.) → lang: zh
    • All otherslang: en

Verify Invariants

Clone the dataset and run tests:

```bash git clone https://huggingface.co/datasets/cterdam/iata-metro cd iata-metro

Install dependencies

pip install datasets

Run invariant tests

pytest test/test_invariants.py -v ```

Expected output: All tests pass, verifying dataset integrity.