<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Cannot access the feature layer from a web map using ArcGIS API Python in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/cannot-access-the-feature-layer-from-a-web-map/m-p/1141285#M7095</link>
    <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I am trying to get the specific feature layer from the web map from the Portal based on its unique values, but nothing is printed in the results, but there are the feature layers present in lot of the web maps, the print function before the function&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;def find_maps_with_layer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;works and prints the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;web_map_items, but inside the class nothing is working, I cannot figure out the mistake. What am I doing wrong ? Inside the function nothing is working. Any insights will be helpful. Thank you..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;from&lt;/SPAN&gt; arcgis &lt;SPAN class=""&gt;import&lt;/SPAN&gt; GIS



portalUrlP = https://maps-url/portal/
userP = &lt;SPAN class=""&gt;"user"&lt;/SPAN&gt;
passwordP = &lt;SPAN class=""&gt;"pass"&lt;/SPAN&gt;

gisP = GIS(url=portalUrlP, username=userP, password=passwordP, verify_cert=&lt;SPAN class=""&gt;False&lt;/SPAN&gt;)


**&lt;SPAN class=""&gt;#web_map_items = gisP.content.search(query="", item_type="Web Map", max_items=10000)**&lt;/SPAN&gt;
**&lt;SPAN class=""&gt;#print(web_map_items)**&lt;/SPAN&gt;


&lt;SPAN class=""&gt;def&lt;/SPAN&gt; &lt;SPAN class=""&gt;find_maps_with_layer&lt;/SPAN&gt;(&lt;SPAN class=""&gt;lyr_to_find=&lt;SPAN class=""&gt;None&lt;/SPAN&gt;&lt;/SPAN&gt;):

    &lt;SPAN class=""&gt;from&lt;/SPAN&gt; arcgis.mapping &lt;SPAN class=""&gt;import&lt;/SPAN&gt; WebMap


    sitGis = {&lt;SPAN class=""&gt;"lonie"&lt;/SPAN&gt;:&lt;SPAN class=""&gt;1&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"bulbj"&lt;/SPAN&gt;:&lt;SPAN class=""&gt;1&lt;/SPAN&gt;}
    &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(sitGis)
    web_map_items = gisP.content.search(query=&lt;SPAN class=""&gt;""&lt;/SPAN&gt;, item_type=&lt;SPAN class=""&gt;"Web Map"&lt;/SPAN&gt;, max_items=&lt;SPAN class=""&gt;10000&lt;/SPAN&gt;)
    &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(web_map_items)
    &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(&lt;SPAN class=""&gt;f"Searching &lt;SPAN class=""&gt;{&lt;SPAN class=""&gt;len&lt;/SPAN&gt;(web_map_items)}&lt;/SPAN&gt; web maps"&lt;/SPAN&gt;)
    maps_with_layer = []
    &lt;SPAN class=""&gt;for&lt;/SPAN&gt; item &lt;SPAN class=""&gt;in&lt;/SPAN&gt; web_map_items:
        &lt;SPAN class=""&gt;if&lt;/SPAN&gt; item.owner &lt;SPAN class=""&gt;in&lt;/SPAN&gt; sitGis:
            wm = WebMap(item)
            lyrs = wm.layers
            &lt;SPAN class=""&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class=""&gt;in&lt;/SPAN&gt; lyrs:
                &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;hasattr&lt;/SPAN&gt;(lyr, &lt;SPAN class=""&gt;"url"&lt;/SPAN&gt;):
                    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; lyr_to_find == lyr.url:

                        &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;"layerDefinition"&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; lyr:
                            layerDefinition = lyr[&lt;SPAN class=""&gt;"layerDefinition"&lt;/SPAN&gt;]
                            &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;"drawingInfo"&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; layerDefinition:
                                drawingInfo = layerDefinition[&lt;SPAN class=""&gt;"drawingInfo"&lt;/SPAN&gt;]
                                &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;"renderer"&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; drawingInfo:

                                    renderer = drawingInfo[&lt;SPAN class=""&gt;"renderer"&lt;/SPAN&gt;]
                                    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;"uniqueValueInfos"&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; renderer:

                                        uniqueValueInfos = renderer[&lt;SPAN class=""&gt;"uniqueValueInfos"&lt;/SPAN&gt;]
                                        &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(&lt;SPAN class=""&gt;f'&lt;SPAN class=""&gt;{item.title}&lt;/SPAN&gt; contains the layer, &lt;SPAN class=""&gt;{uniqueValueInfos}&lt;/SPAN&gt;'&lt;/SPAN&gt;)

                                        &lt;SPAN class=""&gt;with&lt;/SPAN&gt; &lt;SPAN class=""&gt;open&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"maps_with_service_WETTBEWERBER_VERSCHIEBE_INT_UNIQEVALUS"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"a"&lt;/SPAN&gt;) &lt;SPAN class=""&gt;as&lt;/SPAN&gt; file:
                                            file.write(&lt;SPAN class=""&gt;f"&lt;SPAN class=""&gt;{item.title}&lt;/SPAN&gt;, &lt;SPAN class=""&gt;{item.&lt;SPAN class=""&gt;id&lt;/SPAN&gt;}&lt;/SPAN&gt;, &lt;SPAN class=""&gt;{item.owner}&lt;/SPAN&gt; \n"&lt;/SPAN&gt;)
                                            file.write(&lt;SPAN class=""&gt;f"\n"&lt;/SPAN&gt;)

                                        maps_with_layer.append(item)

    &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(&lt;SPAN class=""&gt;f"Found &lt;SPAN class=""&gt;{&lt;SPAN class=""&gt;len&lt;/SPAN&gt;(maps_with_layer)}&lt;/SPAN&gt; maps which contain the layer"&lt;/SPAN&gt;)
    &lt;SPAN class=""&gt;return&lt;/SPAN&gt; maps_with_layer


