2

Labels are being hidden in GeoServer on a single tile image. I suspect this is because they are too close to one another.

Based on other questions here, I have tried to add:

<VendorOption name="conflictResolution">false</VendorOption>

to the TextSymbolizer. It doesn't seem to do anything. Neither does spaceAround with a negative value. At the moment I am not displaying the polygon, just the labels (although I would like both).

I want to turn conflictResolution off completely, and show all labels, even if they overlap.

These two parameters are mentioned in this question, where they appear to have solved the persons problem: GeoServer VendorOption for SLD to place labels overlapping and out of bounds

(they have another problem of labels being near the edge of the image, which I do not have).

Here is my SLD:

<?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">
  <!-- a Named Layer is the basic building block of an SLD document -->
  <NamedLayer>
    <Name>area</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <TextSymbolizer>

           <Label>
             <ogc:PropertyName>shortest_label</ogc:PropertyName>
           </Label>
            <Font>
                <CssParameter name="font-family">Arial, Verdana, Sans-Serif</CssParameter>
                <CssParameter name="font-size">12</CssParameter>    
                <CssParameter name="font-weight">normal</CssParameter>                                                  
            </Font>
            <Halo>
              <Fill>
                <CssParameter name="fill">#ffFFFF</CssParameter>
              </Fill>
            </Halo>            
            <VendorOption name="conflictResolution">false</VendorOption>
            <VendorOption name="spaceAround">-1</VendorOption>
          </TextSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
3

It could be that your guess is wrong and the labels are not showing because:

  • the polygon is too small compared to the label (see the "goodnessOfFit" parameter)
  • the label is going to cross the tile borders and is left out (see the "partials" vendor option, but mind, it's probably not available in 2.6.x)

http://docs.geoserver.org/latest/en/user/styling/sld/reference/labeling.html#geoserver-enhanced-options

  • I also seemed to need <VendorOption name="spaceAround">-1</VendorOption> and <LabelPlacement> <PointPlacement> <AnchorPoint> <AnchorPointX>0.5</AnchorPointX> <AnchorPointY>0.5</AnchorPointY> </AnchorPoint> </PointPlacement> </LabelPlacement> – zod May 11 '17 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.