Using featureSet to find the area of one polygon within another

695
3
Jump to solution
02-11-2019 12:39 AM
DavidFotheringham1
Occasional Contributor

I've been using the fantastic new featureSet function in Arcade expressions but can't quite work out how, if it is possible, to determine the area of one polygon dataset in another.

As an example, I have vegetation polygons and I wish to determine how much vegetation is within various boundary polygons using Arcade and custom pop-ups.

Any suggestions? Many thanks!

Tags (2)
1 Solution

Accepted Solutions
KristianEkenes
Esri Regular Contributor

In a future release we'll add support for calculating area for a feature set of features. In the meantime you can do the following:

var allVegetation = FeatureSetByName( ... );
var vegInBoundary = Intersects( allVegetation, $feature);

var totalArea = 0;
for (var veg in vegInBoundary){
   totalArea += AreaGeodetic(veg, "square-meters");
}
return totalArea;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This workflow is basically covered in this blog post - ArcGIS blog - Create powerful popups in web apps with Arcade feature sets in web apps 

View solution in original post

3 Replies
KristianEkenes
Esri Regular Contributor

In a future release we'll add support for calculating area for a feature set of features. In the meantime you can do the following:

var allVegetation = FeatureSetByName( ... );
var vegInBoundary = Intersects( allVegetation, $feature);

var totalArea = 0;
for (var veg in vegInBoundary){
   totalArea += AreaGeodetic(veg, "square-meters");
}
return totalArea;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This workflow is basically covered in this blog post - ArcGIS blog - Create powerful popups in web apps with Arcade feature sets in web apps 

KristianEkenes
Esri Regular Contributor

Sorry, I think I messed up the expression, I edited it now to what I think you're looking for.

DavidFotheringham1
Occasional Contributor

This is perfect and works so well! This opens a lot of doors!

0 Kudos