<?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: Averaging raster cells that fall within a polygon in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/averaging-raster-cells-that-fall-within-a-polygon/m-p/684025#M18403</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think there are more efficient ways to do this. This is what i will use:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1 find the extent of a given polygon&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2 align this extent to cell side center by comparing with raster extent&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3 generate points within this aligned extent based on cell size, these points will be the centers of cells&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4 loop the generated cells to read pixel values and average them&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hailiang&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Apr 2014 17:42:24 GMT</pubDate>
    <dc:creator>HailiangShen</dc:creator>
    <dc:date>2014-04-29T17:42:24Z</dc:date>
    <item>
      <title>Averaging raster cells that fall within a polygon</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/averaging-raster-cells-that-fall-within-a-polygon/m-p/684024#M18402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am about to begin developing a function that has a polygon featureclass and a raster as inputs. The purpose of the function is to calculate the average of the raster cell values that fall within each polygon. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;polygon feature class contains 3 polygons&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Polygon 1 overlaps/contains 3 cells with values 1,2,3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polygon 2 overlaps/contains 5 cells with values 1,3,5,7,9&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polygon 3 overlaps/contains 3 cells with values 7,8,9&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The output would be &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polygon 1 average = 2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polygon 2 average = 5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Polygon 3 average = 8&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only way that I know to do this is to loop through each cell of the raster, create a spatial query using the center point of the raster cell as the geometry, querying the polygon featureclass to get the polygon that contains the point, and finally having some data structure that holds the values for each polygon in order to compute the averages after the loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;These seems like a very inefficient way of implementing this functionality. Does anyone have any suggestions on a better way to implement this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2014 15:59:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/averaging-raster-cells-that-fall-within-a-polygon/m-p/684024#M18402</guid>
      <dc:creator>KeithWeber1</dc:creator>
      <dc:date>2014-04-29T15:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Averaging raster cells that fall within a polygon</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/averaging-raster-cells-that-fall-within-a-polygon/m-p/684025#M18403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think there are more efficient ways to do this. This is what i will use:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1 find the extent of a given polygon&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2 align this extent to cell side center by comparing with raster extent&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3 generate points within this aligned extent based on cell size, these points will be the centers of cells&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4 loop the generated cells to read pixel values and average them&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hailiang&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Apr 2014 17:42:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/averaging-raster-cells-that-fall-within-a-polygon/m-p/684025#M18403</guid>
      <dc:creator>HailiangShen</dc:creator>
      <dc:date>2014-04-29T17:42:24Z</dc:date>
    </item>
    <item>
      <title>Re: Averaging raster cells that fall within a polygon</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/averaging-raster-cells-that-fall-within-a-polygon/m-p/684026#M18404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hailiang,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the reply! I am going to implement both and do some performance testing with some different scenarios. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Keith&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Apr 2014 14:35:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/averaging-raster-cells-that-fall-within-a-polygon/m-p/684026#M18404</guid>
      <dc:creator>KeithWeber1</dc:creator>
      <dc:date>2014-04-30T14:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Averaging raster cells that fall within a polygon</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/averaging-raster-cells-that-fall-within-a-polygon/m-p/684027#M18405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think I've found an easier way to get the functionality I am looking for. If I convert the raster to a point featureclass, then I can perform a spatial query on the point featureclass for each polygon using the contains spatial relationship. This allows me to perform one spatial query per polygon rather than performing a spatial query for each raster cell.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 13:24:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/averaging-raster-cells-that-fall-within-a-polygon/m-p/684027#M18405</guid>
      <dc:creator>KeithWeber1</dc:creator>
      <dc:date>2014-05-07T13:24:16Z</dc:date>
    </item>
  </channel>
</rss>

