<?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 How to Calculate the sum area of a polygon featurelayer by QueryStatisticsAsync ? in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-calculate-the-sum-area-of-a-polygon/m-p/1595071#M13380</link>
    <description>&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Instead of looping through features, I need a way to calculate the sum area of a polygon featurelayer efficiently.&amp;nbsp;&lt;/SPAN&gt;How to use QueryStatisticsAsync to calculate the total area of all graphics in a FeatureLayer?&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Mar 2025 09:06:05 GMT</pubDate>
    <dc:creator>happygis</dc:creator>
    <dc:date>2025-03-13T09:06:05Z</dc:date>
    <item>
      <title>How to Calculate the sum area of a polygon featurelayer by QueryStatisticsAsync ?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-calculate-the-sum-area-of-a-polygon/m-p/1595071#M13380</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Instead of looping through features, I need a way to calculate the sum area of a polygon featurelayer efficiently.&amp;nbsp;&lt;/SPAN&gt;How to use QueryStatisticsAsync to calculate the total area of all graphics in a FeatureLayer?&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2025 09:06:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-calculate-the-sum-area-of-a-polygon/m-p/1595071#M13380</guid>
      <dc:creator>happygis</dc:creator>
      <dc:date>2025-03-13T09:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Calculate the sum area of a polygon featurelayer by QueryStatisticsAsync ?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-calculate-the-sum-area-of-a-polygon/m-p/1595473#M13385</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;Thank you for the question!&lt;/P&gt;&lt;P&gt;To efficiently calculate the total area of all polygons in a &lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;FeatureLayer&lt;/FONT&gt;&lt;/STRONG&gt; without looping through individual features, you can use the &lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;QueryStatisticsAsync&lt;/STRONG&gt;&lt;/FONT&gt; method. This approach is much faster and cleaner, especially for large datasets.&lt;/P&gt;&lt;P&gt;Here's how you can achieve this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Define statistic definition for summing polygon areas
var areaStatisticDefinition = new StatisticDefinition("Shape_Area", StatisticType.Sum, "TotalArea");

// Set up statistics query parameters
var queryParameters = new StatisticsQueryParameters(new List&amp;lt;StatisticDefinition&amp;gt; { areaStatisticDefinition });

// Execute statistics query asynchronously on your FeatureLayer
var statisticsResult = await yourFeatureLayer
                                 .FeatureTable
                                 .QueryStatisticsAsync(queryParameters);

// Retrieve total area result
double totalArea = 0;
if (statisticsResult.Any())
{
    totalArea = Convert.ToDouble(statisticsResult.First().Statistics["TotalArea"]);
}

// Output or use the totalArea as needed
Console.WriteLine($"Total Area: {totalArea}");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Let me know if you have any questions or run into issues while implementing this!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2025 00:25:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-calculate-the-sum-area-of-a-polygon/m-p/1595473#M13385</guid>
      <dc:creator>pnarkhede</dc:creator>
      <dc:date>2025-03-14T00:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to Calculate the sum area of a polygon featurelayer by QueryStatisticsAsync ?</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/how-to-calculate-the-sum-area-of-a-polygon/m-p/1607485#M13488</link>
      <description>&lt;P&gt;is "Shape_Area" a preserve fieldName? there is no Shape_Area in my table.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Apr 2025 13:13:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/how-to-calculate-the-sum-area-of-a-polygon/m-p/1607485#M13488</guid>
      <dc:creator>happygis</dc:creator>
      <dc:date>2025-04-19T13:13:42Z</dc:date>
    </item>
  </channel>
</rss>

