<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Data expression to calculate area of two overlapping weblayers in a dashboard element in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1384554#M9094</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do something similar by intersecting two polygon layers to get the area of the resulting intersections.&lt;/P&gt;&lt;P&gt;So far I have:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var p = Portal('https://csparks.maps.arcgis.com')
var itemid = '617b93e023cc463d862f5e6836d9a8d1'
var layerid = 0
var fs1 = (FeatureSetByPortalItem(p, itemid, layerid, ['*'], true))
var itemid2 = '91196d5c9aaf4144be3a0be62de8d524'
var layerid2 = 0
var fs2 = (FeatureSetByPortalItem(p, itemid2, layerid2, ['*'], true))

var Dict = {
fields:[
   {name:"park", type: "esriFieldTypeString"},
   {name: "space", type: "esriFieldTypeDouble"},
  ],
  geometryType:"",
  features:[],
  }

var i = 0
for (var block in fs2){
  var intersect = Intersects(fs1, block)
  var cnt = Count(intersect)
  var riskArea = 0
  for (var r in intersect){
    riskArea += Area(Intersection(r, block), "hectares")
}
  var feat = {
            attributes: {
                park: block ['UNITNAME'],
                space: Round(riskArea, 2)
            }}
  Push(Dict.features, feat)
}
i++;
return FeatureSet (Text(Dict))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to successfully get the count of each intersect if I do:&lt;/P&gt;&lt;LI-CODE lang="c"&gt; var feat = {
            attributes: {
                park: block ['UNITNAME'],
                space: Text(cnt)
            }}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but then when I add lines 22, 23, and 24 I end up getting "&lt;SPAN&gt;Test execution error: Unknown Error. Verify test data."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 20 Feb 2024 19:37:24 GMT</pubDate>
    <dc:creator>KristaSchultze123</dc:creator>
    <dc:date>2024-02-20T19:37:24Z</dc:date>
    <item>
      <title>Data expression to calculate area of two overlapping weblayers in a dashboard element</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1238603#M7063</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; 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).&lt;/P&gt;&lt;P&gt;// Access data layers from portal&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var port = Portal( '&lt;A href="http://www.argis.com" target="_blank" rel="noopener"&gt;http://www.argis.com&lt;/A&gt;')&lt;BR /&gt;var TA = FeatureSetByPortalItem(Port, 'itemid', 0)&lt;BR /&gt;var sugar = FeatureSetByPortalItem(Port,'itemid', 0)&lt;/P&gt;&lt;P&gt;//Create empty dictionary&amp;nbsp;&amp;nbsp;&lt;BR /&gt;var sugarDict = {&lt;BR /&gt;Fields:[&lt;BR /&gt;{name: “TA Name”, type:esriFieldString”},&lt;BR /&gt;{name: “TA Ha”, type:esriFieldDouble”},&lt;BR /&gt;{name: “TA Sugar”, type:esriFieldDouble”},&lt;BR /&gt;],&lt;BR /&gt;Geometry type: '',&lt;BR /&gt;Features: [],&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// calculate area of sugarcane in Treatment area - below works fine in pop up&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var intlayer = Intersects(TA, sugar);&lt;BR /&gt;var intcount = Count(intlayer);&lt;BR /&gt;var sugarinTA = 0;&lt;BR /&gt;if(intcount &amp;gt; 0){&lt;BR /&gt;for(var sugararea in intlayer){&lt;BR /&gt;sugarinTA += Area(Intersection(TA, sugararea),"hectares")&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// Loop through and store attributes in dictionary - not sure how to do this&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;for (var t in TA){&lt;BR /&gt;var feat = {&lt;BR /&gt;attributes: {&lt;BR /&gt;TA Name: t["name"],&lt;BR /&gt;TA Ha: t["Area_ha"],&lt;BR /&gt;for (var s in sugarinTA){&lt;BR /&gt;var feat = {&lt;BR /&gt;attributes: {&lt;BR /&gt;TA Sugar: s["sugarinTA"],&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;} Push(features,feat);&lt;/P&gt;&lt;P&gt;Thank you so much for your help&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 04:22:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1238603#M7063</guid>
      <dc:creator>JasmineSpring</dc:creator>
      <dc:date>2022-12-07T04:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: Data expression to calculate area of two overlapping weblayers in a dashboard element</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1238659#M7065</link>
      <description>&lt;LI-CODE lang="javascript"&gt;// Access data layers from portal
