<?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 a value from two feature class attribute fields in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/calculating-a-value-from-two-feature-class/m-p/1085115#M61925</link>
    <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 02 Aug 2021 21:29:05 GMT</pubDate>
    <dc:creator>GISAdministratorFranklin</dc:creator>
    <dc:date>2021-08-02T21:29:05Z</dc:date>
    <item>
      <title>Calculating a value from two feature class attribute fields</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-value-from-two-feature-class/m-p/1085071#M61922</link>
      <description>&lt;P&gt;I'm new to Python so thanks for your patience.&lt;/P&gt;&lt;P&gt;I'm working with two feature classes: Buildings and Parcels.&amp;nbsp; What I'm trying to achieve is as follow:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;Select a Parcel in ArcMap&lt;/LI&gt;&lt;LI&gt;The script will run the &lt;EM&gt;Select by Location&lt;/EM&gt; tool to find the Building polygon within the Parcel polygon&lt;/LI&gt;&lt;LI&gt;The script will then divide the Building feature class's area field by the Parcel feature class's area field.&lt;/LI&gt;&lt;LI&gt;The output merely needs to be a numeric value.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 19:35:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-value-from-two-feature-class/m-p/1085071#M61922</guid>
      <dc:creator>GISAdministratorFranklin</dc:creator>
      <dc:date>2021-08-02T19:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a value from two feature class attribute fields</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-value-from-two-feature-class/m-p/1085085#M61923</link>
      <description>&lt;P&gt;Did you look at&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/analysis/spatial-join.htm" target="_blank"&gt;Spatial Join (Analysis)—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;to get your started.&amp;nbsp; It would enable you to sum the area of the buildings in the process.&lt;/P&gt;&lt;P&gt;The division can be done in a new field after the fact&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 20:01:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-value-from-two-feature-class/m-p/1085085#M61923</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-08-02T20:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a value from two feature class attribute fields</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-value-from-two-feature-class/m-p/1085102#M61924</link>
      <description>&lt;P&gt;Are you creating a script tool for this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;You could try something like this to get you started, though you need to make sure that the selected parcel parameter type in your script tool is set to a feature layer (so only the selected parcel is used):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;selectedParcel = arcpy.GetParameter(0) # I assume this is for a script tool
buildingsFC = arcpy.GetParameterAsText(1) # path to buildings features

# Get the selected parcels area
parcelArea = arcpy.da.SearchCursor(selectedParcel, 'SHAPE@AREA').next()

# intersect to find buildings
selectedBuilding = arcpy.management.SelectLayerByLocation(buildingsFC, 'INTERSECT', selectedParcel, 'NEW_SELECTION')

# iterate over selected buildings and calculate math stuff
with arcpy.da.SearchCursor(selectedBuilding , 'SHAPE@AREA') as sCur:
    for row in sCur:
        print(f'area calc: {row[0]/ parcelArea}')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 20:34:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-value-from-two-feature-class/m-p/1085102#M61924</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-08-02T20:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating a value from two feature class attribute fields</title>
      <link>https://community.esri.com/t5/python-questions/calculating-a-value-from-two-feature-class/m-p/1085115#M61925</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 21:29:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/calculating-a-value-from-two-feature-class/m-p/1085115#M61925</guid>
      <dc:creator>GISAdministratorFranklin</dc:creator>
      <dc:date>2021-08-02T21:29:05Z</dc:date>
    </item>
  </channel>
</rss>

