You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But when I try to render tiles, it complains that the colors cannot be converted from hex to rgb. This is due to the colormap function in models.py where it tries to convert the color associated with the continuous expression to a rgb color:
@property
def colormap(self):
legend = json.loads(self.json)
cmap = {}
for leg in legend:
cmap[leg['expression']] = hex_to_rgba(leg['color'])
return cmap
My workaround was to update the colormap function, but I am not sure if this was the actual issue, or if my legend was not correctly created.
@property
def colormap(self):
legend = json.loads(self.json)
cmap = {}
for leg in legend:
if leg['expression'] == 'continuous':
cmap[leg['expression']] = leg['code']
else:
cmap[leg['expression']] = hex_to_rgba(leg['color'])
return cmap
The text was updated successfully, but these errors were encountered:
Hi,
I have an issue with the use of programmatically created legends, but I am not sure if this is a bug or a misuse of my part.
First, I create programmatically a grayscale legend:
But when I try to render tiles, it complains that the colors cannot be converted from hex to rgb. This is due to the
colormap
function inmodels.py
where it tries to convert the color associated with thecontinuous
expression to a rgb color:My workaround was to update the
colormap
function, but I am not sure if this was the actual issue, or if my legend was not correctly created.The text was updated successfully, but these errors were encountered: