[Qgis-user] QGIS 2.0 label problem

Larry Shaffer larrys at dakotacarto.com
Sat Feb 1 13:20:31 PST 2014


Hi Lester,

On Sat, Feb 1, 2014 at 2:16 AM, Lester Anderson <arctica1963 at gmail.com>wrote:

> There should be a proper solution. In my work, I often have clipped raster
> layers which are contoured and labelled, and I wish to compare these with a
> larger dataset (also contoured and labelled). If the vector contour layer
> is covered by the opaque overlying raster, then so to should the labels for
> that vector layer - this is just common logic.
>
> I think this labelling issue needs to be addressed by the developers as it
> is clearly a flaw. Take it to the extreme and have the top raster totally
> covering the lower one that has a vector contour layer labelled, and you
> immediately see the incosistency.
>
> Adding this feature (already logged as issue ticket #3257 [0]) will
require a considerable amount of work and possibly a large refactoring of
the labeling engine. This is not to say the request should not be
addressed, but simply that it is not so simple to implement. The feature
you request has certainly been brought up before.

The difficulty lies with PAL, the automated labeling library, which
provides a solution *only after* duplicates of all features to be labeled
have been registered with it. This is why labels are drawn on top of
everything else, because the layers are rendered in 'render order' and any
vector features to be labeled registered with the labeling engine, which
finally does its canvas drawing last.

There are several considerations to implementing this feature (let's call
it 'label obstacles'):

1) Individual layers need a setting to turn on label obstacles. (Not the
same concept as the current "Discourage..." setting.) This should allow all
vector features or raster extents to be obstacles and also include support
for defining a vector expression or raster calculation. There could also be
data defined support for vector layer feature attributes, e.g. a
'label_obstacle' column.

2) All calculated obstacle geometries would then be registered as obstacles
to avoid in PAL, with any polygons also subtracted from the clipping mask
used to clip feature geometries prior to input to PAL.

While this seems pretty straightforward, there are some definite hurdles:

* Raster layers are not currently part of the the labeling process at all.
On-the-fly calculation for figuring not just the extent, but also the
extent clipped of nodata, or even defined transparent, pixels would
significantly slow rendering down. The workaround is to not do so; instead,
requiring users to generate vector layers from the rasters to be used as
proxy obstacle layers. There should probably be a setting for whether the
obstacle features are rendered or not, i.e. invisible obstacles, without
turning off their parent layer's rendering.

* To truly be obstacles, this means individual label extents should never
intersect the obstacle, i.e. auto-placement label candidates are always
calculated to lie outside the obstacle, taking into account *all* label
characteristics/components. This will require a large refactoring of the
way final label output is calculated, currently with some label aspects
before PAL solution and some after. The entire, final label needs
calculated prior to input into PAL. However, this is something that already
needs done, so label components won't overlap other labels.

* If implemented, this still means labels are drawn on top of everything
else, just not over obstacles. Cartographically speaking vector and raster
layers should be able to 'mask' labels, i.e. labels can be drawn just
above, or even below their layer, with layers rendered above capable of
showing the labels underneath, if they have semi-transparency or a specific
blending mode. This would require a large refactoring of how the labeling
engine interacts with rendering. It is doable, but was voted down last time
it came up in developer discussions.

Please add your comments or testing results to feature #3257's ticket.

[0] http://hub.qgis.org/issues/3257

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota


There is no workaround for this problem from what I can see.
>
> Cheers
>
> Lester
>
>
> On 1 February 2014 08:13, Harish <harry.om2000 at gmail.com> wrote:
>
>> There should be solution when user user does not want labels of
>> underlying layers to be shown, without making the labels invisible.
>>  Regards
>>
>>
>> On Sat, Feb 1, 2014 at 12:27 AM, Nathan Woodrow <madmanwoo at gmail.com>wrote:
>>
>>> Hey Lester,
>>>
>>> Labels always render above all other layers.
>>>
>>> - Nathan
>>>
>>>
>>> On Sat, Feb 1, 2014 at 9:55 AM, Lester Anderson <arctica1963 at gmail.com>wrote:
>>>
>>>>
>>>> Hello
>>>>
>>>> I have a issue with labels. If I have a base raster, overlay a contour
>>>> layer with labels, and then a top raster, the labels from the underlying
>>>> contour vector layer show when they should be covered - why should that be ?
>>>>
>>>> Cheers
>>>>
>>>> Lester
>>>>
>>>> _______________________________________________
>>>> Qgis-user mailing list
>>>> Qgis-user at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>>
>>>
>>>
>>> _______________________________________________
>>> Qgis-user mailing list
>>> Qgis-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>
>>
>>
>>
>> --
>> Harish Kumar Solanki, Assistant Professor
>> National Institute of Rural Development (NIRD), Jaipur Center
>> Ministry of Rural Development, Government of India
>> Chaupal, Near Railway Station
>> Jaipur -302006
>>
>> Geo_Coordinates (Office): 26.92162 N, 75.78921 E
>>
>> Email- hksolanki at nird.gov.in, harry.om2000 at gmail.com,
>> Phone (Office) - 0141-2209904, Fax- 0141-2209905
>> Mo.- 09214446732, 09414291732
>> Website-  http://www.nird.org.in, <http://www.nird.org.in>
>>
>> <http://www.nird.org.in>
>>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20140201/dc9b55bd/attachment.html>


More information about the Qgis-user mailing list