Create Watersheds Output Not Appending

188
1
09-20-2023 02:11 PM
Labels (1)
bkaplan1
New Contributor II

I'm iterating through a list of points creating a watershed for each one using the Python API and ArcGIS Online.  I would like the outputs to be appended into one feature layer.    The documentation states for output

Optional string or FeatureLayer. Existing feature layer will cause the new layer to be appended to the Feature Service. If overwrite is True in context, new layer will overwrite existing layer. If output_name not indicated then new FeatureCollection created.

So in the code line

lakes_watershed = create_watersheds(feat_collect, output_name= "Created_watersheds")

when it gets to the second feature to create a watershed for a I get 

{"messageCode": "AO_100292", "message": "The provided output name is already in use or contains invalid characters."}
{"messageCode": "AO_100123", "message": "CreateWatersheds failed."}
Failed to execute (CreateWatersheds).
Failed.

 

I'm iterating through the table because there are 466 records.  If I do it for the entire feature layer at once it bombs out.  With this method, I can catch the error for each point.  Maybe there a better way?

Any idea what I'm doing wrong?

Thanks.

 

0 Kudos
1 Reply
EarlMedina
Esri Regular Contributor

Hey, if I'm reading the documentation correctly then if you want everything appended to a FeatureLayer you need to supply a FeatureLayer object, not string to output_name.

Seems like the failed process already created an initial Feature Layer for you? Use that for output_name and see what happens.

0 Kudos