Feature request #3253
Enhancement: option to "trim other layers to match"
Status: | Open | ||
---|---|---|---|
Priority: | Low | ||
Assignee: | - | ||
Category: | Symbology | ||
Pull Request or Patch supplied: | No | Resolution: | |
Easy fix?: | No | Copied to github as #: | 13313 |
Description
Task:
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.
History
#1 Updated by Alister Hood almost 14 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 almost 14 years ago
#3 Updated by Regis Haubourg about 12 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 about 12 years ago
- Assignee deleted (
nobody -) - 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.
#5 Updated by Aren Cambre about 12 years ago
So don't mask the labels, and simply regenerate them for items within the mask as a post processing step?
#6 Updated by Alister Hood about 12 years ago
Could you clarify what you mean by that?
Thanks
#7 Updated by Aren Cambre about 12 years ago
I mean do this when you crop:
1. Remove labels.
2. Make the crop.
3. Re-draw the labels in the crop for objects inside the crop.
#8 Updated by Alister Hood about 12 years ago
But how would you draw only the labels inside the crop?
Would the mask just act as an obstacle to label placement? I guess that is probably very feasible with the PAL labelling.
#9 Updated by Aren Cambre about 12 years ago
If the crop is a polygon, seems like it should be easy to figure out which items are within the polygon. Only apply labels to items inside the polygon.
#10 Updated by Pirmin Kalberer almost 12 years ago
- Target version changed from Version 2.0.0 to Future Release - Nice to have
#11 Updated by Alister Hood almost 12 years ago
For possible future reference, there is a discussion on the mailing list at the moment:
http://lists.osgeo.org/pipermail/qgis-user/2012-December/020514.html
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
http://gis.stackexchange.com/questions/7073/qgis-how-to-create-an-area-of-interest-polygon-mask
#12 Updated by Regis Haubourg almost 12 years ago
I tried to achieve a synthetic proposal here:
[[http://osgeo-org.1560.n6.nabble.com/Let-s-discuss-on-a-Mask-feature-tp5021391.html]]
Please tell us if somebody disagrees or as suggestions. I would be glad to fund this.
Régis
#13 Updated by Giovanni Manghi over 7 years ago
- Easy fix? set to No