Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • try it this way, i already put the name of your variables so you don't need to replace any thing. I'm texting from my phone so sorry if there are still some errors with_variable( 'B', overlay_intersects( @Simplify_output, $geometry )[0], area(intersection($geometry, @B)) / area(union($geometry, @B)) ) Commented Sep 18, 2023 at 14:01
  • It worked! In the end, only the first instance should be 'B', and the rest is @B. Now, I was wondering: what is the function of the index [0]? Commented Sep 19, 2023 at 6:51
  • overlay_intersects returns an array of the features of the B layer that intersects the current feature that's being evaluated on the A layer. So in this case, where there's only one feature of the B layer that intersect one feature of the A layer, you only need to take the unique feature returned by the overlay, that will be the first element of that array, so [0] works fine here. Commented Sep 19, 2023 at 14:09