0

This question pertains to arcgis.gis in Python, for working with hosted Feature Layers in ArcGIS Enterprise.

I'm using the enrich_data function to calculate a buffer polygon from my input (hosted) point layer, then add population statistics to the resulting polygon - this is working well. I'm not specifying an output_name, so the result is an in-memory FeatureCollection.

Now I wish to append the resulting polygon to an existing polygon layer which is hosted in ArcGIS Enterprise, but I can't figure out how to send the Feature Collection to the existing layer.

I tried the FeatureLayer edit_features command, which has an adds option which expects as input:

adds: FeatureSet/List. The array of features to be added

I can obtain the FeatureSet from FeatureCollection.layer.featureSet but this fails in the edit_features.add command with the below error message, which is unclear to me:

enter image description here

The section self._mapping[key] hints that there is an issue with the field mapping between the input and output polygons, but I can't see any options to remap the field names.

TL;DR - how can I append an in-memory FeatureCollection of polygons to a hosted Feature Layer in ArcGIS Enterprise?

1
  • PS FeatureLayer mentions an append option but this is only available for ArcGIS Online, and I'm working with ArcGIS Enterprise – Stephen Lead Apr 7 at 11:08
0

The documentation around this API is pretty sparse, so I disovered this through a lot of trial+error.

While the FeatureLayer page says that it expects to receive a "FeatureSet or List" as input to the FeatureLayer.edit_features(adds=...) command, in fact I found that I needed to send the list of features in order to avoid that error message:

polygonlayer.edit_features(adds=enrich_result.layer.featureSet.features)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.