0

I have a GeoServer with a layer that is an SQL View containing a few polygons and a value. I made the SLD and I don't get why the label only shows up once in a while when the circle is partially out of view.

Fully in view

Partially obscured

My SLD is now like this :

<StyledLayerDescriptor version="1.0.0"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/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>TestPolygons</Name>
    <UserStyle>
      <Title>Label in circle</Title>
      <FeatureTypeStyle>
        <Rule>
          <PolygonSymbolizer>
            <Fill>
              <CssParameter name="fill">#A1B8BA</CssParameter>
              <CssParameter name="fill-opacity">0.7</CssParameter>
            </Fill>
            <Stroke>
              <CssParameter name="stroke">#096437</CssParameter>
              <CssParameter name="stroke-width">0.5</CssParameter>
            </Stroke>
          </PolygonSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>CircleValue</ogc:PropertyName>
            </Label>
            <Font>
              <CssParameter name="font-family">Arial</CssParameter>
              <CssParameter name="font-size">10</CssParameter>
              <CssParameter name="font-style">normal</CssParameter>
              <CssParameter name="font-weight">bold</CssParameter>
            </Font>
            <LabelPlacement>
              <PointPlacement>
              </PointPlacement>
            </LabelPlacement>
            <Halo>
              <Radius>1</Radius>
              <Fill>
                <CssParameter name="fill">#FFFFFF</CssParameter>
              </Fill>
            </Halo>
            <Fill>
              <CssParameter name="fill">#000000</CssParameter>
            </Fill>
          </TextSymbolizer>
        </Rule>

      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

I tried making a second Rule for the TextSymbolizer, I also tried putting the TextSymbolizer inside the PolygonSymbolizer (with and without the tag) and I always get this result. Any clue what I did wrong?

3
  • It works for me with another shapefile, are you using tiles? if so you may need to enable the partial vendor option with a specific placement
    – Ian Turton
    Commented Nov 25, 2023 at 10:47
  • @IanTurton No tiling is used, just a plain wms call covering the entire extend. Could the fact that it's a SQL view layer be the problem? Commented Nov 27, 2023 at 15:26
  • maybe but it seems unlikely, can you turn logging up to GeoTools Dev and run it again then add the logfile section
    – Ian Turton
    Commented Nov 27, 2023 at 16:05

1 Answer 1

0

I found the source of the behavior. By default an SQL view puts "Geometry" as a data type, when I changed it manually to "Polygon" the labels all drew correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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