I am trying to generate offline areas through ArcGIS Python API, getting an below error
TypeError: 'VectorTileLayer' object is not subscriptable
Hi @vijaybadugu,
Looks like a VectorTileLayer is not subscriptable meaning you cannot use square bracket notation to access the "layerType".
You could try cached_layer.layerType.
Update to...
for cached_layer in cached_layers:
if cached_layer.layerType == "VectorTileLayer":
if cached_layer.url:
layer0_obj = arcgis_layers.VectorTileLayer(
cached_layer.url, self._gis
)
Please let us know if that helps.
All the best,
Glen
Still, i am getting an error after changing to your suggested code.
If your "VectorTileLayer" object has no attribute "layerType", that means that your cached_layer is a VectorTileLayer.
Try the below and see what objects are being returned for cached_layers
for cached_layer in cached_layers:
print(type(cached_layer))