Can you add a color gradient to GeoTiffs?
I am trying to do what is explained in Kernel Density
We already know that with a line like this:
kde.renderPng(kdeColorMap).write(“kde-buoy-waveHeight.png”)
we can write out a PNG with color…
But I can’t seem to figure out how to add that color to a GeoTiff…
I've tried this:
val iColorMap: IndexedColorMap = new IndexedColorMap(delauColorMap.colors)
val geoTiffOptions = GeoTiffOptions(colorMap = iColorMap)
val delauWebMer: Raster[Tile] = delau.reproject(extent, LatLng, WebMercator)
val extentWebMer: Extent = extent.reproject(LatLng, WebMercator)
val headTags: Map[String, String] = Map()
val bandTags: List[Map[String, String]] = List()
val tags: Tags = Tags(headTags, bandTags)
val tiff = SinglebandGeoTiff(delauWebMer, extentWebMer, WebMercator, tags, geoTiffOptions)
tiff.write("BuoyDelau3857.tif")
but get the following exception:
IncompatibleGeoTiffOptionsException: 'Palette' color space only supported for 8 or 16 bit integral cell types.
This works:
val tiff = GeoTiff(delauWebMer, extentWebMer, WebMercator)
tiff.write("BuoyDelau3857.tif")
but doesn't give us a color map, the output is in grey-scale.