I have a feature layer which needs to be updated with data from a csv.
I covert the feature layer to a spatial dataframe. And convert the csv to a dataframe. Then I do a pd.merge on both. As a test I overwrote the spatialdataframe to a featureclass in my gdb, and it works just fine!
Why is there not such an option for the to_feature_layer? It does not let me overwrite just like in te to_featureclass option.
I am trying with the manager overwrite using the feature class I just updated as the data source, it does return success but the feature layer remains the same.
Is there any other way to overwrite a featurelayer using the spatial data frame?
You can update the feature layer with new spatial data frame. For example:
# convert merged spatial data frame to feature set
updated_features = merged_sdf.spatial.to_featureset()
# update the feature layer
update_result = feature_layer.edit_features(updates=updated_features)