Select to view content in your preferred language

Define layer name with sdf.spatial.to_featurelayer()

372
2
06-20-2024 06:29 AM
DavinShokes1
Frequent Contributor

I am looking at the documentation for "to_featurelayer()" at 

https://developers.arcgis.com/python/api-reference/arcgis.features.toc.html?highlight=to_featurelaye... 

 

However, I can't figure out how to name the feature layer. 

# Overwrite layer 0
service1 = {'featureServiceId':'**unspecified**', 'layer':0}
pub_sdf1 = sdf1.spatial.to_featurelayer(title='Testing_data',gis=gis, tags=['VM'], sanitize_columns=True,overwrite=True, service=service1)

# Overwrite layer 1
service2 = {'featureServiceId':'**unspecified**', 'layer':1}
pub_sdf2 = sdf2.spatial.to_featurelayer(title='Testing_data',gis=gis, tags=['VM'], sanitize_columns=True,overwrite=True, service=service2)

This code succeeds in overwriting the feature layers from spatial dataframe. However, both feature layers are called the same thing now.

 

Thank you.

DavinShokes1_0-1718890065216.png

 

 

0 Kudos
2 Replies
ChrisCowin_dhs
Occasional Contributor

Are you not explicitly naming them the same thing by using the same title?

DavinShokes1
Frequent Contributor

The title seems to be title to the Item name and not the layer name. 

I ended up using a going a different route for overwritting my layers. To_featurelayer() is missing too much documentation (such as the fact that a new shapefile is made from the dataframe and that is what is published). 

Thanks for the help.

 

0 Kudos