Colormap¶
async_geotiff.colormap ¶
High-level Colormap class for GeoTIFF colormaps.
Colormap
dataclass
¶
A representation of a GeoTIFF colormap.
GeoTIFF colormaps
as_array ¶
Return the colormap as a NumPy array with shape (N, 3) and dtype uint16.
Each row corresponds to a color entry in the colormap, with columns representing the Red, Green, and Blue components respectively.
This is the most efficient way to access and apply the colormap data.
geotiff = await GeoTIFF.open(...)
array = await geotiff.fetch_tile(0, 0)
colormap = geotiff.colormap
colormap_array = colormap.as_array()
rgb_data = colormap_array[array.data[0]]
# A 3D array with shape (height, width, 3)
Returns:
-
NDArray–A NumPy array representation of the colormap.
as_dict ¶
as_rasterio ¶
Return the colormap as a mapping to 8-bit RGBA colors.
This returns a colormap in the same format as rasterio's
DatasetReader.colormap method.
This is the same as
Colormap.as_dict with:
dtypeset tonp.uint8- an added alpha channel set to 255, except for the nodata value, if defined, which has an alpha of 0.
Returns: