I have a feature layer hosted in my organization that I want to turn into a new feature layer in my content, similar to this functionality:
I was messing around with some code:
base_comment_layer = gis.content.get('# acutal item ID goes here')
layer_properties={
'title':'Test_Comment_Layer',
'description':'This is a comment layer that is being used for testing purposes only',
'tags':'TPCM, Test, Python, Comment Layer'
}gis.content.add(item_properties=layer_properties, data=base_comment_layer, folder='test_NF')
but that didn't seem to work, I was getting an error:
AttributeError: 'Item' object has no attribute 'replace'
This is obviously after longing on using the GIS() method.
Any adivice?
Thanks.
Solved! Go to Solution.
I solved my issue. For those interested:
layer_properties={
'title':'Test_Comment_Layer',
'description':'This is a comment layer that is being used for testing purposes only',
'tags':'TPCM, Test, Python, Comment Layer',
'type':'Feature Service',
'url':'URL to Feature Service'
}gis.content.add(item_properties=layer_properties, data="URL to Feature Service", folder='test_NF')
I solved my issue. For those interested:
layer_properties={
'title':'Test_Comment_Layer',
'description':'This is a comment layer that is being used for testing purposes only',
'tags':'TPCM, Test, Python, Comment Layer',
'type':'Feature Service',
'url':'URL to Feature Service'
}gis.content.add(item_properties=layer_properties, data="URL to Feature Service", folder='test_NF')
Thank you Zachary! Very helpful. This is not the most intuitive, and not covered very well in the docs.
can you define more on how you get the item's ID ? Especially if you generate the results automatically from a script and you simply want to move that feature layer into another folder on your arcgis online profile?