<?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: Count number of features inside polygon in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708195#M54895</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may need to use &lt;A href="https://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/make-feature-layer.htm"&gt;Make Feature Layer&lt;/A&gt; to convert your shape file into a "layer".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Mar 2020 19:30:25 GMT</pubDate>
    <dc:creator>RandyBurton</dc:creator>
    <dc:date>2020-03-20T19:30:25Z</dc:date>
    <item>
      <title>Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708184#M54884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need some help on my code to count the number of features inside a polygon. I have the following but after testing it, it doesn't seem to be correct. I am trying to figure out how many parcel lots are within the subdivision boundary. My test show after running the code that the "Stats" table has 9 Frequencies but in actually there is 10 parcels within the subdivision. I have tried "HAVE_THEIR_CENTER_IN" but all the results are 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy, os

mxd = arcpy.mapping.MapDocument("current")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "Taxlots")[0]
subs = arcpy.mapping.ListLayers(mxd, "SubsOutsideCities")[0]
#arcpy.MakeFeatureLayer_management(par, "parLyr")

arcpy.SpatialJoin_analysis(subs, lyr,"in_memory/points_SpatialJoin", "JOIN_ONE_TO_MANY", "KEEP_ALL", "", "CONTAINS")
arcpy.Statistics_analysis("points_SpatialJoin", "in_memory/stats", "Join_Count COUNT","OBJECTID")
‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708184#M54884</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-12T05:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708185#M54885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your shapes are all singlepart?&amp;nbsp; If not, run the Multipart to singlepart tool&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2020 20:41:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708185#M54885</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-19T20:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708186#M54886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes they are all singlepart.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2020 20:49:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708186#M54886</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2020-03-19T20:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708187#M54887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;many to one&lt;/P&gt;&lt;P&gt;one to one&lt;/P&gt;&lt;P&gt;one to many&lt;/P&gt;&lt;P&gt;switch the order of the join&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which options did you try?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2020 21:02:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708187#M54887</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-19T21:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708188#M54888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is only two options for the spatialJoin_analysis, i am not sure what you mean by the other options.&lt;/P&gt;&lt;P&gt;JOIN_ONE_TO_ONE&lt;/P&gt;&lt;P&gt;JOIN_ONE_TO_MANY&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2020 21:08:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708188#M54888</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2020-03-19T21:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708189#M54889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Looks like you are using ArcMap to perform you analysis.&amp;nbsp; You might try to do it by hand, and then go to the geoprocessing results button; that'll tell what ArcMap just did for you and you can use that in your python coding.&amp;nbsp; I do that all the time with tools in Pro.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2020 21:15:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708189#M54889</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2020-03-19T21:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708190#M54890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have tried that and get the same results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2020 21:54:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708190#M54890</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2020-03-19T21:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708191#M54891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps something like:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;countFC &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'polygons'&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# feature containing outer polygons&lt;/SPAN&gt;
countFld &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'ParcelCount'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'SHAPE@'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# ParcelCount is for count results, SHAPE@ is geometry of polygon&lt;/SPAN&gt;

parcels &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'parcels'&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# parcels to be counted&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;countFC&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; countFld&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# cycle through outer polygon layer&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByLocation&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;parcels&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"HAVE_THEIR_CENTER_IN"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# row[1] is SHAPE@&lt;/SPAN&gt;
        row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;parcels&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# row[0] to be updated with count&lt;/SPAN&gt;
        cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# update row‍‍‍‍‍‍‍‍‍‍&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:44:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708191#M54891</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-12T05:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708192#M54892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;save the result to disk, and open the table showing the OBJECTID for the join count.&lt;/P&gt;&lt;P&gt;click on every feature in turn and see if one of the features is actually 2 parts, or one feature is partially on top of the other&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2020 22:28:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708192#M54892</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-03-19T22:28:12Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708193#M54893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Randy I was able to get to work, thanks for the help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy

mxd = arcpy.mapping.MapDocument("current")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "Taxlots")[0]
subs = arcpy.mapping.ListLayers(mxd, "SubsOutsideCities")[0]
#arcpy.MakeFeatureLayer_management(par, "parLyr")

with arcpy.da.UpdateCursor(subs, ["VxCount1", "Shape@"]) as cursor: # cycle through outer polygon layer
    for row in cursor:
        arcpy.management.SelectLayerByLocation(lyr, "HAVE_THEIR_CENTER_IN", row[1]) # row[1] is SHAPE@
        row[0] = int(arcpy.GetCount_management(lyr)[0]) # row[0] to be updated with count
        cursor.updateRow(row) # update row&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:44:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708193#M54893</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-12T05:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708194#M54894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If i run the following in stand alone python, every value in VxCount1 has the same number. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;subs &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Temp\SubsOutsideCities_Temp.shp'&lt;/SPAN&gt;
lyr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;'C:\Temp\TaxParcels.shp'&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UpdateCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;subs&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"VxCount1"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Shape@"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# cycle through outer polygon layer&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; row &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; cursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByLocation&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"HAVE_THEIR_CENTER_IN"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# row[1] is SHAPE@&lt;/SPAN&gt;
        row&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; int&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetCount_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# row[0] to be updated with count‍‍‍‍‍‍‍&lt;/SPAN&gt;
        cursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;updateRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;row&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# update row&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:45:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708194#M54894</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-12T05:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708195#M54895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may need to use &lt;A href="https://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/make-feature-layer.htm"&gt;Make Feature Layer&lt;/A&gt; to convert your shape file into a "layer".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Mar 2020 19:30:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708195#M54895</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2020-03-20T19:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Count number of features inside polygon</title>
      <link>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708196#M54896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got it to work with making a feature layer. and adding row 10&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;lyr = r'C:\Temp\TaxParcels.shp'
subs = r'C:\Temp\SubsOutsideCities_Temp.shp'
arcpy.MakeFeatureLayer_management(lyr, "parLyr")


with arcpy.da.UpdateCursor(subs, ["VxCount", "Shape@"]) as cursor: # cycle through outer polygon layer
    for row in cursor:
        arcpy.management.SelectLayerByLocation("parLyr", "HAVE_THEIR_CENTER_IN",row[1]) # row[1] is SHAPE@
        count = int(arcpy.GetCount_management("parLyr")[0])# row[0] to be updated with count
        row[0] = (count)
        cursor.updateRow(row) # update row&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:45:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-number-of-features-inside-polygon/m-p/708196#M54896</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-12-12T05:45:03Z</dc:date>
    </item>
  </channel>
</rss>

