1

I've used SLD to style road features in Geoserver. As roads include multiple segments the 'group' attribute has been used to control label repeat of roads. The problem is some labels can't be placed on the centerline of roads. In the image below, label 2 is my desire and label 1 is the problematic one.

enter image description here

I applied the 'PerpendicularOffset' to 0 (default) which should do the job, but no success has been made.

<se:TextSymbolizer>
    <se:Label>
      <ogc:PropertyName>name</ogc:PropertyName>
    </se:Label>
    <se:LabelPlacement>
      <se:LinePlacement>
        <se:PerpendicularOffset> 0 </se:PerpendicularOffset>
      </se:LinePlacement>
    </se:LabelPlacement>
    <se:Fill>
      <se:SvgParameter name="fill">#523735</se:SvgParameter>
    </se:Fill>
    <se:VendorOption name="followLine">true</se:VendorOption>
    <se:VendorOption name="maxAngleDelta">90</se:VendorOption>
    <se:VendorOption name="maxDisplacement">200</se:VendorOption>
    <se:VendorOption name="repeat">200</se:VendorOption>
    <se:VendorOption name="group">yes</se:VendorOption>
</se:TextSymbolizer> 
2
  • which version of GeoServer are you using?
    – Ian Turton
    Commented Sep 13, 2018 at 7:39
  • @IanTurton, its version is 2.12. Commented Sep 14, 2018 at 5:36

1 Answer 1

1

I would try removing <se:VendorOption name="maxDisplacement">200</se:VendorOption> as this will allow the label engine to move labels around to fit more in and may cause it to settle for "off" line positions.

Though I would say that non latin labels are probably tested less than latin text (due to the distribution of developers) so if you can contribute a small test dataset and style we may be able to look at improving label positioning. Please join the user list and discuss this.

1
  • I changed 'maxDisplacement' to 0 but the result was the same. The dataset I've been using is the city of Tehran, Iran which obtained from OSM. Commented Sep 15, 2018 at 4:38

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.