4

I have problem with the Geoserver.

I have a layer (called "cities") which contains points with attributes. (ID, Name, Layer, etc....) I'd like to write out all the names (at now it doesn't matter if overlap eachother). In the geoserver the points showed correctly but the text-s are missing. Under an exact zoom level the all text shown correctly but above that level nothing. Just the marker point.

This 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">
  <NamedLayer>
    <Name>Point with styled label</Name>
    <UserStyle>
      <Title>GeoServer SLD Cook Book: Point with styled label</Title>
      <FeatureTypeStyle>
        <Rule>
        <ogc:Filter>
         <ogc:PropertyIsEqualTo>
           <ogc:PropertyName>layer</ogc:PropertyName><![CDATA[
]]>
           <ogc:Literal>17</ogc:Literal>
         </ogc:PropertyIsEqualTo>
       </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#FF0000</CssParameter>
                </Fill>
              </Mark>
              <Size>6</Size>
            </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>textstring</ogc:PropertyName>
            </Label>
            <Font>
              <CssParameter name="font-family">Arial</CssParameter>
              <CssParameter name="font-size">12</CssParameter>
              <CssParameter name="font-style">normal</CssParameter>
              <CssParameter name="font-weight">bold</CssParameter>
            </Font>
            <Fill>
              <CssParameter name="fill">#000000</CssParameter>
            </Fill>
            <VendorOption name="spaceAround">-10</VendorOption>
            <VendorOption name="maxDisplacement">1</VendorOption>
          </TextSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Is there any basic restrictions to the labels or any default settings? Thanks! :)


Update: I updated the SLD with the "conflitresolution". In the attached image you can see, nothing happened. Originaly the basic map created in Arcgis. The cartographer who originaly (a few years ago) created the map placed every single label to the right place (that time they made paper maps not webmaps). Now I'd like to put almost every label back to their place. The original shape has different layer to bigger and smaller cities and exact anchor point, angle, font size ect.... So that is why I'd like to show all label at the same time and scale, because the layera are scale dependent. enter image description here

Thanks again :)


Update 2: I tired Mario's code but still the same problem :/ enter image description here

3

I guess your map is tiled, and GeoServer by default won't paint partial labels, those crossing tile boundaries, as there is no guarantee the other half will be visible. You can force them to appear like this:

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

You will need at least version 2.6.x, see also http://docs.geoserver.org/2.6.x/en/user/styling/sld-reference/labeling.html#partials

  • I am use this VendorOption, but not solve my problem. – Vaishali Dec 22 '16 at 8:59
1

By default GeoServer tries very hard to not overlap your labels (as this generally what the user wants). You can change this behaviour by setting the vendor option conflictResoloution to false.

<VendorOption name="conflictResolution">false</VendorOption>
  • i tried but still nothing. (see original question for more details). Thanks :) – Kgerg0 Jul 24 '14 at 13:19
  • you will need to remove the other vendor options. – Ian Turton Jul 24 '14 at 13:48
  • still nothing change :/ – Kgerg0 Jul 24 '14 at 14:10
0

I often have the same problem and I mostly solve it with following vendor options

      <VendorOption name="goodnessOfFit">0.1</VendorOption>
      <VendorOption name="conflictResolution">false</VendorOption>
      <VendorOption name="spaceAround">-1</VendorOption>

I hope it helps.

  • Hi thank you your answer. I tired the code and you can see above the result. The labels now overlap each other but still have some wich are don't seen. Tahnk you again! Gergo – Kgerg0 Jul 25 '14 at 7:07
  • Yes I know, but this is the best I found. If you find better solution, please let me know. :) – Mario Miler Jul 25 '14 at 10:07
-1

Did you try a smaller value for:

<VendorOption name="spaceAround">-10</VendorOption>

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.