Another way to do it is to use the Calculate Field function on the point layer with an arcade expression to set a field in the point layer to indicate whether the feature should be selected or not e.g. a field called is_max:
//get polygon features in layer "polys1"
var polygons = FeaturesetByName($datastore,"polys1")
//if the current point feature doesn’t intersect a polygon return null
if (First(Intersects(polygons, $feature)) == null)
{ return null }
else
//if the current point feature intersects a polygon
{
//get the polygon this point intersects
var intersectPoly = First(intersects(polygons,$feature))
//get all points that intersect this polygon
var intersectPoints = intersects(FeaturesetByName($datastore,"points1"),intersectPoly)
//get the max value in field value1 in the filtered feature set.
var maxValue = Max(intersectPoints,"value1");
//if the current feature field "value1" is the same as maxValue then set to true else false
if ($feature.value1 == maxValue)
return 1
else
return 0
}
//get polygon features in layer "polys1"
var polygons = FeaturesetByName($datastore,"polys1")
//if the current point feature doesn’t intersect a polygon return null
if (First(Intersects(polygons, $feature)) == null)
{ return null }
else
//if the current point feature intersects a polygon
{
//get the polygon this point intersects
var intersectPoly = First(intersects(polygons,$feature))
//get all points that intersect this polygon
var intersectPoints = intersects(FeaturesetByName($datastore,"points1"),intersectPoly)
//get the max value in field value1 in the filtered feature set.
var maxValue = Max(intersectPoints,"value1");
//if the current feature field "value1" is the same as maxValue then set to true else false
if ($feature.value1 == maxValue)
return 1
else
return 0
}
You can then use the value in field is_max to select those point features that have the highest value in the polygon in which they are located.
There may be a more efficient way of writing the arcade code but this works.
Use a simple select by attribute to select the features where is_max = 1.