Select to view content in your preferred language

Error while generating offline areas

136
3
Friday
Labels (3)
vijaybadugu
Frequent Contributor

I am trying to generate offline areas through ArcGIS Python API, getting an below error 

TypeError: 'VectorTileLayer' object is not subscriptable

vijaybadugu_0-1749245689852.png

0 Kudos
3 Replies
Clubdebambos
MVP Regular Contributor

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

~ learn.finaldraftmapping.com
0 Kudos
vijaybadugu
Frequent Contributor

 

vijaybadugu_1-1749566226191.png

Still, i am getting an error after changing to your suggested code.

 

0 Kudos
Clubdebambos
MVP Regular Contributor

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))

 

~ learn.finaldraftmapping.com
0 Kudos