Provide ability of to_featurelayer to overwrite and name layer.

883
0
06-24-2021 11:26 AM
Status: Open
PhilLarkin1
Occasional Contributor III

 

When publishing with GeoAccessor's to_featurelayer function, the resulting service is given a unique name. Ideally a user could specify a name. To facilitate this, it would great if this function could overwrite an existing feature layer, as well. 

Example with psudocode:

from arcgis.gis import GIS
from arcgis.features import FeatureLayer
from arcgis.features import GeoAccessor

gis = GIS(gis=<>, username=<>, password=<>) 
serviceUrl = "https://services1.arcgis.com/<OrgID>/arcgis/rest/services/<name>/FeatureServer/0"

mylayer = FeatureLayer((serviceUrl))
df = GeoAccessor.from_layer(mylayer)
df.spatial.to_featurelayer(title='',tags='',folder='',name='YourNameHere',overwrite=True)