7

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

nmtoken
  • 13,355
  • 5
  • 38
  • 87

1 Answers1

1

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).

Ian Turton
  • 81,417
  • 6
  • 84
  • 185