<?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>Parcel</Name>
<UserStyle>
<Title>Parcels</Title>
<FeatureTypeStyle>
<Rule>
<MinScaleDenominator>100</MinScaleDenominator>
<MaxScaleDenominator>6000</MaxScaleDenominator>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#CC3300</CssParameter>
</Fill>
</Mark>
<Size>6</Size>
</Graphic>
</PointSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
This is my style file. I want to get legend graphic wit a query http://localhost:8080/geoserver/PGIS/wms?REQUEST=GetLegendGraphic
This is returning a circle but not include text:
Bu it should be like this:
If I add multiple rules, text label is appearing.
Best Answer
If you add LEGEND_OPTIONS parameter to your request and the value forceLabels:on then you can force GeoServer to draw the text for a single rule. Here is an example of a request:
http://demo.opengeo.org/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=topp:states&STYLE=point&LEGEND_OPTIONS=forceLabels:on