ruian-import
Python library for downloading and parsing ČÚZK (RÚIAN) registries: regions, districts, municipalities, and city districts (městské části / obvody), plus WGS84 boundary geometry for each level.
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
@dataclass
class CityDistrict: # městský obvod / městská část (MOMC)
code: str
name: str
municipality_code: str # parent obec (statutární město)
abolished: str | None
@dataclass
class Orp: # obec s rozšířenou působností (ORP)
code: str
name: str
district_code: str # parent okres
seat_municipality_code: str | None # obec that is the ORP seat
abolished: str | None
@dataclass
class Pou: # obec s pověřeným obecním úřadem (POÚ)
code: str
name: str
orp_code: str # parent ORP
seat_municipality_code: str | None # obec that is the POÚ seat
abolished: str | None
City districts (MOMC), ORP and POÚ
Statutory cities and Prague are subdivided into MOMC units; okresy are subdivided into ORP (obce s rozšířenou působností), which are further split into POÚ (obce s pověřeným obecním úřadem). All come from the ČÚZK ArcGIS layers (which carry clean parent links), not CSV registries:
from ruian_import import fetch_city_districts, fetch_orps, fetch_pous
for cd in fetch_city_districts():
print(cd.code, cd.name, "->", cd.municipality_code)
for orp in fetch_orps():
print(orp.code, orp.name, "-> okres", orp.district_code)
for pou in fetch_pous():
print(pou.code, pou.name, "-> ORP", pou.orp_code)
Boundary geometry
Every administrative level exposes its full boundary (not just a centroid) as GeoJSON, keyed by RUIAN code, in WGS84 (lon/lat order):
from ruian_import import (
fetch_region_geometries,
fetch_district_geometries,
fetch_orp_geometries,
fetch_pou_geometries,
fetch_municipality_geometries,
fetch_city_district_geometries,
)
geoms = fetch_district_geometries() # {code: {"type": "Polygon"|"MultiPolygon", ...}}
outline = geoms["3207"] # okres Beroun
# custom simplification tolerance (degrees; default ~0.001 ≈ 110 m):
detailed = fetch_municipality_geometries(simplify=0.0002)
Geometry is downloaded from the ČÚZK ArcGIS REST API with server-side
Douglas-Peucker simplification and transparent pagination. Only active units
(platido IS NULL) are returned.
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
Metadata
Release files for ruian-import 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ruian_import-0.5.0.tar.gz | 102.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ruian_import-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 114.0 kB
Release files / ruian_import-0.5.0.tar.gz
| Download URL | ruian_import-0.5.0.tar.gz |
|---|---|
| Size | 102.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
661494d870a2eaec23de12ce610ecf57ae02233c1051aa5790c2877e792479d3
|
|
BLAKE2b-256 checksum How to use checksums |
3fe7535810bcaeae82d1b4b6fe1db9e3560c9dc68d3e11aea82ced6686d64c7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / ruian_import-0.5.0-py3-none-any.whl
| Download URL | ruian_import-0.5.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b24ab62d9642155ebc11935a5707b455c45db01a9e6503e13eb251bddbc6b1fe
|
|
BLAKE2b-256 checksum How to use checksums |
38ed5505583f3f7434d8ad321038e3c560d39e0fce84df6b26efc752dd87ab57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|