1

Is there a way within the SLD to ensure that the label always appears within the polygon?

For example, in odd shaped polygons (with a hole, or a horseshoe shape) my labels are sitting outside.

I'd prefer not to create a another layer/ view on the database of the centroids - it's a very large dataset.

1

Geoserver labels polygons,by default at the determined centroid of the polygon.

You can try the Geoserver Extension PolygonAlign to allow Geoserver to try different orientations for the label to get it to fit ..

GeoServer normally tries to place labels horizontally within a polygon, and gives up if the label position is busy or if the label does not fit enough in the polygon. This option allows GeoServer to try alternate rotations for the labels.

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.