6

I have an SLD file for a road layer in GeoServer. I wish only to show the labels for that layer (no symbol for the line objects) and I wish to only see them once for each road when I view my layer in for instance an OpenLayers map viewer. Right now I have many duplicate road names showing when I zoom in close.

I tried to use functions such as: VendorOption: name="group"true and VendorOption name="repeat">0< etc. But that didn't help me.

To show how the problem looks:

enter image description here

The SLD I got now is this:

enter image description here

5
  • 1
    please show a screen shot of the issue and the SLD for the labelling. Also are you using tiles?
    – Ian Turton
    Sep 26 '16 at 13:45
  • Hello iant. I just updated my question with a screenshot of both the problem and my cuurent sld. We are using tiles. Oct 3 '16 at 9:26
  • I am having the same problem. I am using vendor options to group and not repeat.
    – geoJshaun
    Jun 1 '17 at 18:51
  • 1
    did you find any solution? Jun 12 '19 at 7:23
  • 2
    Make OpenLayers to send SingleTile requests. GeoServer is handling GetMap requests one by one and it does not know that after one 256x256 pixel request there will come a new request for the adjacent tile. As a result GeoServer inserts one label on each tile.
    – user30184
    Jun 28 '19 at 6:09
0

As @user30184 you could ask OpenLayers to request the labels layer as a single image instead of a series of tiles that GeoServer sees as completely separate requests.

Or you can specify an exact position for each label and ask GeoServer to place the label there. This can be done by creating a new data layer for your labels. Or by using the <Geometry> tag in the rule with a function that reduces the lines to a single point (e.g. Centroid). In both of these cases you would need to set the VendorOption partials to true so that labels that cross a tile boundary are still drawn (on both tiles).

Not the answer you're looking for? Browse other questions tagged or ask your own question.