I posted this to the ArcGIS API for Python group, but it was suggested I try my chances here.
I am using the ArcGIS API for Python via Jupyter.
I have listed the layers for a map service using the "layers" property on an ArcGISMapService object.
(Sorry - forgot how to past code so it keeps formatting)
layers = web_map_obj.layers
for lyr in layers:
if lyr.layerType == 'ArcGISMapServiceLayer':
if 'layers' in lyr:
for l2 in lyr.layers:
print(" >>> "+str(l2.id))
I only get information for 2 layers out of 24. I'm sure this is the right map service, and the 2 layers that I get information for have the same id as they do in the full list I get when I directly check the map service in the portal. I've checked the json dump directly - only 2 layers are in it. It is most definitely incomplete.
Obviously, I could be making an error that I can't expect anyone here to diagnose, but I think there is something unusual going on here that someone might recognize as a common newbie mistake? Is this a common problem? Might the map service be corrupted? How would I check that? When I check the map service in the portal, I see all layers listed, and it works fine when it is loaded into a web map. Maybe the "layers" property on a web map object doesn't by default list all of the layers in the web map and I need to tell it to?
Bit of a Hail Mary here. Thank you for any help you may be able to provide.
Randy McGregor