<?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 Add multiple layers to a Map Python Api in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-multiple-layers-to-a-map-python-api/m-p/817908#M2735</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;item1 = gis.content.search(query = "title:HSF",item_type='Feature Layer', max_items=1000,)
display(item1)

item2 = gis.content.search(query = "title:xxxxxxxxx",item_type='Web Map', max_items=1000,)
display(item2)
wm_item = item2[0]
from arcgis.mapping import WebMap
web_map_obj = WebMap(wm_item)
for item in item1:
 web_map_obj.add_layer(item)&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;See above code can anyone tell me what i need to specify to get every item in the list item 1 added to the Map. it iterates through the list but only adds the first feature over and over.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:40:38 GMT</pubDate>
    <dc:creator>PaulSweeney3</dc:creator>
    <dc:date>2021-12-12T09:40:38Z</dc:date>
    <item>
      <title>Add multiple layers to a Map Python Api</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-multiple-layers-to-a-map-python-api/m-p/817908#M2735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;item1 = gis.content.search(query = "title:HSF",item_type='Feature Layer', max_items=1000,)
display(item1)

item2 = gis.content.search(query = "title:xxxxxxxxx",item_type='Web Map', max_items=1000,)
display(item2)
wm_item = item2[0]
from arcgis.mapping import WebMap
web_map_obj = WebMap(wm_item)
for item in item1:
 web_map_obj.add_layer(item)&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;See above code can anyone tell me what i need to specify to get every item in the list item 1 added to the Map. it iterates through the list but only adds the first feature over and over.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:40:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-multiple-layers-to-a-map-python-api/m-p/817908#M2735</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2021-12-12T09:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Add multiple layers to a Map Python Api</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-multiple-layers-to-a-map-python-api/m-p/817909#M2736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/303700" target="_blank"&gt;Paul Sweeney&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;The code needs some tweaks to get it working.&lt;/P&gt;&lt;P&gt;First you can limit the number of max_items down to 4 or 5 to speed up the process. Once it gets to work you can increase the number.&lt;/P&gt;&lt;P&gt;Second I recommend using gis.map() instead of WebMap().&lt;/P&gt;&lt;P&gt;The code will be something like below:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;item1 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;search&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"title:HSF"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;item_type&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Feature Layer'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; max_items&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; item &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; item1&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    display&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;
item2 &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;search&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"title:xxxxxxxxx"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;item_type&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Web Map'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; max_items&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1000&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
wm_item &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; item2&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
web_map_obj &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;map&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;wm_item&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
web_map_obj
&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; item &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; item1&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
   web_map_obj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;add_layer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;item&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Run each block (delineated by =======) on a separate cell in notebook to have a better check.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:40:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-multiple-layers-to-a-map-python-api/m-p/817909#M2736</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2021-12-12T09:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Add multiple layers to a Map Python Api</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-multiple-layers-to-a-map-python-api/m-p/817910#M2737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mehdi thats worked now, just so i know why has this not worked for me was it simply down to the fact i&amp;nbsp;used&amp;nbsp;&lt;SPAN style="background-color: #edf8ca;"&gt;WebMap() .&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2020 10:09:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-multiple-layers-to-a-map-python-api/m-p/817910#M2737</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2020-08-11T10:09:42Z</dc:date>
    </item>
  </channel>
</rss>

