Select to view content in your preferred language

Intersect polygon and return max value

675
1
Jump to solution
02-16-2023 06:48 AM
EddyClark
Occasional Contributor

Hard to believe I have to create a post for this, seems like something google should find.  If a field user draws a polygon that intersects multiple rows, from the same underlying feature, how do I return the maximum value from those rows?

Example screenshot below.  User draws red polygon.  Field calculation returns 9.

EddyClark_0-1676558893928.png

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

It's certainly the sort of thing that's been posted here before. Try something like this:

// get polygons layer
var poly = FeatureSetByName($map, 'your layer', ['numeric_field'])

// subset intersecting features
var xs_poly = Intersects($feature, poly)

// look for highest value
return Max(xs_poly, 'numeric_field')

 

- Josh Carlson
Kendall County GIS

View solution in original post

1 Reply
jcarlson
MVP Esteemed Contributor

It's certainly the sort of thing that's been posted here before. Try something like this:

// get polygons layer
var poly = FeatureSetByName($map, 'your layer', ['numeric_field'])

// subset intersecting features
var xs_poly = Intersects($feature, poly)

// look for highest value
return Max(xs_poly, 'numeric_field')

 

- Josh Carlson
Kendall County GIS