Ga naar inhoud

CBS

Zie het downloadvoorbeeld voor de buurtkaart en kerncijfers.

Download the original CBS Wijk- en Buurtkaart 2025 GeoPackage.

The official CBS ZIP file is downloaded directly. Its GeoPackage is extracted unchanged, validated for the buurten layer and atomically placed in the administrative-areas source directory. No geometries or source attributes are joined, filtered, or otherwise spatially processed.

Parameters:

Name Type Description Default
download_dir Path

Directory for the CBS source GeoPackage, by default datastore.administratieve_gebieden_dir.

administratieve_gebieden_dir
target_path Path

Override for the output GeoPackage path.

None
overwrite bool

Whether to replace an existing target. When False, the existing file is reused without a network request.

True
progress bool

Whether to write named download progress to stdout.

True
chunk_size int

HTTP download chunk size in bytes.

1024 * 1024
timeout int

HTTP timeout in seconds.

30

Returns:

Type Description
GeoPackageDownload

Metadata for the validated, unmodified CBS GeoPackage.

CBS source-data downloads.

BuurtcodeSystematiek dataclass

Comparison of CBS buurtcodes in geometry and StatLine source data.

StatLineDownload dataclass

Metadata for selected CBS StatLine buurtgegevens.

buurtgegevens_2025_path(download_dir=datastore.cbs_dir)

Return the datastore path for selected CBS buurtgegevens of 2025.

download_buurtgegevens_2025(download_dir=datastore.cbs_dir, *, target_path=None, overwrite=True, timeout=30)

Download only needed 2025 StatLine values for every CBS buurt.

The CBS OData queries select only neighbourhood codes and the three requested measures. The result is JSON so CBS missing values remain null rather than being converted to zero. Non-default CBS value attributes are retained in metadata.cbs_value_attributes.

Parameters:

Name Type Description Default
download_dir Path

Directory for the selected CBS source data, by default datastore.cbs_dir.

cbs_dir
target_path Path

Override for the JSON output path.

None
overwrite bool

Whether to replace an existing result. When False, the existing result is reused without API requests.

True
timeout int

HTTP timeout in seconds for each CBS request.

30

Returns:

Type Description
StatLineDownload

Output path and provenance metadata, including the downloaded buurt count.

read_buurtgegevens(path, *, columns)

Read selected columns from downloaded CBS buurtgegevens.

The source JSON keeps CBS no-data as null. This reader preserves those values and verifies that each CBS buurtcode occurs once.

validate_buurtcode_systematiek(buurtkaart_path, buurtgegevens_path)

Validate that CBS geometry and StatLine data use one code system.

This only compares source identifiers. It deliberately does not attach the statistics to geometries or otherwise alter either source dataset.

Parameters:

Name Type Description Default
buurtkaart_path Path

GeoPackage from :func:download_wijk_buurtkaart_2025.

required
buurtgegevens_path Path

JSON result from :func:download_buurtgegevens_2025.

required

Raises:

Type Description
BuurtcodeSystematiek

Counts for both sources and geometrical buurtcodes without a StatLine row.

Raises:

Type Description
ValueError

If either source contains duplicate or non-CBS-buurt codes, or if a StatLine code does not occur in the geographical source.

Redactie: AI