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:PerpendicularOffset> 0 </se:PerpendicularOffset>
      <se:SvgParameter name="fill">#523735</se:SvgParameter>
    <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>
  • which version of GeoServer are you using? – Ian Turton Sep 13 '18 at 7:39
  • @IanTurton, its version is 2.12. – nasser tahani Sep 14 '18 at 5:36

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.

| improve this answer | |
  • 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. – nasser tahani Sep 15 '18 at 4:38

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.