When making a GetLegendGraphic request, recode results in a blank legend
The following style works fine:
However, when translated to use recode, it does not display:
The equivalent SLD also doesn't work, so this issue is not limited to YSLD:
I do not have a copy of the data that this error was encountered with.
strikethrough}I have tested similar style on the current master and was not able to reproduce the issue.
It turns out this was only occurring with GetLegendGraphic. I have updated the ticket accordingly.
Looking at BufferedImageLegendGraphicBuilder.createSampleFeature, it appears the sample feature is initialized with null values, meaning recode doesn't match anything, resulting in a blank style.
A better approach would be to fetch an arbitrary feature from the store, similar to how the sample feature on the style page "Attributes" tab works.
Would still not provide a usable legend imho.
Alternative suggestion: if there is only one transformation function in the current rule (recode, interpolate, categorize), explode the rule into several rules, one per class, using a style visitor, and then let the current code run its course.
If there are more than one, it gets tricky... maybe it's the same function with the same break-points, in that case, the two are really behaving as one and it's still simple, if the two are against the same variable, then again not too hard to build a combination, if two variables then uh, it's a combinatorial explosion and it's probably best to let go.