1

I have a polygon shapefile of the counties in the UK and a separate point shapefile of project sites.

Within the project sites attribute table I would like to add a new virtual column with the name of the county that the point sits in determined by the polygon it is in. I have tried

aggregate( 'County and Unitary Authority',  'concatenate', 
"county",  within( $geometry,  geometry(@parent) ))

but I know this is wrong. Which aggregate do I use instead of concatenate and is within the right filter to use?

I need a method like this with NO use of plugins or making new layers.

Also, does @parent literally mean @parent or does parent mean the name of the parent layer i.e. @County and Unitary Authority?

2
  • 1
    You need to switch within (a,b) to within(geometry(@parent), $geometry) or use contains ($geometry, geometry(@parent)). This should help you to understand @parent. Someone just helped me with a similar question here: gis.stackexchange.com/questions/342386/… Commented Nov 20, 2019 at 16:44
  • 1
    Thank you, this worked!! Commented Nov 25, 2019 at 9:33

1 Answer 1

0

aggregate('County and Unitary Authority', 'concatenate', "county", within(geometry(@parent), $geometry))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.