I would like to add a WebTiledLayer via the ArcGIS Python API similar to addItem in the REST API.
My understanding is that I would use `gis.content.add` as shown blelow:
import arcgis
from arcgis.gis import GIS
from arcgis.mapping import WebMap
gis = GIS ('https://www.arcgis.com', 'username', password')
layer = ({'operationalLayers': [
{'title' : 'TITLE-HERE',
'type' : 'WebTiledLayer'
'templateUrl': 'URL-HERE',
'id': 'ID-HERE',
'copyright': 'COPYRIGHT-HERE'
'fullExtent': {
...
'spatialReference': {
'wkid': ...
}
},
'visibility': 'true',
'opacity': 1,
'layerType' : 'WebTiledLayer',
}
]
})
item_properties = { 'title': 'TITLE-HERE',
'type': 'Map Service',
'snippet', 'SOMETHING-HERE'
'tags': 'tiles-testing'
'url' : 'SAME AS TEMPLATE URL ABOVE'
'text': json.dumps(layer)
}
test_item = gis.content.add(item_properties=item_properties)
test_item.share(True)
When I try to use the link created, open it in Map Viewer and get a response of:
Error
The layer, {TITLE FROM ITEM PROPERTIES}, cannot be added to the map.
Any help is appreciated. If there is a notebook or other python snippet you can provide that would be ideal. Documentation lacks clear examples of how to implement the addItem cousin in ArcGIS Python API.