With Geoserver 2.27.2 I’m trying to create an sld for a point layer, with a circle mark with a dynamic size using the categorize
function. The layer source column I intend to use to determine the appropriate size is of a float type (doesn’t matter if postgresql or a shape file). It contains no null or 0 values. If the style looks like below then the legend is ok as a png, not as json.
So this works
wms?service=WMS&version=1.1.0&request=GetLegendGraphic&layer=demoshape&format=image/png&scale=400
while this does not:
wms?service=WMS&version=1.1.0&request=GetLegendGraphic&layer=demoshape&format=application/json&scale=400
The exception is:
java.lang.NullPointerException: ECQL does not support null literal value
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>Simple Point</Name>
<UserStyle>
<Title>Demo style</Title>
<FeatureTypeStyle>
<Rule>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#FF000B</CssParameter>
</Fill>
</Mark>
<Size>
<ogc:Function name="Categorize">
<ogc:PropertyName>flyttal</ogc:PropertyName>
<ogc:Literal>5</ogc:Literal>
<ogc:Literal>2</ogc:Literal>
<ogc:Literal>10</ogc:Literal>
<ogc:Literal>4</ogc:Literal>
<ogc:Literal>15</ogc:Literal>
<ogc:Literal>6</ogc:Literal>
<ogc:Literal>20</ogc:Literal>
</ogc:Function>
</Size>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
If I use categorize for the stroke-width
property instead, like below, then the getlegendgraphic with a scale param for application/json works:
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>Simple Point</Name>
<UserStyle>
<Title>Demo style</Title>
<FeatureTypeStyle>
<Rule>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#FF000B</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#D3D3D3</CssParameter>
<CssParameter name="stroke-width">
<ogc:Function name="Categorize">
<ogc:PropertyName>flyttal</ogc:PropertyName>
<ogc:Literal>5</ogc:Literal>
<ogc:Literal>2</ogc:Literal>
<ogc:Literal>10</ogc:Literal>
<ogc:Literal>4</ogc:Literal>
<ogc:Literal>15</ogc:Literal>
<ogc:Literal>6</ogc:Literal>
<ogc:Literal>20</ogc:Literal>
</ogc:Function>
</CssParameter>
</Stroke>
</Mark>
<Size>
4
</Size>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
If the scale
param is omitted from the getlegendgraphic call then it always succeeds (and note that the style isn’t scale variable)
Is this a known issue (or am I doing something wrong)?
Edit.
interpolate
similarly configured doesn’t have the same issue (for my specific usecase involving around 100k points it doesn’t appear fast enough, but that’s beside the point)