Select to view content in your preferred language

Overwrite a service from a spatial data frame

715
1
11-18-2021 05:43 AM
ErikaJimenez_Rivera1
Emerging Contributor

Hi everybody,

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?

I

0 Kudos
1 Reply
J_R_Matchett
Occasional Contributor

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)