[Qgis-user] Rule-based symbol for point within polygon in QGIS

Stefan Giese (WhereGroup) stefan.giese at wheregroup.com
Mon Aug 30 08:10:56 PDT 2021


Depends on your QGIS version, from 3.16 onwards you can use the 
overlay-functions to proof if the point and polygonlayer are in a 
spatial relation like intersects or touches and so on. The expression 
for your first rule will be like this one:

/"VAL_PROTECTION_EP3" = '1' AND  "TYPE"  = 1 AND overlay_intersects( 
layer:='pol', filter := ("TYPE" in ('P','E') AND "CAT_CANTON" = 2) OR 
("TYPE" in ('P','E') AND "CAT_CANTON" = 3))/

In the overlay_intersects-part you have to change the layername to your 
polygon layer.

If you have an older QGIS Version you can achieve the more or less same 
result with the refFunctions Plugin.

Hope this helps

Best regards

Stefan

-- 
Mit freundlichen Grüßen
Stefan Giese
Projektleiter/Consultant
------------------------------------------------------
Aufwind durch Wissen!
Jetzt neu: Webinare und Online-Schulungen
bei der www.foss-academy.com
------------------------------------------------------

WhereGroup GmbH
Schwimmbadstr. 2
79100 Freiburg
Germany

Fon: +49 (0)761 / 519 102 - 61
Fax: +49 (0)761 / 519 102 - 11

stefan.giese at wheregroup.com
www.wheregroup.com
Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885

Am 30.08.2021 um 16:36 schrieb Jeanneret Cédric:
>
> I would like to use a set of rules to draw features from a point_layer 
> that are within a polygon_layer.
>
> Points that answer true to
>
> ("VAL_PROTECTION_EP3" = '1' AND  "TYPE"  = 1)
>
> and that are within polygons that answer true to
>
> ("TYPE" in ('P','E') AND "CAT_CANTON" = 2) OR ("TYPE" in ('P','E') AND 
> "CAT_CANTON" = 3)
>
> should be displayed as red dots
>
> Points that answer true to
>
> ("VAL_PROTECTION_EP3" = '2' AND  "TYPE"  = 1)
>
> and that are within polygons that answer true to
>
> ("TYPE" in ('P','E') AND "CAT_CANTON" = 2) OR ("TYPE" in ('P','E') AND 
> "CAT_CANTON" = 3)
>
> should be displayed as orange dots
>
> Points that answer true to
>
> ("VAL_PROTECTION_EP3" = '3' AND  "TYPE"  = 1)
>
> and that are within polygons that answer true to
>
> ("TYPE" in ('P','E') AND "CAT_CANTON" = 1)
>
> should be displayed as yellow dots
>
> I cannot find the right combination of expressions for the rule to work.
>
> Any help would be appreciated: what would a working syntax be for such 
> a rule to work in QGIS Layer Styling panel ?
>
> Cédric Jeanneret
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210830/3aa83ba7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210830/3aa83ba7/attachment-0001.sig>


More information about the Qgis-user mailing list