im trying to do tutorial at here:
https://developers.arcgis.com/python/sample-notebooks/land-cover-classification-using-unet/
when i get up to this line i get the error
m.add_layer(world_imagery_layer)
TypeError: 'NoneType' object is not iterable
however the other item can be added to my map (m) just fine
m.add_layer(label_layer)
ive tried:
but apparently .Layer() isn't an attribute
AttributeError: 'GIS' object has no attribute 'Layer'
im not sure why one layer can be added but the other can't?
Solved! Go to Solution.
Hi @glewi3
What version of API are you using?
I'm getting the same error in 1.8.1 however I tested it in 1.8.3 and it's working.
I can recommend to upgrade your ArcGIS API for Python version to 1.8.3 and it should work.
I assume somewhere in your code you are setting a value for world_imagery_layer. Something like:
world_imagery_item = ent_gis.content.search("title: WorldImagery_AOI_NewYork owner:api_data_owner", "Map Image Layer")[0]
world_imagery_layer = world_imagery_item.layers[0]
m.add_layer(world_imagery_layer)
The error suggests you might have a typo in the layer's name. The layer would not be found and a None would be returned. If you don't spot the error, you should share the bit of code where the world_imagery_layer is being set.
world_imagery_item = gis.content.search("title: WorldImagery_AOI_NewYork",
"Map Image Layer")[0] # the index might change
world_imagery_item
world_imagery_layer = world_imagery_item.layers[0]
m = gis.map("Kent county, Delaware")
m
m.add_layer(world_imagery_layer)
Hi @glewi3
What version of API are you using?
I'm getting the same error in 1.8.1 however I tested it in 1.8.3 and it's working.
I can recommend to upgrade your ArcGIS API for Python version to 1.8.3 and it should work.
in anaconda navigator it says my arcgis library/package is 1.7.1 is that what u mean?
if i install arcgis 1.8.3 with anaconda then arcpy cant be installed because of conflicts. and i need arcpy in order to get some beginning bit to work. how i did it originally was i installed arcpy then arcgis (default version) came with it.
thx
i created a whole new py36 environment in anaconda navigator and added Arcgis 1.8.3 to it then added it as a new kernal to jupyter and recopied every cell and now it all works. Thanks!
do u then know how to get an image server set up? i dont know why this isn't shown in the tutorial...
If you have ArcGIS Image Server installed, go to ArcGIS Server Manager > Site > Data Stores > Database
and create / register Raster Store. The path can be a shared folder.
Hey sorry again
Do you know how to do this same thing with ArcGIS pro?