<?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 Problems in &amp;quot;summarize within&amp;quot; using Python notebook in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232601#M62348</link>
    <description>&lt;P&gt;HI!&lt;/P&gt;&lt;P&gt;I am trying to do "summarize within" with a multiple years of points data with a polygon. I need to summarize some columns in the table of the points within boundaries of the polygon. Since I have many point data files, I would like to use the "for" loop in Python notebook.&lt;/P&gt;&lt;P&gt;The problem is ... I can successfully do the process when I defined the "outFeatureClass" as one file. But when I try to make the "outFeatureClass" as the combination of path and the name (for multiple file), the results become quite strange.&lt;/P&gt;&lt;P&gt;The first code works, and the second code does not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) the first code&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;arcpy.env.workspace = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD_2.gdb'
polys = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD.gdb\TBGIS_TRDAR_RELM'
fcs = arcpy.ListFeatureClasses("seo_biz_mstr_open*", "Point")

for fc in fcs:
    outFeatureClass = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD.gdb\seo_biz_mstr_open_201903_test_out_out'
    keepAll = 'KEEP_ALL'
    sumFields = [["STR_TOT","SUM"]]
    addShapeSum = 'ADD_SHAPE_SUM'
    addMinMaj = 'NO_MIN_MAJ'
    addPercents = 'NO_PERCENT'
    arcpy.analysis.SummarizeWithin(polys, fc, outFeatureClass, keepAll, 
                               sumFields, addShapeSum, '', '', 
                               addMinMaj, addPercents)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JinseoYoon_1-1668671302651.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56177i2A1F204278AF6132/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JinseoYoon_1-1668671302651.png" alt="JinseoYoon_1-1668671302651.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;2) the second code&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;arcpy.env.overwriteOutput=True

arcpy.env.workspace = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD_2.gdb'
polys = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD.gdb\TBGIS_TRDAR_RELM'
fcs = arcpy.ListFeatureClasses("seo_biz_mstr_open*", "Point")

for fc in fcs:
    outFeatureClass = os.path.join(r"D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD.gdb", fc)
    keepAll = 'KEEP_ALL'
    sumFields = [["STR_TOT","SUM"]]
    addShapeSum = 'ADD_SHAPE_SUM'
    addMinMaj = 'NO_MIN_MAJ'
    addPercents = 'NO_PERCENT'
    arcpy.analysis.SummarizeWithin(polys, fc, outFeatureClass, keepAll, 
                               sumFields, addShapeSum, '', '', 
                               addMinMaj, addPercents)&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JinseoYoon_2-1668671342748.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56178i453CFD89B1A59B80/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JinseoYoon_2-1668671342748.png" alt="JinseoYoon_2-1668671342748.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot see any difference between the two code, rather than the way of defining the outfeatureclass, but the outcome seems quite different (the first one is correct).&lt;/P&gt;&lt;P&gt;Your advice would be very much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is quite large, so I cannot upload, but I can provide via email if requested.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Nov 2022 12:57:11 GMT</pubDate>
    <dc:creator>JinseoYoon</dc:creator>
    <dc:date>2022-11-17T12:57:11Z</dc:date>
    <item>
      <title>Problems in "summarize within" using Python notebook</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232601#M62348</link>
      <description>&lt;P&gt;HI!&lt;/P&gt;&lt;P&gt;I am trying to do "summarize within" with a multiple years of points data with a polygon. I need to summarize some columns in the table of the points within boundaries of the polygon. Since I have many point data files, I would like to use the "for" loop in Python notebook.&lt;/P&gt;&lt;P&gt;The problem is ... I can successfully do the process when I defined the "outFeatureClass" as one file. But when I try to make the "outFeatureClass" as the combination of path and the name (for multiple file), the results become quite strange.&lt;/P&gt;&lt;P&gt;The first code works, and the second code does not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) the first code&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;arcpy.env.workspace = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD_2.gdb'
polys = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD.gdb\TBGIS_TRDAR_RELM'
fcs = arcpy.ListFeatureClasses("seo_biz_mstr_open*", "Point")

for fc in fcs:
    outFeatureClass = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD.gdb\seo_biz_mstr_open_201903_test_out_out'
    keepAll = 'KEEP_ALL'
    sumFields = [["STR_TOT","SUM"]]
    addShapeSum = 'ADD_SHAPE_SUM'
    addMinMaj = 'NO_MIN_MAJ'
    addPercents = 'NO_PERCENT'
    arcpy.analysis.SummarizeWithin(polys, fc, outFeatureClass, keepAll, 
                               sumFields, addShapeSum, '', '', 
                               addMinMaj, addPercents)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JinseoYoon_1-1668671302651.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56177i2A1F204278AF6132/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JinseoYoon_1-1668671302651.png" alt="JinseoYoon_1-1668671302651.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;2) the second code&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;arcpy.env.overwriteOutput=True

arcpy.env.workspace = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD_2.gdb'
polys = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD.gdb\TBGIS_TRDAR_RELM'
fcs = arcpy.ListFeatureClasses("seo_biz_mstr_open*", "Point")

