Select to view content in your preferred language

How to update a hosted feature layer with new and additional data?

584
2
11-03-2022 01:35 PM
JonJones1
Frequent Contributor

Hello all,

I have a hosted feature layer which are points that were made from a .csv file that lists a lat and long of each point.  My boss has added a few new rows of data to the .csv file and changed some of the previous data as well, via excel.   I have a variety of web maps and webapps using this feature layer that now needs to have access to this updated .csv file.   

I am an admin in arcgis online, however another admin originally made the hosted feature layer.   I would think it would be easy to update the feature layer with the updated .csv (basically overwrite the old version with a new version) however I am struggling greatly.   

I can find the "append data" button as shown here https://imgur.com/a/Mx7KeOK  however when I go into that screen the option to "update existing features" is grayed out https://imgur.com/a/Coggxh5 , and if I continue all that occurs is all my data in my new .csv file just gets appended to the end of the current feature class data and I end up with twice the number of points instead of updated points and just a few new points.   

How can I update my existing feature class layer?   Why is the "update existing features" grayed out? If that wasn’t grayed out I would believe everything would work as I wanted it to.

0 Kudos
2 Replies
jcarlson
MVP Esteemed Contributor

Is there a unique identifier on your CSV? I have no idea if this is related, but is the Sync setting enabled on the service? Sometimes that setting enables / disables other things.

How are you with Python? Updating a hosted layer from another data source like a CSV is one of our main automated procedures. I gave a presentation on the topic recently, if you're interested in looking through the code: https://github.com/jdcarls2/ilgisa-2022/blob/main/hosted-copy/hosted-copy.ipynb

Put simply: you read the CSV into a pandas dataframe, query the hosted layer into a second dataframe, compare the two, then use the results of the comparison to add / update / delete features in the hosted layer.

- Josh Carlson
Kendall County GIS
JonJones1
Frequent Contributor

Hey there!   I am not a python person at all, but yes I can put a unique identity.  It seems like this should be a straightforward effort but I just can't get it to happen. If anybody reads this and has a tutorial on what to do I would love all the help I can get, as this should be super easy, but not so far it hasn't been.  

0 Kudos