<?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: Calculating the area of intersect between features in different layers? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculating-the-area-of-intersect-between-features/m-p/488254#M38135</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have done something similar recently, based on clip output (see the 3rd line), but this will work as well on intersect output - here is the snippet showing the part you're interested in:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, time
from operator import itemgetter

arcpy.Clip_analysis('theData', 'buffer500', 'clip500')
 
# define dictionary
summary = dict()
 
rows = arcpy.SearchCursor('clip500')

# type or category is in my feature class called DESCRIPTION.
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.DESCRIPTION in summary:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; summary[row.DESCRIPTION] = summary[row.DESCRIPTION] + row.shape_area
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; summary[row.DESCRIPTION] = row.shape_area

# dictionary now loaded, from here on out are simply acreage conversions, sorting.
sumTotalAc = sum(summary.values())/43560.0

arcpy.AddMessage('\nTotal area: ' + str(sumTotalAc))

sortSummaryAc = sorted(([a, b/43560.0] for a, b in summary.iteritems()), key = itemgetter(1), reverse = True)

arcpy.AddMessage(sortSummaryAc)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ahh, you said you are after percentages, which if you think about it is kind of incidental once you have total acreage.&amp;nbsp; I have the sum(summary.values()) converted to acres, sumTotalAc, above.&amp;nbsp; I guess I could have computed percentages in the dictionary, but I just did it on-the-fly since I needed individual DESCRIPTION acreages as well as percentage of the total in some text elements displayed on the map ---- so if this makes sense to you, here's that part (the whole script is really too long to make my point clear):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for each in sortSummaryAc:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; testgrab = elmhndl.pop()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if round(each[1], 1) &amp;gt; 0.0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # here's the line adding both the acreage and percentage
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; testgrab.text = each[0] + ' - ' + str(round(each[1], 1)) + '&amp;nbsp; acres&amp;nbsp;&amp;nbsp; (' + str(round((each[1]/sumTotalAc*100), 1)) + ' %)'&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index = assign(testgrab, [initPosX, initPosY])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initPosY = initPosY - float(0.2122)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage('\n...' + each[0] + ' is too small, removing element to remaining set...')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; testgrab.text = '-'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index = assign(testgrab, [initPosX1, initPosY1])
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that's clear.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:28:53 GMT</pubDate>
    <dc:creator>T__WayneWhitley</dc:creator>
    <dc:date>2021-12-11T21:28:53Z</dc:date>
    <item>
      <title>Calculating the area of intersect between features in different layers?</title>
      <link>https://community.esri.com/t5/python-questions/calculating-the-area-of-intersect-between-features/m-p/488251#M38132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does anyone know if there is a python script (or anything similar) that would enable me to select a layer and calculate the area of intersection between its features and those in another layer. For example I have a layer containing potential development sites and I want to find out the area of each site that intersects a constraint (eg flood plain) and append this to the sites layer. The sites layer has about 300 sites and there are about 80 constraint layers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the moment I am using an old script (&lt;/SPAN&gt;&lt;A href="http://arcscripts.esri.com/details.asp?dbid=10579"&gt;http://arcscripts.esri.com/details.asp?dbid=10579&lt;/A&gt;&lt;SPAN&gt;) but I don't think this will work when we start using v10.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mark&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 13:53:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-the-area-of-intersect-between-features/m-p/488251#M38132</guid>
      <dc:creator>MarkCooper1</dc:creator>
      <dc:date>2011-09-13T13:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the area of intersect between features in different layers?</title>
      <link>https://community.esri.com/t5/python-questions/calculating-the-area-of-intersect-between-features/m-p/488252#M38133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You could accomplish this by intersecting the sites and floodplain layer, perform a join and then calculate the percent coverage using the 'Shape_Area' fields.&amp;nbsp; Here is an example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
env.workspace = r"C:\temp\python\test.gdb"
env.overwriteOutput = True

fc1 = "DevelopmentSites"
fc2 = "FloodPlain"

