LegendGraphic does not display when using transformation functions (recode, interpolate, categorize)

Description

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:

Environment

None

Activity

Show:
Torben Barsballe
February 21, 2017, 10:48 PM
Edited

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.

Andrea Aime
February 25, 2017, 10:05 AM

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.

Assignee

Unassigned

Reporter

Torben Barsballe

Triage

None

Fix versions

None

Affects versions

Priority

Medium
Configure