Discrete color maps
Hi Vincent,
I was just wondering if discrete colormaps will work with lambda-tiler or if it's something that could be useful to add in the future. Especially for things like land use maps and other classified rasters.
Was doing some digging and found that they were added to rio-tiler recently (https://github.com/cogeotiff/rio-tiler/pull/92) but it seems lambda-tiler uses rio-tiler's get_colormap with just the color_map query string parameter.
Not sure what would be the best approach to implement this. Passing a dict in a query string seems a bit messy, maybe another parameter for a discrete color map, or some other format for the color_map parameter to make lambda-tiler realize that it needs to fetch a discrete color map instead.
Thanks!
Hi @kokoalberti As pointed rio-tiler supports discrete color map but you need to pass a dict to it, I haven't given a lot of thought on this and what I usually do is to create a custom lambda-tiler with a case like
if color_map and color_map == "custom":
color_map = {
66: [255, 255, 204],
322: [255, 255, 204],
...
}
elif color_map:
color_map = get_colormap(color_map, format="gdal")
Ok thanks, I'll have a look, that should work for now.
It seems difficult anyway to map all these raster visualization options like colormaps, interpolation (linear/discrete/exact) and modes (continuous/equal interval/quantiles) to some sensible parameters that can be passed in a query string.