Skip to main content
Added language tag
Source Link
Hornbydd
  • 43.9k
  • 5
  • 41
  • 82

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.

enter image description here

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.

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
}

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.

enter image description here

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.

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
}

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.

enter image description here

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.

edit for clarity
Source Link
Aquamarine
  • 1.3k
  • 6
  • 12

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
}

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.

enter image description here

There may be a more efficient way of writing the arcade code but this works.

You can then doUse a simple select by attributeselect by attribute to select the features withwhere is_max = 1.

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
}

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.

enter image description here

There may be a more efficient way of writing the arcade code but this works.

You can then do a simple select by attribute to select the features with is_max = 1.

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
}

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.

enter image description here

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.

fixed typo
Source Link
Aquamarine
  • 1.3k
  • 6
  • 12

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 = firstFirst(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 ieldfield "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.

enter image description here

There may be a more efficient way of writing the arcade code but this works.

You can then do a simple select by attribute to select the features with is_max = 1.

Another way to do it is to use the Calculate Field function with an arcade expression to set a field to indicate whether the feature should be selected or not e.g. a field called is_max:

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 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 ield "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.

enter image description here

There may be a more efficient way of writing the arcade code but this works.

You can then do a simple select by attribute to select the features with is_max = 1.

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
}

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.

enter image description here

There may be a more efficient way of writing the arcade code but this works.

You can then do a simple select by attribute to select the features with is_max = 1.

Source Link
Aquamarine
  • 1.3k
  • 6
  • 12
Loading