Functioneel landgebruik
FunctioneelLandgebruikLayers
dataclass
Layer names expected in the functional land-use source GeoPackages.
FunctioneelLandgebruikSources
dataclass
Input GeoPackage paths for the functional land-use build workflow.
from_datastore(data_store)
classmethod
Create source paths rooted in an explicitly supplied datastore.
FunctioneelLandgebruikTileJob
dataclass
Serializable build settings for one functional land-use raster tile.
TileBuildError
Bases: RuntimeError
Raised when one or more functioneel-landgebruik tiles failed.
bouw_functioneel_landgebruik(target_path, *, bounds, resolution_m=0.5, gap_fill_distance_m=1.0, crs=settings.crs, sources=None, data_store=None, layers=None, download_missing_sources=None, download_missing=None, overwrite=True, output_config=None, mapping_csv=None, diagnostics_path=None, building_index_path=None, building_context_m=5.0, landgebied_path=None)
Build a functional land-use GeoTIFF for one requested extent.
The workflow prepares all configured vector sources for the requested bounds, classifies their attributes to the functional land-use legend, rasterizes them in priority order, and writes a paletted GeoTIFF with overviews. Source geometries are read with the requested bounds as a bbox filter. Top10NL, BRP, BGT roads, and BAG classes are additionally adjusted using representative points covered by the LIWO outside-area polygons (including boundaries). All other locations use default codes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_path
|
Path
|
GeoTIFF path to write. |
required |
bounds
|
tuple[float, float, float, float]
|
Output bounds as |
required |
resolution_m
|
float
|
Raster cell size in map units, by default 0.5. |
0.5
|
gap_fill_distance_m
|
float
|
Maximum donor distance in metres, default 1.0; zero disables filling.
A source-ID raster is always written alongside the tile as
|
1.0
|
crs
|
str
|
CRS voor |
crs
|
sources
|
FunctioneelLandgebruikSources
|
Explicit source GeoPackage paths. Mutually exclusive with
|
None
|
data_store
|
DataStore
|
Datastore used to derive default source paths. Mutually exclusive with
|
None
|
layers
|
FunctioneelLandgebruikLayers
|
Source layer names. Defaults to the package layer-name conventions. |
None
|
download_missing_sources
|
bool
|
Whether missing source datasets are downloaded before building. If
omitted, the deprecated |
None
|
download_missing
|
bool
|
Backwards-compatible alias for |
None
|
overwrite
|
bool
|
If False and |
True
|
output_config
|
RasterOutputConfig
|
GeoTIFF block size and overview factors. |
None
|
mapping_csv
|
Path
|
Editable land-use table. Defaults to the CSV included in the package. |
None
|
diagnostics_path
|
Path
|
GeoPackage met uitsluitend NoData-vlakken en een reden per vlak. Alleen geschreven bij een nieuwe berekening. Bij hergebruik van een raster zonder controlebestand volgt een foutmelding. |
None
|
building_index_path
|
Path
|
Shared building identity lookup from |
None
|
building_context_m
|
float
|
Extra prepared neighbours around complete footprints for DEM donor exclusion. Must cover the DEM's maximum building search distance. |
5.0
|
landgebied_path
|
Path
|
Bestuurlijke gebieden GeoPackage with the landgebied boundary used when filling gaps. If omitted, use the default boundary location. Only read when gap_fill_distance_m is greater than zero. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The written or reused |
Side Effects
May download missing BGT, BAG, BRP and Top10NL source files to
the configured datastore paths. The GeoTIFF is written to a temporary file
beside target_path and atomically replaces the target after successful
raster creation. A same-stem QGIS .qml file with category labels is
written for newly produced rasters. Reused rasters and styles are unchanged.
bouw_functioneel_landgebruik_tiles(target_dir, *, tiles_path=None, workers=None, overwrite=False, tile_ids=None, resolution_m=0.5, gap_fill_distance_m=1.0, crs=settings.crs, sources=None, data_store=None, layers=None, output_config=None, download_missing_sources=True, show_progress=False, mapping_csv=None, diagnostics_path=None, write_building_ids=False, building_context_m=5.0)
Build functional land-use GeoTIFF tiles from a tile index.
The tile index is read with :func:waterlagen.raster.tiles.read_tiles,
validated for the required tile columns, optionally filtered by
tile_ids, and converted into one worker job per selected tile. Existing
tile files are reused when overwrite is False. Before submitting work,
missing shared source datasets can be downloaded once in the parent process
and all configured source paths are validated.
Each submitted tile is built by :func:bouw_functioneel_landgebruik in a
process-pool worker. Worker jobs receive explicit source paths, layer names,
raster resolution, CRS, bounds, and output settings. Workers do not perform
source downloads. Failed tiles are collected and reported together as a
:class:TileBuildError; successful and skipped tile paths are returned in
the same order as the selected tile index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dir
|
Path
|
Directory where tile GeoTIFFs are written. |
required |
tiles_path
|
Path
|
Tile-index dataset. When omitted, the default tile index from
:func: |
None
|
workers
|
int
|
Number of worker processes. Defaults to |
None
|
overwrite
|
bool
|
If False, existing target tiles are skipped and returned as-is. |
False
|
tile_ids
|
Collection[str]
|
Optional subset of tile IDs to build. Unknown tile IDs raise a
|
None
|
resolution_m
|
float
|
Raster cell size passed to each tile build, by default 0.5. |
0.5
|
gap_fill_distance_m
|
float
|
Maximum donor distance in metres, default 1.0; zero disables filling. |
1.0
|
crs
|
str
|
CRS voor tegelgrenzen en uitvoer. Moet overeenkomen met het
tegelrooster en :data: |
crs
|
sources
|
FunctioneelLandgebruikSources
|
Explicit source GeoPackage paths. Mutually exclusive with
|
None
|
data_store
|
DataStore
|
Datastore used to derive source paths. Mutually exclusive with
|
None
|
layers
|
FunctioneelLandgebruikLayers
|
Source layer names used by each tile build. |
None
|
output_config
|
RasterOutputConfig
|
GeoTIFF block size and overview factors. |
None
|
download_missing_sources
|
bool
|
Whether missing shared source datasets are downloaded before workers are started, by default True. |
True
|
show_progress
|
bool
|
Whether to show a tqdm progress bar for selected tiles, by default False. Completion logs always include successful and reused tiles / total; failed tiles do not increase the completed count. |
False
|
mapping_csv
|
Path
|
CSV with land-use codes, passed unchanged to every worker. |
None
|
diagnostics_path
|
Path
|
GeoPackage met één laag |
None
|
write_building_ids
|
bool
|
Also write exact building-ID rasters and complete prepared footprints. Existing tiles without companions must be rebuilt explicitly. |
False
|
building_context_m
|
float
|
Neighbour context around complete footprints, default 5 m. Must cover the maximum building search distance used in subsequent DEM production. |
5.0
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
Paths to the skipped or written GeoTIFF tiles, ordered like the selected tile index. |
Side Effects
Creates target_dir when needed, may download missing shared source
datasets, writes tile GeoTIFFs through worker processes, and logs skipped,
completed, and failed tiles.
Create a stable UInt32 lookup, retaining the original BAG string IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path
|
BAG GeoPackage and output SQLite lookup. A matching index is reused; a changed source is rejected instead of reassigning existing IDs. |
required |
target
|
Path
|
BAG GeoPackage and output SQLite lookup. A matching index is reused; a changed source is rejected instead of reassigning existing IDs. |
required |
layer
|
str
|
Source building layer, default |
'pand'
|
Returns:
| Type | Description |
|---|---|
Path
|
Read-only lookup used by every land-use worker in this production. |
Produce functional land use with building companions for an area.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_store
|
DataStore
|
Configured source and processed-data locations. |
None
|
area
|
Area
|
Named input area or water authority code; complete intersecting tiles are retained. |
nederland
|
workers
|
int
|
Override settings.functioneel_landgebruik_workers; may change on resume. |
None
|
building_context_m
|
float
|
Prepared neighbour distance needed for subsequent building sampling. |
5.0
|
mapping_csv
|
Path
|
Classification table and prepared BGT override. Other sources use the datastore. |
None
|
bgt_path
|
Path
|
Classification table and prepared BGT override. Other sources use the datastore. |
None
|
run_id
|
str
|
Output run name, default a UTC timestamp. |
None
|
resume
|
bool
|
Explicitly reuse or rebuild a compatible run. Existing inputs are checked. |
False
|
overwrite
|
bool
|
Explicitly reuse or rebuild a compatible run. Existing inputs are checked. |
False
|
refresh_sources
|
bool
|
Refresh sources for a new run, or require local inputs without downloads. |
False
|
offline
|
bool
|
Refresh sources for a new run, or require local inputs without downloads. |
False
|
preparation
|
SourcePreparation
|
Shared source policy for nested productions. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The functional-land-use COG in the area-specific production folder. |
Redactie: AI