Ga naar inhoud

Functioneel landgebruik

Voor een volledige kaart per gebied gebruikt u de productie-ingang. Gebruik de functies hieronder voor een eigen raster of tegelselectie.

Bekijk het voorbeeldscript

Eén raster berekenen · bouw_functioneel_landgebruik

waterlagen.functioneel_landgebruik.bouw_functioneel_landgebruik

Python-aanroep
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.

Wat krijgt u terug?

Type Betekenis
Path

The written or reused target_path.

Instellingen en invoer

Naam Type Betekenis Standaardwaarde
target_path Path

GeoTIFF path to write.

Verplicht
bounds tuple[float, float, float, float]

Output bounds as (xmin, ymin, xmax, ymax) in crs.

Verplicht
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 functioneel_landgebruik_bronnen.tif for standard tile-folder names; legacy filenames retain the sibling bronnen directory.

1.0
crs str

CRS voor bounds en uitvoer. Moet bij een nieuwe berekening overeenkomen met :data:waterlagen.settings.settings.crs.

settings.crs
sources FunctioneelLandgebruikSources

Explicit source GeoPackage paths. Mutually exclusive with data_store.

None
data_store DataStore

Datastore used to derive default source paths. Mutually exclusive with sources.

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 download_missing value is used when given, otherwise missing sources are downloaded.

None
download_missing bool

Backwards-compatible alias for download_missing_sources.

None
overwrite bool

If False and target_path already exists, the existing GeoTIFF is returned without validating sources, downloading, or rewriting output.

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 ensure_building_index. Writes matched gebouw_ids rasters and complete prepared gebouwen footprints without changing the land-use rasterization or priority.

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
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.

Meerdere tegels berekenen · bouw_functioneel_landgebruik_tiles

waterlagen.functioneel_landgebruik.bouw_functioneel_landgebruik_tiles

Python-aanroep
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.

Wat krijgt u terug?

Type Betekenis
list[Path]

Paths to the skipped or written GeoTIFF tiles, ordered like the selected tile index.

Instellingen en invoer

Naam Type Betekenis Standaardwaarde
target_dir Path

Directory where tile GeoTIFFs are written.

Verplicht
tiles_path Path

Tile-index dataset. When omitted, the default tile index from :func:read_tiles is used.

None
workers int

Number of worker processes. Defaults to settings.functioneel_landgebruik_workers; bounded by the number of tiles requiring processing.

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 ValueError.

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:waterlagen.settings.settings.crs.

settings.crs
sources FunctioneelLandgebruikSources

Explicit source GeoPackage paths. Mutually exclusive with data_store.

None
data_store DataStore

Datastore used to derive source paths. Mutually exclusive with sources.

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 nodata en de kolommen bron en reden. Tegelcontroles blijven bewaard in de afzonderlijke tegelmappen. Bij hergebruik worden ze uit het bestaande eindbestand gehaald. Zonder passende controle is opnieuw berekenen nodig.

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
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.

Redactie: AI