Hi, I'm using quite often the new and extremely useful ovelay-expressions introduced in QGIS 3.16. I'm wondering about how the filter-argument of overlay_nearest works. It seems that the filter works only on the layer that is referenced. I am not able to set a condition in a way to evaluate features from any other layer than the one defined in the first argument.
So my question is: Is this a missing feature? Is it a bug? Or do I miss something and it is possible? In this case: what is the syntax used for that? To make the idea a bit less abstract (see also here for details: https://gis.stackexchange.com/q/391120/88814): I have layer1 and layer2 and I apply an overlay_nearest expression on layer1 to get features of layer 2. That works fine. The expression returns for each feature of layer1 an array of features of layer2, ordered according to the distance from the feature on layer1. The optional filter argument allows it to limit the results based on a defined condition. As long as i use fields from layer2, this works fine. However, I want to set a filter condition that compares attributes from both layers, but I am not able to find a valid syntax. The following pseudo-code, used for geometry generator symbol layer on layer1, should return the geometry of all features on layer 2, but only where the condition is met that id1 (feature id of layer 1) is not equal to the feature id of layer 2 (id2): overlay_nearest ( 'layer2', $geometry, filter:= id 1 <> id2 ) It is clear that this code here can not work as QGIS looks in layer2 (defined in the first argument) for the two fieldnames. But even when explicitely refering to the layers, it does not work - e.g. using this expression here as filter condition: attribute ( get_feature_by_id ( 'layer1', $id ), 'id1' ) <> attribute ( get_feature_by_id ( 'layer2', $id ), 'id2' ) So any idea if this is directly possible using the filter argument of overlay_nearest? Daniel -- Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html _______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user