I would like to build an expression to return the largest value of a field within a source layer where it is contained within a polygon of the open layer. I want this expression to write the result to a field within that layer.
For example, I have a layer of cities with 'population' as a field, I also have a layer of counties with the field 'Population of largest city'. What I want to do is build an expression to fill the 'population of largest city' field. It need to select those cities that are within the county and then return the value of the largest.
All the expressions seem to be there in principle geomcontains() to get the features and max() to return the maximum value, but geomcontains() only returns the first value so the max() function won't work.
Can anyone think of a way round this?
Thanks
أكثر...
For example, I have a layer of cities with 'population' as a field, I also have a layer of counties with the field 'Population of largest city'. What I want to do is build an expression to fill the 'population of largest city' field. It need to select those cities that are within the county and then return the value of the largest.
All the expressions seem to be there in principle geomcontains() to get the features and max() to return the maximum value, but geomcontains() only returns the first value so the max() function won't work.
Can anyone think of a way round this?
Thanks
أكثر...