Clip layers in a map with transparency

657
7
10-12-2022 09:07 AM
arthurV
New Contributor III

Hi, I would like to create a mask around some part of my map. This would help to highlight a specific portion of the map.

I know there is the clip layers option. It's usefull, but I would like to keep, with transparency, what is set outside my clip extend.

Result expected is what you can see here in Qgis.

ImpulsMap-Tutoriels-EffectuerPochoirMasqueQgis22-PochoirRemplissageSimpleResultat

Tags (1)
0 Kudos
7 Replies
BarryNorthey
Occasional Contributor III

You could try the Feature Outline Masks (Cartography) tool but it requires an Advanced license. I selected the Alberta province and then switched selections and built the masks on those features. I got this effect which might be what you are looking for.

BarryNorthey_2-1665597728466.png

 

 

 

0 Kudos
arthurV
New Contributor III

Unfortunatly my organization do not have this licence.

0 Kudos
Jennifer_Parmeley
New Contributor III

I often use definition queries to do this. 

0 Kudos
arthurV
New Contributor III

Could you explain a bit more?

0 Kudos
BarryNorthey
Occasional Contributor III

A Definition Query filters the features (and their attributes) that you do or don't want to display in a layer without deleting features. All the features return when the query is switched off. One way to do this is to sketch a  single polygon around the area of interest and call it Mask. Then Union Mask with the French provinces layer. Run GP Tool Multipart to Single Part on the Unioned layer.You can now draw or nor draw whatever province polygons you want using a Definition Query.

The Definition Query below can be built using the query wizard and a bunch of ORs or in my example, using SQL's NOT IN command. In my example the target field is called name followed by NOT IN then a list of the names of the provinces from the name field that you don't want to display enclosed in parentheses. Feature names in the list are enclosed by single quotes but the apostrophe is interpreted as a single quote causing problems so there must be two as shown for SQL to understand it: BarryNorthey_1-1665796152368.png

BarryNorthey_1-1665803490892.png

 

name NOT IN ('Yvelines', 'Paris', 'Essonne', 'Hauts-de-Seine', 'Seine-Saint-Denis', 'Val-d''Oise', 'Val-de-Marne', 'Seien-et-Marne')

You can then adjust the layer transparency. Hope this works.

0 Kudos
IlkaIllers1
Occasional Contributor III

Hello,

this is a bit of a workaround, and not sure if you still need it, but:

1. Make a copy of all your data and set the transparency to what you want it to be. I find it easiest to group all of this under the name transparency

2. Make a copy of the layer that has the part you want to highlight and set a definition query so it only includes the area you want to highlight

3. Set the map properties to clip by outline, and then exclude your transparent layers from the clip

0 Kudos
IlkaIllers1
Occasional Contributor III

Or, alternatively:

1. Create a polygon conveing the entire map area

2. Set the symbology to white and transparency ~50 %

3. Make a copy of the layer that has the part you want to highlight and set a definition query so it only includes the area you want to highlight

4. Set a mask on the white polygon layer with a layer only containing the feature 

0 Kudos