Ga naar inhoud

Woon-VBO's per CBS-buurt

Zie de voorbeelden voor auto's en inwoners voor het gebruik van deze gedeelde voorbereiding. De functionele beschrijving legt de koppeling uit.

Shared BAG verblijfsobject to CBS-buurt processing.

BuurtKoppelingError

Bases: ValueError

Raised when BAG features cannot be unambiguously linked to one buurt.

VboBuurtBuild dataclass

Counts and output location for one shared VBO-buurt processing run.

bouw_vbo_buurt(bag_path=datastore.bag_dir / BAG_LIGHT_FILENAME, buurtkaart_path=wijk_buurtkaart_2025_path(), cbs_buurtgegevens_path=buurtgegevens_2025_path(), *, bag_vbo_path=datastore.bag_vbo_path, cbs_buurt_path=datastore.cbs_buurt_path, bag_vbo_layer=BAG_VERBLIJFSOBJECT_LAYER, overwrite=True)

Build separate BAG VBO and CBS buurt processed GeoPackages.

bag_vbo.gpkg keeps the selected BAG VBO geometry and its CBS buurtcode. cbs_buurt.gpkg keeps CBS buurt polygons and contains the selected StatLine values plus the count of selected woon-VBO's in each buurt.

Parameters:

Name Type Description Default
bag_path Path

Existing BAG GeoPackage, by default the downloaded bag-light.gpkg.

bag_dir / BAG_LIGHT_FILENAME
buurtkaart_path Path

Existing CBS Wijk- en Buurtkaart 2025 GeoPackage.

wijk_buurtkaart_2025_path()
cbs_buurtgegevens_path Path

Selected CBS StatLine buurtgegevens JSON source.

buurtgegevens_2025_path()
bag_vbo_path Path

Processed BAG VBO output GeoPackage.

bag_vbo_path
cbs_buurt_path Path

Processed CBS buurt polygon output GeoPackage.

cbs_buurt_path
bag_vbo_layer str

BAG VBO layer name, by default verblijfsobject.

BAG_VERBLIJFSOBJECT_LAYER
overwrite bool

Whether to replace existing processed outputs. When False, both outputs are reused without reading BAG or CBS source data.

True

Returns:

Type Description
VboBuurtBuild

Output paths and source, selection and buurt counts.

deel_buurtwaarde_per_vbo(data, *, waarde_column, noemer_column)

Divide a buurtwaarde over VBO's without converting no-data to zero.

Missing values and zero or negative denominators result in NaN.

koppel_features_aan_buurten(features, buurten, *, feature_id_column, buurtcode_column=CBS_BUURTCODE_COLUMN)

Link features to one CBS buurt, rejecting incomplete or ambiguous joins.

The function deliberately does not select an arbitrary result for a feature on a boundary. It logs unmatched and multi-matched feature counts and raises :class:BuurtKoppelingError when either count is nonzero.

Parameters:

Name Type Description Default
features GeoDataFrame

Features with unique identifiers and a defined CRS.

required
buurten GeoDataFrame

CBS buurt geometries with a unique buurtcode and the same CRS.

required
feature_id_column str

Identifier column used to check spatial-join cardinality.

required
buurtcode_column str

CBS buurtcode column, by default buurtcode.

CBS_BUURTCODE_COLUMN

Returns:

Type Description
GeoDataFrame

Features with a non-null, unambiguous CBS buurtcode.

selecteer_woonverblijfsobjecten(verblijfsobjecten)

Select BAG VBO's in use whose gebruiksdoel contains woonfunctie.

Parameters:

Name Type Description Default
verblijfsobjecten GeoDataFrame

BAG verblijfsobjecten with at least identificatie, status, gebruiksdoel and point geometry. pand_identificatie is retained when supplied.

required

Returns:

Type Description
GeoDataFrame

Copy containing only VBO's with status Verblijfsobject in gebruik and a woonfunctie among one or more comma-separated gebruiksdoelen.

sorteer_op_hilbert(features)

Add a vectorized Hilbert index and sort point features by that index.

features is updated in place with :data:HILBERT_COLUMN before the unavoidable sorted GeoDataFrame is created. The fixed national RD extent makes the resulting order stable across full datasets and subsets.

valideer_hilbert_volgorde(features)

Validate the technical Hilbert ordering invariant of VBO point data.

Redactie: AI