developmentseed / titiler-stacapi

Connect titiler to STAC APIs
https://developmentseed.org/titiler-stacapi/
MIT License
5 stars 5 forks source link

Parameter conversion from STAC render extension to TiTiler #21

Closed StijnCaerts closed 5 months ago

StijnCaerts commented 5 months ago

We are trying to use a custom colormap configured in the STAC render extension, following the color map JSON definition. https://github.com/stac-extensions/render?tab=readme-ov-file#render-object

But this is not recognized in TiTiler because the validation of the colormap parameter is expecting a str instead of a dict.

I was able to fix this locally by dumping the JSON dict back into a str when constructing the LayerDict, but I don't know if this is the best solution.

https://github.com/developmentseed/titiler-stacapi/blob/aaf424912107ee7edebb79a8ca58cf30233673e8/titiler/stacapi/factory.py#L650-L652

# TODO:
# special encoding for ColorMaps
render = layer["render"] or {}
if "colormap" in render:
    render["colormap"] = json.dumps(render["colormap"])
vincentsarago commented 5 months ago

😓 https://github.com/developmentseed/titiler-stacapi/blob/aaf424912107ee7edebb79a8ca58cf30233673e8/titiler/stacapi/factory.py#L650-L651

yeah I forgot to deal with this