Select to view content in your preferred language

Publishing Feature Layer to Portal not Overwriting

488
1
10-06-2023 08:54 AM
SteveScott1
New Contributor

I have a Spatially Enabled Data Frame I would like to regularly publish. My expected behavior is that it overwrites. But instead it is creating new hosted feature layers.

I am using an Enterprise Portal not AGOL.

 

        sedf = GeoAccessor.from_geodataframe(gdf)

        #get the existing item id
        feature_service_id = self.gis.content.search(query=f"title:{name}", item_type="Feature Service")[0].id
        logging.info(f"feature_service_id: {feature_service_id}")

        #publish as a feature layer 
        hosted_feature_lyr = sedf.spatial.to_featurelayer(title=name, 
                                                          gis=self.gis, 
                                                          tags="",
                                                          overwrite=True,
                                                          service={'featureServiceId': feature_service_id, 'layer': 0}
                                                         )
        #update the description and tags, or other properties.
        update_dict = {'description': f"Updated {datetime.now()}.", 
                       'tags': [ f'{datetime.now().year}']
                       }
        hosted_feature_lyr.update(item_properties=update_dict)

        #share the feature layer with the organization
        hosted_feature_lyr.share(everyone=False, org=True)

 

 How can I get it to overwrite instead of making new feature layers?

0 Kudos
1 Reply
EarlMedina
Esri Regular Contributor

Hey, I think I may be reproducing your issue. I'll have to dig into further to see if there's anything you can do, but I think logging a case with Esri Support may be a good idea.

0 Kudos