1

I try to connect one feature from a polygon layer to many in a point layer, using geometry generator and expression calculator in the polygon layer.
If I can connect 1 polygon to all the points,

shortest_line(geometry(get_feature('mylayer', 'myattribute', 'myvalue')), 
geometry($currentfeature))

I can't connect one polygon to a set of points i.e. I can't select some points with a specific value in a field.

shortest_line(geometry(get_feature('mylayer', 'myattribute', 'myvalue')), 
geometry(*only_the_polygons_with_a_specific_attribute_value*))

I tried get_featureand attribute but I failed.
Is there a way to do that ?

Vince
  • 20,017
  • 15
  • 45
  • 64
Leehan
  • 1,236
  • 2
  • 10
  • 20
  • If it's the layer you're working on look into collect() and filter by your specific attribute value; if it's another layer you can do something similar within the aggregate() function – she_weeds Jul 01 '20 at 10:30
  • See this answer here, seems to be a similar approach and could help you achieving what you want, adapting the expression to your needs: https://gis.stackexchange.com/a/381819/88814 – Babel Dec 13 '20 at 13:50

0 Answers0