AnsweredAssumed Answered

Python Summzarize_within attribute error?

Question asked by s4432123_UQmaps on Oct 15, 2019
Latest reply on Oct 21, 2019 by BScott-esristaff

In arcgis online i have a webmap where i did a sumamrize within of a bunch of points into polygons to give those polygons density colours based on the number of points that are within them, now I want to do the same thing but solely in python. my points are the "QFESFireStations", and my polygons are the "Drought Affected Shires; QLD". My code is below. Also, I dont get why the summary_polygons layer is optional, because the tool NEEDS two layers, so how can only one layer be required for an input??? See the links below.


For some reason when i run this below i get (AttributeError: 'Item' object has no attribute 'summarize_within')


from arcgis.geoanalytics.summarize_data import summarize_within
webmap.summarize_within(summarized_layer="QFESFireStations", output_name = "SEE_ME",
polygon_or_bin = "POLYGONS", bin_type = "SQUARE",
summary_polygons="Drought Affected Shires; QLD", sum_shape = True)


Also, this is just a note I have three variable types

webmap = item
NewWebMap = MapView 
usable = WebMap


I tried the samething using arcpy but also didnt work.



import arcpy
drought = gis.content.get('4e73c854013a43beb258150d4be7e135')
Fire_station = gis.content.get('84fead439e2444a299d75296c365aba7')
outFS = 'SEE_ME1'
dataStore = "SEE_ME_DataStore1"

# Execute SummarizeWithin
arcpy.geoanalytics.SummarizeWithin(Fire_station, outFS, "POLYGON", None, None, drought, "ADD_SUMMARY", dataStore)


This gives the error (RuntimeError: Object: Error in executing tool)