Hi,
I have a Hosted Feature Layer in ArcGIS Online, with a point layer and a polygon layer.
I am looking to run an ArcGIS Notebook as a task that will:
- Query the point layer where processed=no
- For each point, buffer by a point attribute ("distance_field")
- Take the buffer and append to the polygon layer, passing through the distance_field value, a type field and a globalid into parentglobalid. This is required for subsequent processing (and deleting related buffers when the point is updated).
I am having difficulty with the buffer() and use_proximity.create_buffers(). No matter what I do the input geometry seems to be recognized as invalid. Typical error messages are invalid geometry or
an error occured with:list indices must be integers or slices, not str
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
from arcgis.geometry import buffer
from arcgis.features import use_proximity
gis = GIS("home")
# Get our layers
layer_item = gis.content.get("xyzxyzxyz")
point_sublayer = layer_item.layers[1]
polygon_sublayer = layer_item.layers[2]
# Query our point layer
# Can set our_sr to 4326 or 3857. WGS84 or projected.
points = point_sublayer.query(where="1=1", out_fields="*", return_geometry=True,out_sr = 4326)
try:
for point in points:
p = point.geometry
print(type(p))
buffers = buffer(geometries=[p], distances=[5], unit='meters',out_sr=4326) # fails
# extra bit would go here to append against polygon
except Exception as e:
print(f"an error occured with:{str(e)}")
I believe it is because the input is a feature, not a featurecollection or other valid type but I'm not sure how to handle it otherwise.