Hello
I am trying to add an indicator to my dashboard which shows the hectares of where two polygons weblayers intersect. ie the hectares of sugarcane in treatment areas. I am new to arcade so a little unsure whats the best way to go about it. The final feature set I would like to have the TA name, TA hectares, (from the TA weblayer) and the hectares in sugarcane (intersection calculation).
// Access data layers from portal
var port = Portal( 'http://www.argis.com')
var TA = FeatureSetByPortalItem(Port, 'itemid', 0)
var sugar = FeatureSetByPortalItem(Port,'itemid', 0)
//Create empty dictionary
var sugarDict = {
Fields:[
{name: “TA Name”, type:esriFieldString”},
{name: “TA Ha”, type:esriFieldDouble”},
{name: “TA Sugar”, type:esriFieldDouble”},
],
Geometry type: '',
Features: [],
};
// calculate area of sugarcane in Treatment area - below works fine in pop up
var intlayer = Intersects(TA, sugar);
var intcount = Count(intlayer);
var sugarinTA = 0;
if(intcount > 0){
for(var sugararea in intlayer){
sugarinTA += Area(Intersection(TA, sugararea),"hectares")
}
}
// Loop through and store attributes in dictionary - not sure how to do this
for (var t in TA){
var feat = {
attributes: {
TA Name: t["name"],
TA Ha: t["Area_ha"],
for (var s in sugarinTA){
var feat = {
attributes: {
TA Sugar: s["sugarinTA"],
}
}
} Push(features,feat);
Thank you so much for your help