Finally, I figured it out! There is an obscured parameter in older ('stable') versions of Geoserver, which was finally exposed through SLD vendorOption in the latest release of Geoserver/Geotools. This parameter MIN_GOODNESS_FIT is used when labeling polygons in particular. Based on MIN_GOODNESS_FIT geotools determines if From geoserver docs:
Geoserver will remove labels if they are a particularly bad fit for the geometry they are labeling.The label is sampled approximately at every letter. The distance from these points to the polygon is determined and each sample votes based on how close it is to the polygon
so labels are removed if letters are beyond a certain threshold from the polygon. That meant that small buildings (especially ones with longish names) would never be labeled.
However, in Geoserver 2.1 the SLD VendorOption "goodnessOfFit" is exposed
Syntax follows this example:
the default value is 0.5, so anything lower will allow more lables to be placed.
Issue discussion:
1 comment:
Hi Ben, thank you very much for this post. I was struggling to show the label of small polygon and the vendor option was just the one, that I was searching. Cheers!
Post a Comment