Bug report #6315
new labelling engine stopped placing label within visible polygon area
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||all||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||15607|
There's been a recent wave of fresh improvements to the new labelling system, and that has been fantastic!
However, I noticed a pretty big regression: the engine (in 1.8, and in the trunk built until very recently) used to automatically place a label within the visible area of a polygon (this was the default behavior of the "around centroid" placement method). This was extremely useful when working with polygons having large areas beyond rendered zoom level (such as administrative district areas).
I'm not sure whether it's actually a regression or the above behavior was an unintended "bonus" :) but it's beyond the point. Would there be a way to have this behavior back into the engine?
Once again, thanks to the ppl involved in greatly improving the labelling feature.
#1 Updated by Larry Shaffer over 7 years ago
Indeed, 'big regression' is an accurate way of describing that loss of functionality. I have confirmed your results.
I've been adding recent labeling features, and in implementing the new 'Offset from point' I appear to have overlooked the dynamic clipping of polygons (for creation of centroids) as the default, which also affects 'around centroid'. I believe I can not only fix this, but also retain the new functionality.
What you are seeing now is the centroid for around and offset being figured off the centroid for the whole feature's polygon, not one that has been clipped to the map canvas' extent (as before). Having both options would be good. There are situations when the label staying at the centroid of the whole feature's polygon, as well as adjusting to the visibly clipped polygon, would be advantageous.
Thank you for the prompt report on the regression. I will work on a fix for this ASAP.
#2 Updated by Larry Shaffer over 7 years ago
Also, the centroid for some polygons will be calculated to lie outside of the polygon. There is currently no an option for calculating centroid and always ensuring the point is on the 'surface' of the polygon.
See (comments 15-17) of #4634
The 'Horizontal (slow)' option seems to always put the label on the surface, but does not appear to place it relative to a centroid of either the feature's polygon, or the one visibly clipped to the extent.
#4 Updated by Mathieu Pellerin - nIRV over 7 years ago
Larry, that was fast :) -- I'll confirm the behavior fix as soon as osgeo4w gets an updated trunk build.
This is great, you've not only fixed a regression, but actually refined the feature. I did run into a couple of times where I wished there would be an option to make the centroid stick to the polygon's whole area.
Kudos, will confirm asap.
#7 Updated by Giovanni Manghi over 7 years ago
Peter Rodgers wrote:
I'm not new to GIS but am new to Quantum GIS. Im running version 1.8 Lisboa.
Please could you point me in the direction of, or provide, a "beginners" step-by-step guide on how to apply this (or any other) fix?
you must install the development version of QGIS, under Windows you do it with the osgeo4w installer.
#8 Updated by Mathieu Pellerin - nIRV over 7 years ago
For the record, this issue is not affecting QGIS 1.8.
As for applying patches, this is a good starting point: https://github.com/qgis/Quantum-GIS/blob/master/INSTALL