<?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: ArcGIS Python API zoom_to_layer() attribute error in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-python-api-zoom-to-layer-attribute-error/m-p/878129#M5012</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/417345"&gt;Tracy Whelen&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;I just checked the ArcGIS API for Python V1.6.1 in the following link:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-python-api/releases/tag/v1.6.1" title="https://github.com/Esri/arcgis-python-api/releases/tag/v1.6.1"&gt;Release v1.6.1 · Esri/arcgis-python-api · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The file is downloadable, you can download and check it for yourself. The equivalent&amp;nbsp;notebook file for this link (&lt;A href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdevelopers.arcgis.com%2Fpython%2Fguide%2Fusing-the-map-widget%2F" rel="nofollow" style="color: #2989c5; background-color: #ffffff; border: 0px; text-decoration: none; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;other Esri tutorials&lt;/A&gt;) is&lt;SPAN class="" style="color: #000000; background-color: #ffffff; border: none; font-size: 19.045px; margin-left: 16px;"&gt;using-the-map-widget.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;It looks like&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;zoom_to_layer&amp;nbsp; is&amp;nbsp;not available for this version.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I hope that helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Aug 2020 15:39:10 GMT</pubDate>
    <dc:creator>MehdiPira1</dc:creator>
    <dc:date>2020-08-10T15:39:10Z</dc:date>
    <item>
      <title>ArcGIS Python API zoom_to_layer() attribute error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-python-api-zoom-to-layer-attribute-error/m-p/878128#M5011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working with the ArcGIS API for Python mapping widget within the ArcGIS jupyter notebook environment. I've successfully connected to my organization's enterprise portal, grabbed content, mapped it, and set the zoom level manually (see code below). The problem is when I&amp;nbsp;try&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to zoom to the added layer, at which point I receive the error:&lt;/P&gt;&lt;P style="color: #000000; background-color: #ffffff; border: 0px; font-size: 14px; padding: 1px 0px;"&gt;&lt;SPAN class="" style="color: #b22b31; font-weight: bold;"&gt;AttributeError&lt;/SPAN&gt;: 'MapView' object has no attribute 'zoom_to_layer'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.widgets.html" style="color: #2989c5; text-decoration: none;"&gt;arcgis.widgets documentation page&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and all&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/python/guide/using-the-map-widget/" style="color: #2989c5; text-decoration: none;"&gt;other Esri tutorials&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I've seen zoom_to_layer() exists and I'm using the correct syntax, of "map.zoom_to_layer(layer)".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only thing I can think of is that since my installation of the API is what comes with ArcGIS 10.7.1 (API version 1.6.1) whereas all the online API documentation pages are for version 1.8.2. Is zoom_to_layer() functionality that has been implemented between those two versions? Or can anyone else think of reasons why this might be erroring?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;gis = GIS("portal_url", username="my_username")&lt;/P&gt;&lt;P&gt;contentItem = gis.content.get('content_string')&lt;/P&gt;&lt;P&gt;contentLayer = contentItem.layers[0]&lt;/P&gt;&lt;P&gt;m = gis.map()&lt;/P&gt;&lt;P&gt;m.add_layer(contentLayer)&lt;/P&gt;&lt;P&gt;m.zoom_to_layer(contentLayer) #this errors&lt;/P&gt;&lt;P&gt;# m.zoom = 14 #this works fine&lt;/P&gt;&lt;P&gt;m&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2020 13:28:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-python-api-zoom-to-layer-attribute-error/m-p/878128#M5011</guid>
      <dc:creator>TracyWhelen</dc:creator>
      <dc:date>2020-08-10T13:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Python API zoom_to_layer() attribute error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-python-api-zoom-to-layer-attribute-error/m-p/878129#M5012</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/417345"&gt;Tracy Whelen&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;I just checked the ArcGIS API for Python V1.6.1 in the following link:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-python-api/releases/tag/v1.6.1" title="https://github.com/Esri/arcgis-python-api/releases/tag/v1.6.1"&gt;Release v1.6.1 · Esri/arcgis-python-api · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The file is downloadable, you can download and check it for yourself. The equivalent&amp;nbsp;notebook file for this link (&lt;A href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdevelopers.arcgis.com%2Fpython%2Fguide%2Fusing-the-map-widget%2F" rel="nofollow" style="color: #2989c5; background-color: #ffffff; border: 0px; text-decoration: none; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;other Esri tutorials&lt;/A&gt;) is&lt;SPAN class="" style="color: #000000; background-color: #ffffff; border: none; font-size: 19.045px; margin-left: 16px;"&gt;using-the-map-widget.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;It looks like&amp;nbsp;&amp;nbsp;&lt;SPAN class=""&gt;zoom_to_layer&amp;nbsp; is&amp;nbsp;not available for this version.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I hope that helps.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2020 15:39:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-python-api-zoom-to-layer-attribute-error/m-p/878129#M5012</guid>
      <dc:creator>MehdiPira1</dc:creator>
      <dc:date>2020-08-10T15:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Python API zoom_to_layer() attribute error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-python-api-zoom-to-layer-attribute-error/m-p/878130#M5013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mehdi! That was helpful confirmation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2020 16:22:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-python-api-zoom-to-layer-attribute-error/m-p/878130#M5013</guid>
      <dc:creator>TracyWhelen</dc:creator>
      <dc:date>2020-08-10T16:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Python API zoom_to_layer() attribute error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-python-api-zoom-to-layer-attribute-error/m-p/878131#M5014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tracy, it seems like your question has been answered.&amp;nbsp; Please mark a reply correct to close out this question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2020 16:25:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/arcgis-python-api-zoom-to-layer-attribute-error/m-p/878131#M5014</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-08-10T16:25:12Z</dc:date>
    </item>
  </channel>
</rss>

