Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
MINDISTANCE does not regard label bounds #5369
Identical labels are placed too close together. MINDISTANCE should prevent this, but
The attached images shows this: Kreuzeskirchstr. are two separate linestrings and both labels are rendered even with a MINDISTANCE of 100.
My proposed change in #5464 (still work in progress) would buffer the bbox of the current label to draw (in
This not a 100% solution, as it does not use the actual text path the label, but it would be more complex to buffer this polygon. However, it does use the text path polygon from the label cache. This is still quite efficient as only identical text labels are tested for intersection and
My main question is: This will change the output of existing styles that use the MINDISTANCE feature. Less labels are expected as the MINDISTANCE is now calculated from the label bounds and not the label center. Is this OK, as long as it is documented in the changelog for 7.2? (As the current behavior does not match the documentation). Should I ask on mapserver-dev?
I've uploaded images which show how it is now possible to evenly distribute labels. https://gist.github.com/olt/39ee2c4df38bd51e8983c8db69168988
I also did more performance tests. I did multiple runs of shp2img with -c 100, I switched between old and new version each time so that CPU throttling does affect both in the same way.
Note: The largest impact in rendering is still the font rendering. I used different MINDISTANCE values so that the old and new version both render the same number of labels.
added a commit
Aug 2, 2017
My 0.02$: I like this enhancement (Thanks!) and I think it is okay for the new version to produce a different output for the same MINDISTANCE value since the new behavior is closer to what one would expect MINDISTANCE to do in my opinion. However it may be a good idea to bring this up on the -dev list to get more opinions and to make sure there is no bad surprise after the 7.2 release.