Updating a published feature collection via arcgis online notebook

216
3
05-28-2021 09:22 AM
sjohnson
New Contributor

Hi,

I am trying to convert an rss feed (with lat/long) to a layer on our portal.  I can create the layer via:

rss feed -> spatial data frame -> feature collection -> published feature collection

Currently I can't find any documentation around how to overwrite a feature collection

I have found this tutorial about how to update a feature layer which doesn't work:
https://developers.arcgis.com/python/sample-notebooks/overwriting-feature-layers/

How can I either overwrite the feature collection or publish my feature collection as a feature layer?

0 Kudos
3 Replies
jcarlson
MVP Notable Contributor

I would use layer.manager.truncate(), then layer.edit_features(adds=spatialdataframe.spatial.to_featureset())

- Josh Carlson
Kendall County GIS
0 Kudos
sjohnson
New Contributor

Hi, thanks for the pointers. Unfortunately my layers object is a nonetype object so I have no layers to refer to.

I created the feature collection as per the instructions/tutorial here:

https://developers.arcgis.com/python/guide/accessing-and-creating-content/#Importing-data-from-a-pan...

and it displays successfully in the portal, but I cannot find out a way to either update the feature collection or publish this instead as a feature layer collection which I assume then gives me to the layer.manager functions to use for updating.

0 Kudos
jcarlson
MVP Notable Contributor

If that's not working, try tables instead, in case the layer in question is non-spatial.

When you say it's displaying successfully, what does it look like? You should be able to access individual layers and tables, and their respective manager functions, from an Item, not just a FeatureLayerCollection.

- Josh Carlson
Kendall County GIS
0 Kudos