Feature request #3253
Enhancement: option to "trim other layers to match"
|Pull Request or Patch supplied:||No||Resolution:|
It would be useful to be able to use a polygon to temporarily mask other layers.
e.g. if you have a layer of boundaries for catchments (or provinces or something), to only display content within one particular catchment.
Current way of achieving the task:
I think the most flexible way to achieve this at the moment is:
1. create a set of new mask layers, by subtracting each catchment from a polygon bigger than the area of interest.
2. put these layers above everything else.
3. only turn on the mask layer which corresponds to the area of interest.
This method is fine for the work I do myself, because I work with only a small number of areas. But it would not be practical with a large number.
Proposed new feature
I think the best way to do it would be to add an option "trim other layers to extent" (there is probably a better way of wording this - some people might think "extent" implies a rectangular area or something).
This would allow the user to mask all map content outside a polygon layer or whatever subset of the layer is defined (by the query builder).
A logical place for the option would be on the "general" tab in the "layer properties" dialogue, as this is where the layer subset is shown.
N.B. sorry if I haven't picked the appropriate Component; I'm not sure which it should be.
#1 Updated by Alister Hood about 7 years ago
Current way of achieving the task: I think the most flexible way to achieve this at the moment is:...
But this obviously doesn't work if you have labelled layers - labels are shown above all layers, so you can still see the labels for hidden features. In this case I think the only solution is to create a set of layers cropped to each region, which would be very impractical if you had a lot of regions.
Also, when a feature is selected the hidden parts of it can still be seen (I guess this is desirable - at least when editing the feature).
See the screenshot.
#2 Updated by Alister Hood about 7 years ago
#3 Updated by Regis Haubourg over 5 years ago
Maybe "Mask" plugin in official repository gives the new feature. To solve the problem, I think refactoring labeling engine to be bale to choose if labels are on top or masked by some layers would be more efficient than sub selecting all datasets and then labeling..
Maybe the issue can be closed with the Mask plugin?
#4 Updated by Alister Hood over 5 years ago
- Assignee deleted (
- Pull Request or Patch supplied set to No
I'm aware of the mask plugin, but this certainly shouldn't be closed with it. It is just an automated version of what I described as the "Current way of achieving the task". So it is still a clumsy workaround, and it doesn't even work around the labelling issue.
I guess you are right that drawing a mask over the top would typically be more efficient than trimming each layer before labelling. However I think instead of refactoring the labelling engine to choose if labels are under some layers, it would be easier to add the ability to select a layer to be on top of everything (including labels and map decorations).
Mapinfo uses a slightly more sophisticated mask approach. Instead of creating a layer to be on top of everything, you choose an object and do "Set clip region", and it draws a mask based on that object. You don't need extra mask layers in your layer list and on your disk.
But there is a problem with using any true "mask" approach. If everything is drawn first with a mask drawn over the top, then some labels are placed crossing the edge of the "mask", and these labels are cut in half. This is the main problem I was referring to when I said the MapInfo implementation could do with improvements. I doubt that many people would want half a label shown on the edge of the map.
#11 Updated by Alister Hood about 5 years ago
For possible future reference, there is a discussion on the mailing list at the moment:
And as well as a mask that clips the map content, people sometimes just want to overlay the map with a grey mask, or a blur or something. See
#12 Updated by Regis Haubourg about 5 years ago
I tried to achieve a synthetic proposal here:
Please tell us if somebody disagrees or as suggestions. I would be glad to fund this.