semantique.processor.arrays.Array.to_geotiff

semantique.processor.arrays.Array.to_geotiff#

Array.to_geotiff(file, cloud_optimized=True, compress=True, output_crs=None)[source]#

Write the content of the array to a GeoTIFF file on disk.

Parameters:
  • file (str) – Path to the GeoTIFF file to be written.

  • cloud_optimized (bool) – Should the written file be a Cloud Optimized GeoTIFF (COG) instead of a regular GeoTIFF? Ignored when a GDAL version < 3.1 is used. These GDAL versions do not have a COG driver, and the written GeoTIFF will always be a regular GeoTIFF.

  • compress (bool) – Should the written file be compressed? If True, LZW compression is used.

  • output_crs (optional) – Spatial coordinate reference system of the written GeoTIFF. Can be given as any object understood by the initializer of pyproj.crs.CRS. This includes pyproj.crs.CRS objects themselves, as well as EPSG codes and WKT strings. If None, the CRS of the array itself is used.

Returns:

str – Path to the written GeoTIFF file.

Raises:
  • exceptions.InvalidValueTypeError – If the value type of the array is not supported by the GeoTIFF exporter.

  • exceptions.TooManyDimensionsError – If the array has more than three dimensions, including the two unstacked spatial dimensions. More than three dimensions is currently not supported by the export functionality of rasterio.