Geographic Information Systems Asked by zincalloy on April 22, 2021
I have a series of points that I have reading an attribute to display a label.
I don’t see the labels on my map until Scale = 1 : 1M when SOME of them start to show up. But it’s not until I hit Scale = 1 : 545K that they start showing up completely.
Is there something I’m missing in my SLD? I’ve tried numerous things and cannot get these labels to show prior to these zoom levels.
<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>Simple point</Name>
<UserStyle>
<Title>Points with Labels</Title>
<FeatureTypeStyle>
<Rule>
<MaxScaleDenominator>10000000</MaxScaleDenominator>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#2234cb</CssParameter>
</Fill>
</Mark>
<Size>10</Size>
</Graphic>
</PointSymbolizer>
</Rule>
<Rule>
<TextSymbolizer>
<Label>
<ogc:PropertyName>ATTRIBUTE_NAME</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>
<LabelPlacement>
<MinScaleDenominator>0</MinScaleDenominator>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>
<ogc:Literal>0.5</ogc:Literal>
</AnchorPointX>
<AnchorPointY>
<ogc:Literal>0.0</ogc:Literal>
</AnchorPointY>
</AnchorPoint>
<Displacement>
<DisplacementX>
<ogc:Literal>0</ogc:Literal>
</DisplacementX>
<DisplacementY>
<ogc:Literal>5</ogc:Literal>
</DisplacementY>
</Displacement>
<Rotation>
<ogc:Literal>0.0</ogc:Literal>
</Rotation>
</PointPlacement>
</LabelPlacement>
<Halo>
<Radius>1</Radius>
<Fill>
<CssParameter name="fill">#fffff0</CssParameter>
</Fill>
</Halo>
<VendorOption name="conflictResolution">false</VendorOption>
<VendorOption name="goodnessOfFit">1.0</VendorOption>
<VendorOption name="autoWrap">75</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
Label placement is a subtle art and GeoServer tries hard to do the right thing (no overlapping labels, each label inside it's polygon etc). You seem to be trying to prevent it helping you out in some ways but are forcing it to apply other rules. This leads to unexpected results (like only some of your labels showing up when you have zoomed out).
I've carried out some experiments using the topp:states
layer.
This is what I get with (a slightly modified version of) your SLD:
There is just one state (Texas) labeled. If we zoom in a bit we can see more state labels being added:
But a number of smaller states (New England) are still unlabeled. This is because you have requested GeoServer use a goodnessOfFit
of 1, this makes it very likely that labels which are not wholly within the polygon will be drawn (the default for polygons is 0.3). So if we turn that down to 0.0 we will get labels with in each polygon.
So now everything is labeled (and the labels are all over the place), now when we zoom out you will still "see" all the labels but reading them will be almost impossible:
Answered by Ian Turton on April 22, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP