<?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: Is there a Zoom to Layer command in Python? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/is-there-a-zoom-to-layer-command-in-python/m-p/739997#M57243</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can get the extent of the layer and apply it to the data frame:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; mxd = arcpy.mapping.MapDocument('current') # using current map, can also use a path to a mxd here
&amp;gt;&amp;gt;&amp;gt; df = arcpy.mapping.ListDataFrames(mxd)[0]
&amp;gt;&amp;gt;&amp;gt; lyr = arcpy.mapping.ListLayers(mxd, 'U.S. States*', df)[0]
&amp;gt;&amp;gt;&amp;gt; ext = lyr.getExtent()
&amp;gt;&amp;gt;&amp;gt; df.extent = ext&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 07:30:01 GMT</pubDate>
    <dc:creator>JeffMoulds</dc:creator>
    <dc:date>2021-12-12T07:30:01Z</dc:date>
    <item>
      <title>Is there a Zoom to Layer command in Python?</title>
      <link>https://community.esri.com/t5/python-questions/is-there-a-zoom-to-layer-command-in-python/m-p/739995#M57241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'd like to be able to add a layer to a mxd, this layer changes weekly (crime points) so I'd like to be able to zoom to the layer but &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I can't find a command to do it.&amp;nbsp; Is there a command to Zoom to Layer?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 14:08:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-there-a-zoom-to-layer-command-in-python/m-p/739995#M57241</guid>
      <dc:creator>MichaelRivera</dc:creator>
      <dc:date>2013-02-20T14:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a Zoom to Layer command in Python?</title>
      <link>https://community.esri.com/t5/python-questions/is-there-a-zoom-to-layer-command-in-python/m-p/739996#M57242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;see zoomToSelectedFeatures () in the arcpy mapping module&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s300000003000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s300000003000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 14:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-there-a-zoom-to-layer-command-in-python/m-p/739996#M57242</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2013-02-20T14:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a Zoom to Layer command in Python?</title>
      <link>https://community.esri.com/t5/python-questions/is-there-a-zoom-to-layer-command-in-python/m-p/739997#M57243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can get the extent of the layer and apply it to the data frame:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; mxd = arcpy.mapping.MapDocument('current') # using current map, can also use a path to a mxd here
&amp;gt;&amp;gt;&amp;gt; df = arcpy.mapping.ListDataFrames(mxd)[0]
&amp;gt;&amp;gt;&amp;gt; lyr = arcpy.mapping.ListLayers(mxd, 'U.S. States*', df)[0]
&amp;gt;&amp;gt;&amp;gt; ext = lyr.getExtent()
&amp;gt;&amp;gt;&amp;gt; df.extent = ext&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:30:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/is-there-a-zoom-to-layer-command-in-python/m-p/739997#M57243</guid>
      <dc:creator>JeffMoulds</dc:creator>
      <dc:date>2021-12-12T07:30:01Z</dc:date>
    </item>
  </channel>
</rss>

