Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Discrete color maps #9

Open
kokoalberti opened this issue Aug 15, 2019 · 2 comments
Open

Discrete color maps #9

kokoalberti opened this issue Aug 15, 2019 · 2 comments

Comments

@kokoalberti
Copy link

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 (cogeotiff/rio-tiler#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!

@vincentsarago
Copy link
Owner

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")

@kokoalberti
Copy link
Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants