Hi,
I use a python script in Jupyter to get data from an external WebApp through its API, convert it to a pandas DataFrame, and publish it as a feature collection on AGOL . below is a part of the code where data (df_data) is imported as a feature collection and then gets published on AGOL.
df_data_fc = gis.content.import_data(df_data)
#Build a python dictionary from feature collection properties
df_data_fc_dict = dict(df_data_fc.properties)
df_data_json = json.dumps({"featureCollection": {"layers": [df_data_fc_dict]}})
#Use the dictionary in a list as the layers property of a json featureCollection to add the item to the portal
data_item_properties = {'title': ' Incidents Map',
'description':'Example demonstrating the integration between GIS and 3rd party portal ',
'tags': ' PCDS',
'text':df_data_json,
'type':'Feature Collection'}
data_item = gis.content.add(data_item_properties)
At the moment I need to come up with a python script to overwrite the published feature layer daily instead of publishing a new layer through each update.
I have done some research to find the related code but unfortunately, there are no similar situations where someone wants to overwrite a layer with a pandas data frame.
Is there any python scrip to use a pandas data frame in order to overwrite the above-published layer?