var port = Portal( 'http://www.argis.com')
var fsTa = FeatureSetByPortalItem(port, 'itemid', 0)
var fsSugar = FeatureSetByPortalItem(port,'itemid', 0)

//Create empty dictionary  
var sugarDict = {
    fields:[
        {name: "TA_Name", type: "esriFieldTypeString"},
        {name: "TA_Ha", type: "esriFieldTypeDouble"},
        {name: "TA_Sugar", type: "esriFieldTypeDouble"},
    ],
    geometryType: "",
    features: [],
}

// loop over the treatment area features
for(var ta in fsTa) {
    // get the intersecting sugar areas
    var intSugar = Intersects(fsSugar, ta)
    // loop over those features and get the sum of the intersections
    var sugarArea = 0
    for(var s in intSugar) {
        sugarArea += Area(Intersection(s, ta), "hectares")
    }
    // append to the output dict
    var f = {attributes: {TA_Name: ta.Name, TA_Ha: Area(ta, "hectares"), TA_Sugar: sugarArea}}
    Push(sugarDict.features, f)
}

// convert to Featureset and return
return Featureset(Text(sugarDict))&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 07 Dec 2022 10:23:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1238659#M7065</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-12-07T10:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Data expression to calculate area of two overlapping weblayers in a dashboard element</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1239015#M7073</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Legendary ! That worked perfectly.&lt;/P&gt;&lt;P&gt;I have added another layer area intersect, it appears as a field but it isn't calculating the intersect area. I have added it below.&lt;/P&gt;&lt;P&gt;I would also like to group the phases, they are 1,2,3,4,5. and I would like to group them into two categories (5) and (1,2,3,4)&lt;/P&gt;&lt;P&gt;Thank you so much for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var port = Portal( '&lt;A href="https://qgsp.maps.arcgis.com/" target="_blank"&gt;https://qgsp.maps.arcgis.com/&lt;/A&gt;')&lt;BR /&gt;var fsTa = FeatureSetByPortalItem(port, 'item', 0)&lt;BR /&gt;var fsWHA = FeatureSetByPortalItem(port,'item', 0)&lt;BR /&gt;var fsSugar = FeatureSetByPortalItem(port,'item', 0)&lt;/P&gt;&lt;P&gt;//Create empty dictionary&lt;BR /&gt;var CombinedDict = {&lt;BR /&gt;fields:[&lt;BR /&gt;{name: "TA_Status", type: "esriFieldTypeString"},&lt;BR /&gt;{name: "TA_Ha", type: "esriFieldTypeDouble"},&lt;BR /&gt;{name: "TA_WHA", type: "esriFieldTypeDouble"},&lt;BR /&gt;{name: "TA_Sugar", type: "esriFieldTypeDouble"},&lt;BR /&gt;],&lt;BR /&gt;geometryType: "",&lt;BR /&gt;features: [],&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// loop over the treatment area features&lt;BR /&gt;for(var t in fsTa) {&lt;BR /&gt;// get the intersecting sugar areas&lt;BR /&gt;var intWHA = Intersects(fsWHA, t)&lt;BR /&gt;// loop over those features and get the sum of the intersections&lt;BR /&gt;var WHAArea = 0&lt;BR /&gt;for(var w in intWHA) {&lt;BR /&gt;WHAArea += AreaGeodetic(Intersection(w, t), "hectares")&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// loop over the treatment area features&lt;BR /&gt;for(var ta in fsTa) {&lt;BR /&gt;// get the intersecting sugar areas&lt;BR /&gt;var intSugar = Intersects(fsSugar, ta)&lt;BR /&gt;// loop over those features and get the sum of the intersections&lt;BR /&gt;var sugarArea = 0&lt;BR /&gt;for(var s in intSugar) {&lt;BR /&gt;sugarArea += Area(Intersection(s, ta), "hectares")&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// append to the output dict&lt;BR /&gt;var f = {attributes: {TA_Status:ta.Phase, TA_Ha: AreaGeodetic(ta, "hectares"), TA_WHA: WHAArea,TA_Sugar: sugarArea}}&lt;BR /&gt;Push(CombinedDict.features, f)&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// convert to Featureset and return&lt;BR /&gt;return Featureset(Text(CombinedDict))}&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 05:04:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1239015#M7073</guid>
      <dc:creator>JasmineSpring</dc:creator>
      <dc:date>2022-12-08T05:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: Data expression to calculate area of two overlapping weblayers in a dashboard element</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1239025#M7074</link>
      <description>&lt;P&gt;To format code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_0-1670479234964.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/57931iC4A8DFB3D23FEEF8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_0-1670479234964.png" alt="JohannesLindner_0-1670479234964.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JohannesLindner_1-1670479257402.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/57932i7C67C8D2AB333D02/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JohannesLindner_1-1670479257402.png" alt="JohannesLindner_1-1670479257402.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;I have added another layer area intersect, it appears as a field but it isn't calculating the intersect area&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;That's because you put the intersection with the WHA features into a separate loop. They get calculated and then overwritten without being stored in the output dict.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;I would also like to group the phases&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Fortunately, that is quite simple in this case. I used When() to get a default value if the phase is in neither of those groups (eg when it's null).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// blablabla

// loop over the treatment area features
for(var ta in fsTa) {
    // get the intersecting sugar area
    var intSugar = Intersects(fsSugar, ta)
    var sugarArea = 0
    for(var s in intSugar) {
        sugarArea += AreaGeodetic(Intersection(s, ta), "hectares")
    }
    // get the intersecting WHA area
    var intWHA = Intersects(fsWHA, ta)
    var WHAArea = 0
    for(var w in intWHA) {
        WHAArea += AreaGeodetic(Intersection(w, ta), "hectares")
    }
    // calculate the status value
    var status = When(Includes([1, 2, 3, 4], ta.Phase), "Status 1", ta.Phase == 5, "Status 2", "Default")
    // append to the output dict
    var f = {attributes: {TA_Status: status, TA_Ha: AreaGeodetic(ta, "hectares"), TA_Sugar: sugarArea, TA_WHA: WHAArea}}
    Push(combinedDict.features, f)
}

// convert to Featureset and return
return Featureset(Text(combinedDict))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 06:18:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1239025#M7074</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-12-08T06:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Data expression to calculate area of two overlapping weblayers in a dashboard element</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1240023#M7083</link>
      <description>&lt;P&gt;Thank you very much &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Your help is greatly appreciated!&amp;nbsp; thanks for showing me how to add code also.&lt;/P&gt;&lt;P&gt;I couldnt see a dissolve function or option in the buffer function. Is it possible to buffer and dissolve overlapping buffers? I would like to Group a weblayer by Rounds, buffer each round and calculate the area in my dashboard element.&lt;/P&gt;&lt;P&gt;Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 02:07:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1240023#M7083</guid>
      <dc:creator>JasmineSpring</dc:creator>
      <dc:date>2022-12-12T02:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Data expression to calculate area of two overlapping weblayers in a dashboard element</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1240054#M7084</link>
      <description>&lt;P&gt;There is &lt;A href="https://developers.arcgis.com/arcade/function-reference/geometry_functions/#union" target="_blank" rel="noopener"&gt;Union()&lt;/A&gt;. With that, you can union/dissolve multiple geometries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 07:27:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1240054#M7084</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-12-12T07:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: Data expression to calculate area of two overlapping weblayers in a dashboard element</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1240468#M7095</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Ok Im trying to give it a go.&amp;nbsp; Would you use a group by to separate the web layer by rounds? (there is a round field) then loop through with a buffer then a union then area? The final&amp;nbsp;&lt;SPAN&gt;featureset would just have area in hectares for each round&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;// Access data layers from portal
var port = Portal( 'https://arcgis.com/')
var fsTreatment = FeatureSetByPortalItem(port, 'itemID', 0)

//Create empty dictionary  
var TreatmentDict = {
    fields:[
        {name: "Round_Treat", type: "esriFieldTypeString"},
        {name: "Area_Treat", type: "esriFieldTypeDouble"},
            ],
    geometryType: "",
    features: [],
}

// Group feature set by round  

Var treatmentround = GroupBy(fstreatment,'Round_Num',COUNT)

//Loop through Rounds - would grouping it like above allow me to loop through the rounds and buffer and union them??

// buffer group 5m
var treatbuff = BufferGeodetic(treatmentround, 5,'meters')

// union to dissolve
var treatunion = Union(treatbuff)

// calculate area treated
var AreaTreated = AreaGeodetic(treatunion, "hectares")

// append to the output dict
var f = {attributes: {Round_Treat: .Round_num , Area_Treat: AreaTreated }}
Push(TreatmentDict.features, f)
}

