Select to view content in your preferred language

'PropertyMap' instance has no attribute 'capabilities'

2178
3
02-08-2023 01:20 PM
Labels (3)
richarte
New Contributor

Hello,

I am trying to automate the process of creating new web maps with raster tile layers. We have published the raster tile layers from tile packages (tpkx) using the arcpy.management.SharePackage function. When we try to add the tile layers to a web map using the ArcGIS API for Python with the add_layer function we are getting an error "'PropertyMap' instance has no attribute 'capabilities'". The more detail error message is attached.

 

from arcgis.gis import GIS
gis = GIS("home")
items = gis.content.get('76cfae75c0534616a26dc28407d5b9b9')
layer = items.layers[0]
map_item = gis.map()
map_item.add_layer(layer)

 

0 Kudos
3 Replies
Clubdebambos
Frequent Contributor

Hi @richarte 

A content item has no property attribute called 'capabilities'.

You can access the 'capabilities' of a Feature Service through the Feature Layer Collection object

from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection

agol = GIS("home")
item = agol.content.get("item_id")
flc = FeatureLayerCollection(url=item.url, gis=agol)
print(flc.properties.capabilities)

 

Or you can access the Feature Layer 'capabilities' in a Feature Service item.

from arcgis.gis import GIS

agol = GIS("home")
item = agol.content.get("fs_item_id")
lyr = item.layers[0]
print(lyr.properties.capabilities)

 

Basically, target the object you want to get the capabilities for; create the object (like a FeatureLayer/FeatureLayerCollection) and then access the capabilities property. 

~ learn.finaldraftmapping.com
0 Kudos
Wei-HsinFu
Emerging Contributor

Thank you for your reply. I work with richarte on this project. We are working with tile layers. Tried your suggestion and it did not work. Please see attached. Any suggestion is appreciated.

0 Kudos
Wei-HsinFu
Emerging Contributor

Please disregard my previous reply. I am able to add the tile layer to Map Viewer Classic via the Map Service Layer class which has the "capabilities" attribute. The tile layer however fails to load with the new Map Viewer. Please see my post about this and let me know your suggestions. Thank you!

https://community.esri.com/t5/arcgis-api-for-python-questions/tile-layer-loads-in-map-viewer-classic... 

0 Kudos