Hi,
I am working on a simple script which copies a web map and adds a new layer:
from arcgis.gis import GIS
from arcgis.mapping import WebMap
from arcgis.mapping import Layer
I receive:
ImportError: cannot import name 'Layer' from 'arcgis.mapping' (C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\mapping\__init__.py)
ArcGIS Pro 3.1.1
What is wrong?
Thanks.
-b.
Solved! Go to Solution.
There is no class Layer in arcgis.mapping .
Here are some classes that could be what you want:
for x in arcgis.mapping.__dict__.keys():
print(x)
... MapImageLayer MapImageLayerManager ... VectorTileLayer ... Object3DLayer IntegratedMeshLayer Point3DLayer VoxelLayer PointCloudLayer BuildingLayer SceneLayer ... MapServiceLayer MapFeatureLayer MapTable MapRasterLayer ...
It's also possible that you actually want arcpy.mp.Layer ...
There is no class Layer in arcgis.mapping .
Here are some classes that could be what you want:
for x in arcgis.mapping.__dict__.keys():
print(x)
... MapImageLayer MapImageLayerManager ... VectorTileLayer ... Object3DLayer IntegratedMeshLayer Point3DLayer VoxelLayer PointCloudLayer BuildingLayer SceneLayer ... MapServiceLayer MapFeatureLayer MapTable MapRasterLayer ...
It's also possible that you actually want arcpy.mp.Layer ...
Thanks a lot! I should be more careful with AI then..
-b.