// convert to Featureset and return
return Featureset(Text(TreatmentDict))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 04:58:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1240468#M7095</guid>
      <dc:creator>JasmineSpring</dc:creator>
      <dc:date>2022-12-13T04:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Data expression to calculate area of two overlapping weblayers in a dashboard element</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1240491#M7096</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;Loop through Rounds - would grouping it like above allow me to loop through the rounds and buffer and union them??&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;No, it's a little more complicated. Buffer(), Union(), and Area() don't work on Featuresets, only on singular Features/Geometries (or arrays in case of Union), so you need two loops:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;outer loop over the rounds&lt;/LI&gt;&lt;LI&gt;inner loop over the features of a round&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Something like this should work:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// we don't need GroupBy, we just need the distinct values of the group field
var treatmentRounds = Distinct(fsTreatment, "Round_Num")

// outer loop over the rounds
for(var treatRound in treatmentRounds) {
    // filter the Featureset
    var roundNum = treatRound.Round_Num
    var query = "Round_Num " + Iif(roundNum == null, "IS NULL", "= @roundNum")
    var filtered = Filter(fsTreatment, query)
    // inner loop over the filtered features
    var buffer_geometries = []
    for(var f in filtered) {
        // buffer the geometry and append it to the array
        Push(buffer_geometries, Buffer(f, 5, "meters"))
    }
    // union all those buffers into one geometry
    var union_geometry = Union(buffer_geometries)
    // create the new output feature
    var f = {attributes: {Round_Treat: roundNum, Area_Treat: AreaGeodetic(union_geometry, "hectares")}}
    Push(TreatmentDict.features, f)
}
return Featureset(Text(TreatmentDict))&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 13 Dec 2022 08:13:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1240491#M7096</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-12-13T08:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Data expression to calculate area of two overlapping weblayers in a dashboard element</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1384554#M9094</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/294341"&gt;@JohannesLindner&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do something similar by intersecting two polygon layers to get the area of the resulting intersections.&lt;/P&gt;&lt;P&gt;So far I have:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var p = Portal('https://csparks.maps.arcgis.com')
var itemid = '617b93e023cc463d862f5e6836d9a8d1'
var layerid = 0
var fs1 = (FeatureSetByPortalItem(p, itemid, layerid, ['*'], true))
var itemid2 = '91196d5c9aaf4144be3a0be62de8d524'
var layerid2 = 0
var fs2 = (FeatureSetByPortalItem(p, itemid2, layerid2, ['*'], true))

var Dict = {
fields:[
   {name:"park", type: "esriFieldTypeString"},
   {name: "space", type: "esriFieldTypeDouble"},
  ],
  geometryType:"",
  features:[],
  }

var i = 0
for (var block in fs2){
  var intersect = Intersects(fs1, block)
  var cnt = Count(intersect)
  var riskArea = 0
  for (var r in intersect){
    riskArea += Area(Intersection(r, block), "hectares")
}
  var feat = {
            attributes: {
                park: block ['UNITNAME'],
                space: Round(riskArea, 2)
            }}
  Push(Dict.features, feat)
}
i++;
return FeatureSet (Text(Dict))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to successfully get the count of each intersect if I do:&lt;/P&gt;&lt;LI-CODE lang="c"&gt; var feat = {
            attributes: {
                park: block ['UNITNAME'],
                space: Text(cnt)
            }}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but then when I add lines 22, 23, and 24 I end up getting "&lt;SPAN&gt;Test execution error: Unknown Error. Verify test data."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 19:37:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/data-expression-to-calculate-area-of-two/m-p/1384554#M9094</guid>
      <dc:creator>KristaSchultze123</dc:creator>
      <dc:date>2024-02-20T19:37:24Z</dc:date>
    </item>
  </channel>
</rss>

