Hello, I am trying to determine the correct rule code for determining the amount of acreage within another polygon.
For Example: I have a feature named Tracts that may or may not contain floodplain acreage (Feature name Floodplain).
Could someone help me out? ..... This is what I have now.... but it is not pulling the correct acreage, and I think the correct function would be INTERSECTION, but not sure.
Thanks again
VAR FLOODPLAIN = FeatureSetByName($datastore, "RES_FLOOD_HAZARD")
VAR INTERSECTSFLOOD = INTERSECTS($FEATURE,FLOODPLAIN)
area(intersectsflood, 'acres')
Solved! Go to Solution.
You guess correctly, you'll need Intersection to get the geometry of the overlapping area. However, this function requires two geometries as parameters, and you're working with a FeatureSet.
var floodplain = FeatureSetByName($datastore, "RES_FLOOD_HAZARD")
// Grab the first item for the intersects featureset
var flood_feat = First(Intersects($FEATURE, floodplain))
// Get intersection, calculate area
var xs = Intersection(flood_feat, $feature)
// Calculate acreage
return Area(xs) // multiply by some value, depending on the area units in use
However, a single tract may intersect with multiple flood zones, and we may want to capture this information.
var floodplain = FeatureSetByName($datastore, "RES_FLOOD_HAZARD")
// Get FeatureSet of intersecting flood zones
var flood_fs = Intersects($FEATURE, floodplain))
// Instantiate output string
var out_str = 'Flood Zone Acreage:'
// Iterate over FeatureSet
for(var f in flood_fs){
// Get intersection, calculate area
var xs = Intersection(f, $feature)
// Calculate acreage
var a = Area(xs) // multiply by some value, depending on the area units in use
// Append to output string
out_str += `\n${f.flood_zone_identifier_field} | ${a} ac`
}
return out_str
This will return something like
Flood Zone Acreage:
Zone AE | 12.1 ac
Zone X | 6.23 ac
Oh, sure! Instead of an output string, you could just use a numeric value. Make these changes to the "complex" expression and see how it works.
Line 7 → var out_area = 0
...
Line 18 → out_area += a
...
Line 21 → return out_area
So instead of creating a cumulative string, you're adding up cumulative sum.
You guess correctly, you'll need Intersection to get the geometry of the overlapping area. However, this function requires two geometries as parameters, and you're working with a FeatureSet.
var floodplain = FeatureSetByName($datastore, "RES_FLOOD_HAZARD")
// Grab the first item for the intersects featureset
var flood_feat = First(Intersects($FEATURE, floodplain))
// Get intersection, calculate area
var xs = Intersection(flood_feat, $feature)
// Calculate acreage
return Area(xs) // multiply by some value, depending on the area units in use
However, a single tract may intersect with multiple flood zones, and we may want to capture this information.
var floodplain = FeatureSetByName($datastore, "RES_FLOOD_HAZARD")
// Get FeatureSet of intersecting flood zones
var flood_fs = Intersects($FEATURE, floodplain))
// Instantiate output string
var out_str = 'Flood Zone Acreage:'
// Iterate over FeatureSet
for(var f in flood_fs){
// Get intersection, calculate area
var xs = Intersection(f, $feature)
// Calculate acreage
var a = Area(xs) // multiply by some value, depending on the area units in use
// Append to output string
out_str += `\n${f.flood_zone_identifier_field} | ${a} ac`
}
return out_str
This will return something like
Flood Zone Acreage:
Zone AE | 12.1 ac
Zone X | 6.23 ac
Thanks again for the help. For some reason the expression states it is valid, but will not save? I have tried everything from saving closing out, restarting ?
Thanks @jcarlson. Any way I could just sum all the zones within that feature to return a value of the total flood acreage?
Oh, sure! Instead of an output string, you could just use a numeric value. Make these changes to the "complex" expression and see how it works.
Line 7 → var out_area = 0
...
Line 18 → out_area += a
...
Line 21 → return out_area
So instead of creating a cumulative string, you're adding up cumulative sum.
This is very helpful. Thanks again!
Thanks I figured it out, any way I could just sum all the zones within that feature?