&lt;SPAN class=""&gt;# Parameters:&lt;/SPAN&gt;
lyr_to_find = &lt;SPAN class=""&gt;"https://maps-url.com/server/rest/services/WETTBEWERBER_V2/FeatureServer/0"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 07 Feb 2022 17:51:51 GMT</pubDate>
    <dc:creator>Aravinthkumar</dc:creator>
    <dc:date>2022-02-07T17:51:51Z</dc:date>
    <item>
      <title>Cannot access the feature layer from a web map using ArcGIS API Python</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/cannot-access-the-feature-layer-from-a-web-map/m-p/1141285#M7095</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;I am trying to get the specific feature layer from the web map from the Portal based on its unique values, but nothing is printed in the results, but there are the feature layers present in lot of the web maps, the print function before the function&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;def find_maps_with_layer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;works and prints the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;web_map_items, but inside the class nothing is working, I cannot figure out the mistake. What am I doing wrong ? Inside the function nothing is working. Any insights will be helpful. Thank you..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;from&lt;/SPAN&gt; arcgis &lt;SPAN class=""&gt;import&lt;/SPAN&gt; GIS



portalUrlP = https://maps-url/portal/
userP = &lt;SPAN class=""&gt;"user"&lt;/SPAN&gt;
passwordP = &lt;SPAN class=""&gt;"pass"&lt;/SPAN&gt;

gisP = GIS(url=portalUrlP, username=userP, password=passwordP, verify_cert=&lt;SPAN class=""&gt;False&lt;/SPAN&gt;)


**&lt;SPAN class=""&gt;#web_map_items = gisP.content.search(query="", item_type="Web Map", max_items=10000)**&lt;/SPAN&gt;
**&lt;SPAN class=""&gt;#print(web_map_items)**&lt;/SPAN&gt;


