<?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 Re: Count cars script not working, KeyError: 'layers' in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/count-cars-script-not-working-keyerror-layers/m-p/1409610#M70309</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/417766"&gt;@Clubdebambos&lt;/a&gt;&amp;nbsp;I'm running exactly the same code that is provided in the link, with no changes. I also&amp;nbsp;&lt;SPAN&gt;published my layers as imagery layers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here's what &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;imagery = gis.content.search("aerial*")&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;print(imagery) &lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;returns (I loaded 4 layers and 4 these layers are displayed):&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;[&amp;lt;Item title:"aerial3" type:Image owner:MICGis&amp;gt;, &amp;lt;Item title:"aerial1" type:Image owner:MICGis&amp;gt;, &amp;lt;Item title:"aerial4" type:Image owner:MICGis&amp;gt;, &amp;lt;Item title:"aerial2" type:Image owner:MICGis&amp;gt;]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Apr 2024 07:04:50 GMT</pubDate>
    <dc:creator>DavideBoazzi</dc:creator>
    <dc:date>2024-04-15T07:04:50Z</dc:date>
    <item>
      <title>Count cars script not working, KeyError: 'layers'</title>
      <link>https://community.esri.com/t5/python-questions/count-cars-script-not-working-keyerror-layers/m-p/1408906#M70297</link>
      <description>&lt;P data-unlink="true"&gt;I'm running this &lt;A href="https://developers.arcgis.com/python/samples/count-cars-in-aerial-imagery-using-deep-learning/" target="_self"&gt;count cars in aerial imagery script&lt;/A&gt;&amp;nbsp; and&amp;nbsp;everything seems to be working until I run the detection block. It says KeyError: 'layers'. How to fix this?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DavideBoazzi_0-1712910340126.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100775i64CBDB8D11B6D42D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DavideBoazzi_0-1712910340126.png" alt="DavideBoazzi_0-1712910340126.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 08:28:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-cars-script-not-working-keyerror-layers/m-p/1408906#M70297</guid>
      <dc:creator>DavideBoazzi</dc:creator>
      <dc:date>2024-04-12T08:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: Count cars script not working, KeyError: 'layers'</title>
      <link>https://community.esri.com/t5/python-questions/count-cars-script-not-working-keyerror-layers/m-p/1409379#M70303</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/751749"&gt;@DavideBoazzi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are missing important steps in your script, can you post the entire code before you get the error?&lt;/P&gt;&lt;P&gt;In the example you are following, the imagery variable is a list containing four Image Layer item objects. Your script is assuming that imagery[i] (one of these Image Layer objects) has a property called layers. Make sure your imagery list is indeed a list of Imagery Layers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you print(imagery), is a list of Imagery Layer Item objects returned?&lt;/P&gt;</description>
      <pubDate>Sun, 14 Apr 2024 07:04:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-cars-script-not-working-keyerror-layers/m-p/1409379#M70303</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-04-14T07:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Count cars script not working, KeyError: 'layers'</title>
      <link>https://community.esri.com/t5/python-questions/count-cars-script-not-working-keyerror-layers/m-p/1409610#M70309</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/417766"&gt;@Clubdebambos&lt;/a&gt;&amp;nbsp;I'm running exactly the same code that is provided in the link, with no changes. I also&amp;nbsp;&lt;SPAN&gt;published my layers as imagery layers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here's what &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;imagery = gis.content.search("aerial*")&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;print(imagery) &lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;returns (I loaded 4 layers and 4 these layers are displayed):&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;[&amp;lt;Item title:"aerial3" type:Image owner:MICGis&amp;gt;, &amp;lt;Item title:"aerial1" type:Image owner:MICGis&amp;gt;, &amp;lt;Item title:"aerial4" type:Image owner:MICGis&amp;gt;, &amp;lt;Item title:"aerial2" type:Image owner:MICGis&amp;gt;]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 07:04:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-cars-script-not-working-keyerror-layers/m-p/1409610#M70309</guid>
      <dc:creator>DavideBoazzi</dc:creator>
      <dc:date>2024-04-15T07:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Count cars script not working, KeyError: 'layers'</title>
      <link>https://community.esri.com/t5/python-questions/count-cars-script-not-working-keyerror-layers/m-p/1410110#M70319</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/751749"&gt;@DavideBoazzi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Your Item type says Image, not Imagery Layer like in the example.&lt;/P&gt;&lt;P&gt;Do your items in ArcGIS Online say Imagery Layer like below?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clubdebambos_0-1713258474108.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100990i31D7744E6FE5B8B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Clubdebambos_0-1713258474108.png" alt="Clubdebambos_0-1713258474108.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This type of Image content item will not work.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clubdebambos_2-1713261331474.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100993iA50F5CE7F1A30D4A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clubdebambos_2-1713261331474.png" alt="Clubdebambos_2-1713261331474.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There is a difference between an Image&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clubdebambos_0-1713260712505.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100991i0667B116DC78BA48/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clubdebambos_0-1713260712505.png" alt="Clubdebambos_0-1713260712505.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and an Imagery Layer which is an Image Service&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clubdebambos_1-1713260874227.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/100992i0F14421A9341CE01/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clubdebambos_1-1713260874227.png" alt="Clubdebambos_1-1713260874227.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Source:&amp;nbsp;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/items-and-item-types.htm" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/rest/users-groups-and-items/items-and-item-types.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 09:55:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/count-cars-script-not-working-keyerror-layers/m-p/1410110#M70319</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-04-16T09:55:51Z</dc:date>
    </item>
  </channel>
</rss>

