I've tried to create several types of GeoServer layer stylings with basic labels, both in SLD and via the GeoServer CSS extension. Yet, not once have I managed to get the labels actually rendered. Everything else renders as it should.
I'm running GeoServer 2.11 on Centos 7 (had the same issue on GS 2.9 as well). Data's coming from PostgreSQL 9.2.15 (64-bit, UTF-8 encoded databases).
For instance trying to create a simple polygon style with attribute-based labels in CSS:
* {
fill: #95C8C1;
label: [field];
font-fill: #000000;
font-family: Arial;
font-size: 7;
font-style: normal;
label-anchor: 0.5 0.5;
}
I've checked for all possible field name letter size matches vs. the data, and also non-field based labels, but nothing.
Similar styling in SLD, also does not render labels:
<StyledLayerDescriptor 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" version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>Polygon styling test</Name>
<UserStyle>
<FeatureTypeStyle>
<Rule>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#95C8C1</CssParameter>
</Fill>
</PolygonSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>field</ogc:PropertyName>
</Label>
<Font>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-style">normal</CssParameter>
<CssParameter name="font-size">7</CssParameter>
</Font>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
I've tried fiddling around with GeoServer VendorOptions (ConflictResolution etc.), but those break my stylings completely and layers fail to display. Also enabled/disabled caching, reset options, emptied caches, tried different gutters, etc., but nothing.
The only hint I've encountered so far is in the GeoServer logs:
at java.lang.Thread.run(Thread.java:745)
ERROR [renderer.label] - Error adding label to the label cache
java.lang.NullPointerException
Any idea on what is the underlying reason for all this? Is Java getting Null values for the label for some reason?
field
in your layer? check on the layer data page which will show you the attributes