Select to view content in your preferred language

Custom arcpy toolbox tool: Looping through multiple input values with summarize within-tool and calculate field overwrites previous columns

97
1
3 weeks ago
LariJaakkola
New Contributor

Hello,

I am trying to create a python toolbox tool in which I want to give multiple input vector layers, loop through them with summarize within analysis and make two new columns based on each input vector layer with calculate field function.

The problem I have is that after each iteration the calculate field function overwrites the columns based on the previous input data.

Does anybody know how I can solve this problem?

The whole code can be found here: https://github.com/Geoc0der/code_in_progress/blob/main/summarizewithin_toolbox_1

0 Kudos
1 Reply
TonyAlmeida
Frequent Contributor

I think your issues is that arcpy.analysis.SummarizeWithin(input_grid_layer,input_data_parameter,output,shape_unit='SQUAREMETERS') is overwriting the existing content feature class with the results of the current iteration. Maybe create temporary output feature class for each iteration? or ensure that every iteration creates unique field names for the calculated fields.

0 Kudos