Hello
I have an AGOL item with 3 layers: Site Location (pts), Site Buffer (poly) and Site Area (poly). The Site Area has a field with a Distance value that I would like to use to create my buffers (different value for each area).
So in my Notebook, I have a piece of code that select all the Site Location where the BufferFlag='N' then I intersect each of the records with my Site Area to get the proper value of the Distance to create the buffer…. AND THEN I AM STUCK! below is the section of code that I can't figure it out.(line 15 to 20)
i=0
###for each Site Location WORKING
for f in SLHFLcount:
print(f.attributes['FUID'] + ' -- '+ f.attributes['BufFlag2'])
ptFeat = SLHFLcount.features[i].geometry
print(ptFeat)
print("~~~~~~~~~")
###Intersect with my Site Location WORKING
AreaHFLqry = AreaHFL.query(where='1=1', geometry_filter=filters.intersects(ptFeat))
print(len(AreaHFLqry))
if len(AreaHFLqry) >=1:
AreaHFLqryFeatures = AreaHFLqry.features
print(AreaHFLqryFeatures[0].attributes['Area1']+ ' -- '+ AreaHFLqryFeatures[0].attributes['Area2'] + ' -- '+ str(AreaHFLqryFeatures[0].attributes['Dist']))
###Create individual buffers NOT WORKING
dDist = AreaHFLqryFeatures[0].attributes['Dist']
buffLyr = use_proximity.create_buffers(SLHFL, distances=[dDist], units = 'Feet',output_name=BufferHFL)
#buffLyr_fc = buffLyr.layer
#print(buffLyr_fc)
map1.add_layer(BufferHFL)
###update BufFlag to Y
#strExpression = "FUID='"+str(f.attributes['FUID']+"'")
#SLHFL.calculate(where=strExpression,calc_expression={"field":"BufFlag2", "value": "Y"})
else:
print("we don't have a polygon yet")
i +=1
print("----------------")
print("Process completed")
How can I create the buffer JUST for that selected Site Location and append the buffer to my Site Buffer layer?
Any help would be much appreciated.
Thanks!