for fc in fcs:
    outFeatureClass = os.path.join(r"D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD.gdb", fc)
    keepAll = 'KEEP_ALL'
    sumFields = [["STR_TOT","SUM"]]
    addShapeSum = 'ADD_SHAPE_SUM'
    addMinMaj = 'NO_MIN_MAJ'
    addPercents = 'NO_PERCENT'
    arcpy.analysis.SummarizeWithin(polys, fc, outFeatureClass, keepAll, 
                               sumFields, addShapeSum, '', '', 
                               addMinMaj, addPercents)&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JinseoYoon_2-1668671342748.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56178i453CFD89B1A59B80/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JinseoYoon_2-1668671342748.png" alt="JinseoYoon_2-1668671342748.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot see any difference between the two code, rather than the way of defining the outfeatureclass, but the outcome seems quite different (the first one is correct).&lt;/P&gt;&lt;P&gt;Your advice would be very much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is quite large, so I cannot upload, but I can provide via email if requested.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 12:57:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232601#M62348</guid>
      <dc:creator>JinseoYoon</dc:creator>
      <dc:date>2022-11-17T12:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Problems in "summarize within" using Python notebook</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232604#M62349</link>
      <description>&lt;P&gt;In the working case, the output fc and its name doesn't change and the results are accumulated to it.&amp;nbsp; In the non-working version, its output and name change with every loop and I suspect only the last input to the loop is kept&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 08:30:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232604#M62349</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-11-17T08:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problems in "summarize within" using Python notebook</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232650#M62353</link>
      <description>&lt;P&gt;Thank you very much for your help.&lt;/P&gt;&lt;P&gt;Indeed, I have an error (copied below) when I increased the number of featureclasses in the input folder, and I do not know how to address the issue.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;ExecuteError&lt;/SPAN&gt;: Failed to execute. Parameters are not valid.
ERROR 000728: Field STR_TOT does not exist within table
Failed to execute (SummarizeWithin).&lt;/PRE&gt;&lt;P&gt;But besides the problem, I posted the question because the outcomes of the two codes (1 and 2) differ even there was only one featureclass in the input folder.&lt;/P&gt;&lt;P&gt;I attach the files after substantially reduced the size by modifying features.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be very much appreciated if you can help further.&amp;nbsp; - I just uploaded the files again due to some error...&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 12:36:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232650#M62353</guid>
      <dc:creator>JinseoYoon</dc:creator>
      <dc:date>2022-11-17T12:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problems in "summarize within" using Python notebook</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232656#M62354</link>
      <description>&lt;P&gt;Do all your featureclasses have the same structure?&lt;/P&gt;&lt;P&gt;According to the error and the code examples, you require a STR_TOT field to exist in all the featureclasses in order to perform the sum operation them.&lt;/P&gt;&lt;P&gt;To assess which code is actually working, compare the results to doing it manually.&amp;nbsp; If the first code produces the 'correct' result for one featureclass test against more.&lt;/P&gt;&lt;P&gt;In fact, you can batch the tool to produce results for multiple featureclasses...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="summarizewithin.png" style="width: 276px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56194i93DC0EE78380E512/image-size/medium?v=v2&amp;amp;px=400" role="button" title="summarizewithin.png" alt="summarizewithin.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 12:35:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232656#M62354</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-11-17T12:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problems in "summarize within" using Python notebook</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232658#M62355</link>
      <description>&lt;P&gt;I just tried and the problem you raised was not indeed a problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is the differing results from the code 1 and 2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;the first image is from the code 1 and the second one is one of the results with the code 2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JinseoYoon_0-1668689276968.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56195iCA942A74F2E09755/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JinseoYoon_0-1668689276968.png" alt="JinseoYoon_0-1668689276968.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JinseoYoon_1-1668689350969.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56196i30BAF3F7407FD491/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JinseoYoon_1-1668689350969.png" alt="JinseoYoon_1-1668689350969.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 12:49:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232658#M62355</guid>
      <dc:creator>JinseoYoon</dc:creator>
      <dc:date>2022-11-17T12:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problems in "summarize within" using Python notebook</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232668#M62356</link>
      <description>&lt;P&gt;Yes I do have the &lt;SPAN&gt;STR_TOT field in every featureclass, and I confirmed that the first code works well.&amp;nbsp; The second code, for the batch of the input file, does not work and I am struggling to figure out why for a couple of days.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The second code is different from the first code only in one line below, copied here, the subject line from first and second code respectively.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;outFeatureClass = 'D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD.gdb\seo_biz_mstr_open_201903_test_out_out'&lt;/PRE&gt;&lt;PRE&gt;outFeatureClass = os.path.join(r"D:\WORK\PROJECT\COVID_19_4\GIS\CVD_STORE_INDVD.gdb", fc)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BTW, your suggestion to go with the batch option in in the tool box panel works very well - thank you!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;but I have too many files to select one by one. Indeed I can do the manual work since it would take less time than I spent for the code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; BUT,,, I really want to make the code work. Your help would be very much appreciated!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 13:25:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/problems-in-quot-summarize-within-quot-using/m-p/1232668#M62356</guid>
      <dc:creator>JinseoYoon</dc:creator>
      <dc:date>2022-11-17T13:25:58Z</dc:date>
    </item>
  </channel>
</rss>

