WMS from ArcGIS Online not showing in Python API script

540
1
Jump to solution
08-16-2018 06:44 AM
JustinBridwell2
Occasional Contributor II

I have a Web Map Layer (Prelim_CSLF) in my ArcGIS Online content that is not showing when I call it from the ArcGIS API in a Python script. The Layer comes from a public web mapping service. As you can see, there are other layers in my contents. The ACS Feature Layer also comes from an outside service. enter image description here

In my script, I use the API to connect to my ArcGIS Online content and just want to list the items there.

agol = GIS("http://<arcGIS Online url>", "<username>", "<password>") agolList = agol.content.search("") agolList

Results =

[<Item title:"void_poly2" type:Feature Layer Collection owner:>,   <Item title:"PANYNJ_Charrette_Data"  type:Feature Layer Collection owner:>,   <Item title:"Map_Tour_Fianl" type:Feature Layer Collection owner:>,   <Item title:"April3_2018_update" type:Feature Layer Collection owner:>,   <Item title:"VA_Port" type:Feature Layer Collection owner:>,   <Item title:"GTS_Lidar_Project_Boundaries" type:Feature Layer Collection owner:>,   <Item title:"PR_SDE_QC_Batch4" type:Feature Layer Collection owner:>,   *<Item title:"ACS" type:Feature Layer Collection owner:jbridwell>*,   <Item title:"East_Donegal_Water_Utility_Network" type:Feature Layer Collection owner:>,   <Item title:"coastal_dg_polygons" type:Feature Layer Collection owner:>]

However, I am not seeing the Prelim_CSLF layer. I do see the ACS layer though (starred *). When I try agol.content.search("Prelim_CSLF", item_type="Map Image Layer") it just returns an empty []. What is the problem here?

0 Kudos
1 Solution

Accepted Solutions
JustinBridwell2
Occasional Contributor II

While I was not exactly able to solve the mystery of why the layer doesn't show up when I used something like:

   

     gis = GIS("<arcGIS Online URL>", "<user name>", "<pass>")

     myLyrs = gis.content.search(query="")

I was able to find a work around. I basically had to call the specific layer:

    cslfLayer = gis.content.search(query="title: Prelim_CSLF")

and then add it to the myLyrs list. Note: Because cslfLayers also gets returned as a list, I can to use a For loop to pull it out:

    for item in cslfLayer:
        myLyrs.append(item)
   

    cslfLyr = myLyrs[10]

I could then view and work with the layer although I am still not sure why the content.search for MyLyrs didn't work.

View solution in original post

0 Kudos
1 Reply
JustinBridwell2
Occasional Contributor II

While I was not exactly able to solve the mystery of why the layer doesn't show up when I used something like:

   

     gis = GIS("<arcGIS Online URL>", "<user name>", "<pass>")

     myLyrs = gis.content.search(query="")

I was able to find a work around. I basically had to call the specific layer:

    cslfLayer = gis.content.search(query="title: Prelim_CSLF")

and then add it to the myLyrs list. Note: Because cslfLayers also gets returned as a list, I can to use a For loop to pull it out:

    for item in cslfLayer:
        myLyrs.append(item)
   

    cslfLyr = myLyrs[10]

I could then view and work with the layer although I am still not sure why the content.search for MyLyrs didn't work.

0 Kudos