I am currently writing a routine to add features from a local feature class to a hosted feature layer using the FeatureLayer class edit_features() function. The routine adds data in "chunks" (e.g., 500, 1000 or 5000 features at a time). I've encountered a consistent issue when adding chunks from polygon feature classes, and have narrowed down the cause to a limitation with the number of vertices that exist in each chunk (i.e., the summation of all vertices from all polygons in the chunk). There appears to be a cap somewhere between 406,500 vertices (edits work) and 438,190 vertices (edits fail). I have run dozens of tests on chunks of varying sizes, and this threshold is consistent across the range of sizes - I can predict which chunks will fail based on the total number of vertices in the chunk.
I'm wondering if this is a known limitation with the edit_features function? If so, what is the exact threshold for polygon vertices? I'd like to know so I can programmatically choose the appropriate chunk size to speed up the editing process - larger chunks equate to quicker processing times.
Affected datasets:
Polygon feature classes with very large polygons (i.e., up to 1/3 the size of British Columbia) and intricate boundaries (i.e., lots of vertices). These feature classes have very few features (e.g., <100), and are relatively small file sizes (e.g., ~13 MB).
Workflow:
> Select number of features in feature class based on chunk size
> Export selected features to JSON file
> Create a feature set from the JSON file
> Add feature set to hosted feature layer using edit_features(adds = featSET)
> Iterate process until all features are added
The code works fine, so this is not a coding issue. This is a limitation on the portal/API side.
I've attached a feature class that can be used for testing. With this dataset edit_features(adds=) works for chunk sizes <=5 features, but anything larger and edits fail for at least one of the chunks. For example, with a chunk size of 7 and with features grouped into chunks sequentially, chunk #4 will fail. This chunk has 552,469 vertices, whereas the next largest chunk only has 337,324 vertices, and does not fail.