[GIS] Geoserver tiles missing point labels that show up fine when serving as a single tile

geoserversldtiles

Using Geoserver 2.8.2, I just loaded a new "address points" layer (shp files).

I have a style I've used before, and perhaps this has happened in the past and I've not noticed, but with the custom style I have, which paints just the address number in red on a white circular background (halo), when I select (in the openlayers preview option) tiled results, some of my points disappear. When I select "single tile" all the data points display properly. The map (and the tile cache) are using the old google projection, not sure that should matter.

I can post screen shots of the map tiled and not tiled, and you can see one or two address points disappear when viewing the tiled version.

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" 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" xmlns:gml="http://www.opengis.net/gml"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  <NamedLayer>
    <Name>Address Points</Name>
    <UserStyle>
      <Name>Address Points</Name>
      <Title>Address Points</Title>
      <Abstract>prints address number on map if not zero</Abstract>
      <FeatureTypeStyle>
        <Rule>
          <Title>AddressPt</Title>
          <ogc:Filter>
            <ogc:PropertyIsGreaterThan>
             <ogc:PropertyName>ST_NUMBER</ogc:PropertyName>
             <ogc:Literal>0</ogc:Literal>
            </ogc:PropertyIsGreaterThan>
          </ogc:Filter>
          <MinScaleDenominator>0</MinScaleDenominator>
          <MaxScaleDenominator>6000</MaxScaleDenominator>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>ST_NUMBER</ogc:PropertyName>
            </Label>
            <Font>
              <CssParameter name="font-family">Arial</CssParameter>
              <CssParameter name="font-style">Bold</CssParameter>
              <CssParameter name="font-size">14</CssParameter>
            </Font>
            <LabelPlacement>
              <PointPlacement>
                <AnchorPoint>
                  <AnchorPointX>0.0</AnchorPointX>
                  <AnchorPointY>0.0</AnchorPointY>
                </AnchorPoint>
              </PointPlacement>
            </LabelPlacement>
            <Halo>
              <Radius>2</Radius>
              <Fill>
                <CssParameter name="fill-opacity">1.0</CssParameter>
                <CssParameter name="fill">#ffffff</CssParameter>
              </Fill>
            </Halo>
            <Fill>
                <CssParameter name="fill">#ff0000</CssParameter>
            </Fill>
          </TextSymbolizer>
        </Rule>
     </FeatureTypeStyle>
    </UserStyle>
    </NamedLayer>
</StyledLayerDescriptor>

This was marked as a duplicate but I'm not seeing "partial" renderings in any tiles, I'm seeing the entire point no longer rendered at all on any tile… but only at certain zoom levels.
I've also set MaxBuffer to 200 (from 25) in wms.xml and set Default Rendering Buffer on Publishing tab of the this layer in WMS settings to 200. This made no difference. I'm not entirely sure what these parameters do under the hood, but conceptually I understand them to cause the tile rendering 200px wider (presumably then including the text/drawing of any points within the buffer) and if that text/drawing then spills into the tile being drawn, then it is included in the tile. But I don't know the true mechanics of how these parameters operate. If the tile is 256×256, I would think a 200px buffer would be way sufficient, perhaps a little overkill. If nobody has any ideas, I may try the latest release (either 2.8.4 or 2.9.0), but I don't see any release notes that indicate any changes in tile generation…

Best Answer

I did further research, and the following three "vendorOption" parameters were recommended where labels are left off when you really want them labeled in the tiles. I'll explain each briefly and why it did or did not help in my case.

         <VendorOption name="spaceAround">-1</VendorOption>
         <VendorOption name="conflictResolution">false</VendorOption> 
         <VendorOption name="partials">true</VendorOption>

The first "spaceAround" option, if less than zero, will draw labels even if they overlap labels that are already drawn, often making one or more illegible. This was not my issue. My labels were well spaced apart, just some were disappearing at certain zoom levels.

The next, "conflictResolution", I believe also says to draw the label even if it may conflict with another. I have not added this one, I don't think it is relevant to my issue.

The final "partials" set to true fixed my problem. If the tile processor thought the label would overlap the edge of the tile, it was removing it. That is the default behavior. That was causing them to disappear when zoomed in, depending on where it landed on the tile it existed on at that zoom level. So they were "randomly" disappearing. Once I set this to true, the labels all appear at every zoom level. So my problem is now solved.

I did set some "gutter" values to be up to 200 in some cases, in my attempts to resolve the issue. This may be slowing down my tile generation. I'll now probably go drop those down again. I think I want some gutter, so that the labels can overlap tile boundaries and still draw nicely.

So if you look at the SLD above, at the very end of it I've simply added this one VendorOption after the end of the Fill node:

        </Fill>
        <VendorOption name="partials">true</VendorOption>
      </TextSymbolizer>

This is where you want to put it, at the very end of your TextSymbolizer.

Related Question