&lt;SPAN class=""&gt;def&lt;/SPAN&gt; &lt;SPAN class=""&gt;find_maps_with_layer&lt;/SPAN&gt;(&lt;SPAN class=""&gt;lyr_to_find=&lt;SPAN class=""&gt;None&lt;/SPAN&gt;&lt;/SPAN&gt;):

    &lt;SPAN class=""&gt;from&lt;/SPAN&gt; arcgis.mapping &lt;SPAN class=""&gt;import&lt;/SPAN&gt; WebMap


    sitGis = {&lt;SPAN class=""&gt;"lonie"&lt;/SPAN&gt;:&lt;SPAN class=""&gt;1&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"bulbj"&lt;/SPAN&gt;:&lt;SPAN class=""&gt;1&lt;/SPAN&gt;}
    &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(sitGis)
    web_map_items = gisP.content.search(query=&lt;SPAN class=""&gt;""&lt;/SPAN&gt;, item_type=&lt;SPAN class=""&gt;"Web Map"&lt;/SPAN&gt;, max_items=&lt;SPAN class=""&gt;10000&lt;/SPAN&gt;)
    &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(web_map_items)
    &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(&lt;SPAN class=""&gt;f"Searching &lt;SPAN class=""&gt;{&lt;SPAN class=""&gt;len&lt;/SPAN&gt;(web_map_items)}&lt;/SPAN&gt; web maps"&lt;/SPAN&gt;)
    maps_with_layer = []
    &lt;SPAN class=""&gt;for&lt;/SPAN&gt; item &lt;SPAN class=""&gt;in&lt;/SPAN&gt; web_map_items:
        &lt;SPAN class=""&gt;if&lt;/SPAN&gt; item.owner &lt;SPAN class=""&gt;in&lt;/SPAN&gt; sitGis:
            wm = WebMap(item)
            lyrs = wm.layers
            &lt;SPAN class=""&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class=""&gt;in&lt;/SPAN&gt; lyrs:
                &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;hasattr&lt;/SPAN&gt;(lyr, &lt;SPAN class=""&gt;"url"&lt;/SPAN&gt;):
                    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; lyr_to_find == lyr.url:

                        &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;"layerDefinition"&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; lyr:
                            layerDefinition = lyr[&lt;SPAN class=""&gt;"layerDefinition"&lt;/SPAN&gt;]
                            &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;"drawingInfo"&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; layerDefinition:
                                drawingInfo = layerDefinition[&lt;SPAN class=""&gt;"drawingInfo"&lt;/SPAN&gt;]
                                &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;"renderer"&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; drawingInfo:

                                    renderer = drawingInfo[&lt;SPAN class=""&gt;"renderer"&lt;/SPAN&gt;]
                                    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;"uniqueValueInfos"&lt;/SPAN&gt; &lt;SPAN class=""&gt;in&lt;/SPAN&gt; renderer:

                                        uniqueValueInfos = renderer[&lt;SPAN class=""&gt;"uniqueValueInfos"&lt;/SPAN&gt;]
                                        &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(&lt;SPAN class=""&gt;f'&lt;SPAN class=""&gt;{item.title}&lt;/SPAN&gt; contains the layer, &lt;SPAN class=""&gt;{uniqueValueInfos}&lt;/SPAN&gt;'&lt;/SPAN&gt;)

                                        &lt;SPAN class=""&gt;with&lt;/SPAN&gt; &lt;SPAN class=""&gt;open&lt;/SPAN&gt;(&lt;SPAN class=""&gt;"maps_with_service_WETTBEWERBER_VERSCHIEBE_INT_UNIQEVALUS"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"a"&lt;/SPAN&gt;) &lt;SPAN class=""&gt;as&lt;/SPAN&gt; file:
                                            file.write(&lt;SPAN class=""&gt;f"&lt;SPAN class=""&gt;{item.title}&lt;/SPAN&gt;, &lt;SPAN class=""&gt;{item.&lt;SPAN class=""&gt;id&lt;/SPAN&gt;}&lt;/SPAN&gt;, &lt;SPAN class=""&gt;{item.owner}&lt;/SPAN&gt; \n"&lt;/SPAN&gt;)
                                            file.write(&lt;SPAN class=""&gt;f"\n"&lt;/SPAN&gt;)

                                        maps_with_layer.append(item)

    &lt;SPAN class=""&gt;print&lt;/SPAN&gt;(&lt;SPAN class=""&gt;f"Found &lt;SPAN class=""&gt;{&lt;SPAN class=""&gt;len&lt;/SPAN&gt;(maps_with_layer)}&lt;/SPAN&gt; maps which contain the layer"&lt;/SPAN&gt;)
    &lt;SPAN class=""&gt;return&lt;/SPAN&gt; maps_with_layer


&lt;SPAN class=""&gt;# Parameters:&lt;/SPAN&gt;
lyr_to_find = &lt;SPAN class=""&gt;"https://maps-url.com/server/rest/services/WETTBEWERBER_V2/FeatureServer/0"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 07 Feb 2022 17:51:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/cannot-access-the-feature-layer-from-a-web-map/m-p/1141285#M7095</guid>
      <dc:creator>Aravinthkumar</dc:creator>
      <dc:date>2022-02-07T17:51:51Z</dc:date>
    </item>
  </channel>
</rss>

