Skip to main content

ruian-import

Python library for downloading and parsing ČÚZK (RÚIAN) registries: regions, districts, and municipalities.

Installation

pip install ruian-import
# with coordinate support (S-JTSK -> WGS84):
pip install "ruian-import[coordinates]"

Usage

from ruian_import import fetch_regions, fetch_districts, fetch_municipalities

regions = fetch_regions()             # list[Region]
districts = fetch_districts()         # list[District]
municipalities = fetch_municipalities() # list[Municipality]

Data classes

@dataclass
class Region:
    code: str              # e.g. "19"
    name: str              # e.g. "Hlavní město Praha"
    nuts_lau: str | None   # e.g. "CZ010"
    abolished: str | None  # abolishment date "YYYY-MM-DD", or None if active

@dataclass
class District:
    code: str
    name: str
    region_code: str
    nuts_lau: str | None
    abolished: str | None

@dataclass
class Municipality:
    code: str              # 6-digit municipality code, e.g. "554979"
    name: str
    district_code: str
    lat: float | None      # WGS84, only available with [coordinates]
    lon: float | None
    abolished: str | None

Abolished records have abolished set to a date string; active records have abolished = None.

Municipality coordinates

UI_OBEC.csv does not include coordinates. Use fetch_municipalities_with_coordinates() to make a second request to the ČÚZK ArcGIS REST API and return polygon centroids (accuracy ~100 m, one HTTP request for all municipalities):

from ruian_import import fetch_municipalities_with_coordinates

municipalities = fetch_municipalities_with_coordinates()  # lat/lon populated

Or fetch coordinates separately:

from ruian_import import fetch_municipality_coordinates

coords = fetch_municipality_coordinates()  # dict[str, tuple[float, float]] - code -> (lat, lon)

Custom URL / local files

from ruian_import._parse import parse_municipalities

data = Path("UI_OBEC.zip").read_bytes()
municipalities = parse_municipalities(data)

Data sources

ČÚZK registries are updated daily:

  • Regions: https://services.cuzk.cz/sestavy/cis/UI_VUSC.zip
  • Districts: https://services.cuzk.cz/sestavy/cis/UI_OKRES.zip
  • Municipalities: https://services.cuzk.cz/sestavy/cis/UI_OBEC.zip

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ruian_import-0.2.0.tar.gz (97.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ruian_import-0.2.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file ruian_import-0.2.0.tar.gz.

File metadata

  • Download URL: ruian_import-0.2.0.tar.gz
  • Upload date:
  • Size: 97.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for ruian_import-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cc8ee6b3e1bf0a54a9f3f62c37b9ec503d6be56a25d53dd78ffb0dee47f483b3
MD5 e42900ef3954e910d504891295735aa1
BLAKE2b-256 d3192815faf06847b6303a7e3015984116c0ae28a0a395de91397557adc11a35

See more details on using hashes here.

File details

Details for the file ruian_import-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ruian_import-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for ruian_import-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 560bde87e884fc8456794a91612e9ab53ffb47c2080f9fb5c114f40f64008a58
MD5 9174c504616b9a26d3d1b988a2613e1d
BLAKE2b-256 f0766b7c7b8f565ae827286bdb6b14a60daf7bc6925f05ca2c03d27bad79b72c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page