# Add field to DevelopmentSites
arcpy.AddField_management(fc1, "Percentage", "Double")

# Perform an intersect between DevelopmentSites &amp;amp; FloodPlain feature classes
arcpy.Intersect_analysis([[fc1], [fc2]], "Intersect")

# Join intersecting feature class with DevelopmentSites
arcpy.MakeFeatureLayer_management(fc1, "development_layer")
arcpy.AddJoin_management("development_layer", "OBJECTID", "Intersect", "FID_DevelopmentSites")

# Calculate Percentage of flood plain coverage
arcpy.CalculateField_management("development_layer", "DevelopmentSites.Percentage", "!Intersect.Shape_Area! / !DevelopmentSites.Shape_Area! * 100", "PYTHON")

# Delete Intersect feature class
arcpy.Delete_management("Intersect")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The result will be a new field called 'Percentage' within the DevelopmentSites feature class with the percent coverage of the flood plain feature class.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:28:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-the-area-of-intersect-between-features/m-p/488252#M38133</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T21:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the area of intersect between features in different layers?</title>
      <link>https://community.esri.com/t5/python-questions/calculating-the-area-of-intersect-between-features/m-p/488253#M38134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Would there be a way for me to calculate the percentage of categories of flood plain type rather that just the percent intersect?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Aug 2013 19:08:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-the-area-of-intersect-between-features/m-p/488253#M38134</guid>
      <dc:creator>SimchaLevental</dc:creator>
      <dc:date>2013-08-15T19:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the area of intersect between features in different layers?</title>
      <link>https://community.esri.com/t5/python-questions/calculating-the-area-of-intersect-between-features/m-p/488254#M38135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have done something similar recently, based on clip output (see the 3rd line), but this will work as well on intersect output - here is the snippet showing the part you're interested in:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy, time
from operator import itemgetter

arcpy.Clip_analysis('theData', 'buffer500', 'clip500')
 
# define dictionary
summary = dict()
 
rows = arcpy.SearchCursor('clip500')

# type or category is in my feature class called DESCRIPTION.
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row.DESCRIPTION in summary:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; summary[row.DESCRIPTION] = summary[row.DESCRIPTION] + row.shape_area
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; summary[row.DESCRIPTION] = row.shape_area

# dictionary now loaded, from here on out are simply acreage conversions, sorting.
sumTotalAc = sum(summary.values())/43560.0

arcpy.AddMessage('\nTotal area: ' + str(sumTotalAc))

sortSummaryAc = sorted(([a, b/43560.0] for a, b in summary.iteritems()), key = itemgetter(1), reverse = True)

arcpy.AddMessage(sortSummaryAc)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ahh, you said you are after percentages, which if you think about it is kind of incidental once you have total acreage.&amp;nbsp; I have the sum(summary.values()) converted to acres, sumTotalAc, above.&amp;nbsp; I guess I could have computed percentages in the dictionary, but I just did it on-the-fly since I needed individual DESCRIPTION acreages as well as percentage of the total in some text elements displayed on the map ---- so if this makes sense to you, here's that part (the whole script is really too long to make my point clear):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for each in sortSummaryAc:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; testgrab = elmhndl.pop()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if round(each[1], 1) &amp;gt; 0.0:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # here's the line adding both the acreage and percentage
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; testgrab.text = each[0] + ' - ' + str(round(each[1], 1)) + '&amp;nbsp; acres&amp;nbsp;&amp;nbsp; (' + str(round((each[1]/sumTotalAc*100), 1)) + ' %)'&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index = assign(testgrab, [initPosX, initPosY])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initPosY = initPosY - float(0.2122)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage('\n...' + each[0] + ' is too small, removing element to remaining set...')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; testgrab.text = '-'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index = assign(testgrab, [initPosX1, initPosY1])
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that's clear.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Enjoy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:28:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-the-area-of-intersect-between-features/m-p/488254#M38135</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-11T21:28:53Z</dc:date>
    </item>
  </channel>
</rss>

