Closed robintw closed 5 months ago
The custom colormaps section of the documentation gives an example of:
response = requests.get( f"titiler.xyz/cog/preview", params={ "url": "<YOUR COG HERE>", "bidx": "1", "colormap": { "0": "#e5f5f9", "10": "#99d8c9", "255": "#2ca25f", } } )
It seems to be impossible to send JSON parameters in the params dict using request, and this led to various errors from inside the rio-tiler code complaining that the colormap was just the number 0.
0
I managed to fix this by changing it to:
response = requests.get( f"titiler.xyz/cog/preview", params={ "url": "<YOUR COG HERE>", "bidx": "1", "colormap": json.dumps({ "0": "#e5f5f9", "10": "#99d8c9", "255": "#2ca25f", }) } )
Is this the correct way to solve this? If so, I'm happy to do a PR to fix the docs, but I wanted to check first.
fixed in https://github.com/developmentseed/titiler/commit/02617ac5af5e6ab995a6873420213ac945fd65a6
Problem description
The custom colormaps section of the documentation gives an example of:
It seems to be impossible to send JSON parameters in the params dict using request, and this led to various errors from inside the rio-tiler code complaining that the colormap was just the number
0
.I managed to fix this by changing it to:
Is this the correct way to solve this? If so, I'm happy to do a PR to fix the docs, but I wanted to check first.