Ga naar inhoud

Rasters

create_cog_file(vrt_file, cog_file, *, overwrite=False, show_progress=True, overview_resampling='nearest', floating_point_predictor=False, regenerate_overviews=False, raster_attribute_table=None)

Create a Cloud Optimized GeoTIFF directly from a VRT file.

Parameters:

Name Type Description Default
vrt_file Path

Input VRT and output COG.

required
cog_file Path

Input VRT and output COG.

required
overwrite bool

Replace an existing COG only after successful validation.

False
show_progress bool

Show GDAL conversion progress.

True
overview_resampling (nearest, average)

Overview resampling; use nearest for IDs/classes, average for elevation.

"nearest"
floating_point_predictor bool

Use ZSTD floating-point prediction for the raster and overviews.

False
regenerate_overviews bool

Build new overviews from full-resolution values instead of copying them.

False
raster_attribute_table RasterAttributeTable

Embed this RAT during creation (GDAL >= 3.12), validating without PAM.

None

Returns:

Type Description
Path

Written or reused COG.

create_vrt_file(vrt_file, directory=None, *, files=None)

Create a mosaic, with later sources taking precedence over earlier ones.

Parameters:

Name Type Description Default
vrt_file Path

Destination VRT.

required
directory pathlib.Path or list of pathlib.Path

Directories containing TIFFs, in priority order.

None
files list of pathlib.Path

Explicit ordered sources, mutually exclusive with directory. Explicit lists are validated and the VRT is replaced atomically.

None

Returns:

Type Description
Path

Destination VRT.

inspect_raster(file)

Log lazy GDAL raster metadata for debugging.

list_tif_files_in_vrt_file(vrt_file)

Return a list of files within a vrt-file.

Redactie: AI