<?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: Move Map in Cardinal Directions in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228657#M17735</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was thinking of using arcpy.mapping to control a closed mxd.&amp;nbsp; for real time pan of the display, this is that language (at least for the dataframe named "Layers"):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument("CURRENT")&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] newExtent = df.extent newExtent.XMin = df.extent.XMin + deltaX newExtent.YMin = df.extent.YMin + deltaY newExtent.XMax = df.extent.XMax + deltaX newExtent.YMax = df.extent.YMax + deltaY df.panToExtent(newExtent) arcpy.RefreshActiveView() &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if you pass it a positive value for deltaY, it will pan the display north by the entered value (in map units), negative will shift south&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if you pass it a positive value for deltaX, it will pan the display East by the entered value (in map units), negative will shift west&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Aug 2013 15:51:40 GMT</pubDate>
    <dc:creator>RhettZufelt</dc:creator>
    <dc:date>2013-08-14T15:51:40Z</dc:date>
    <item>
      <title>Move Map in Cardinal Directions</title>
      <link>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228650#M17728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want to move the map by entering the distance.&amp;nbsp; For example, I want to move the data frame 5 Feet North.&amp;nbsp; I am using an if elif else statment to provide a statement that moves the map.&amp;nbsp; The script returns no errors.&amp;nbsp; I do not want to use df.extent = lyr.getSelectedExtent(), because it zooms to full extent.&amp;nbsp; I want to be able to move the map.&amp;nbsp; Similiar to using a pan, but by entering a specific distance in cardinal directions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy, os, sys&amp;nbsp; mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] lyr = arcpy.mapping.ListLayers(mxd, df)[0]&amp;nbsp; North = arcpy.GetParameterAsText(0) South = arcpy.GetParameterAsText(1) East = arcpy.GetParameterAsText(2) West = arcpy.GetParameterAsText(3)&amp;nbsp; if North &amp;gt; 0:&amp;nbsp; whereClause = ''' "North" = '{0}' AND "South" = '{1}' AND "East" = '{2}' AND "West" = '{3}' '''.format(North, South, East, West) elif South &amp;gt; 0:&amp;nbsp; whereClause = ''' "North" = '{0}' AND "South" = '{1}' AND "East" = '{2}' AND "West" = '{3}' '''.format(North, South, East, West) elif East &amp;gt; 0:&amp;nbsp; whereClause = ''' "North" = '{0}' AND "South" = '{1}' AND "East" = '{2}' AND "West" = '{3}' '''.format(North, South, East, West) elif West &amp;gt; 0:&amp;nbsp; whereClause = ''' "North" = '{0}' AND "South" = '{1}' AND "East" = '{2}' AND "West" = '{3}' '''.format(North, South, East, West) else:&amp;nbsp; whereClause = ''' "North" = '{0}' AND "South" = '{1}' AND "East" = '{2}' AND "West" = '{3}' '''.format(North, South, East, West)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 13:50:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228650#M17728</guid>
      <dc:creator>JamesSmith7</dc:creator>
      <dc:date>2013-08-13T13:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: Move Map in Cardinal Directions</title>
      <link>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228651#M17729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I cannot see what you are hoping to do with your code that will modify the map extent in any way at all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;... for a start,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The if, elif, else set is very odd, it rather reads like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if the sea is blue, do this&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;or if the sand is white, do the same thing&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;or if it rains in Spain, do it anyway&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the tests are not really exclusive... and the outcomes rather similar.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are also applying a math test (greater than) to a string variable (as is returned by GetParameterAsText()).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 14:44:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228651#M17729</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2013-08-13T14:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: Move Map in Cardinal Directions</title>
      <link>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228652#M17730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can't modify the extent object directly.&amp;nbsp; Once you figure out where you want to move it, you will need to make a copy of the extent object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From the docs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Provides the ability to get or set the data frame's map extent using map coordinates (i.e., map units). A copy of the Extent object must be made before modifying its properties. The modified copy is then used to set the new extent properties. Note: If you try to set the extent by simply referencing the Extent object, changes won't be saved. For example, df.extent.xMin = some value won't work.&lt;BR /&gt;&lt;BR /&gt;If the aspect ratio of the extent does not match the shape of the data frame, the final extent will be adjusted to fit the new extent within the shape of the data frame. In other words, if you set explicit X, Y coordinates, you may not get the same values returned if you attempt to read them later.&lt;BR /&gt;&lt;BR /&gt;Note: The properties of the Extent object are by default read-only in the help system. A special exception was made for the arcpy.mapping scripting environment to enable changing extents during a map automation process.&lt;BR /&gt;&lt;BR /&gt;df = arcpy.mapping.ListDataFrames(mxd)[0]&lt;BR /&gt;newExtent = df.extent&lt;BR /&gt;newExtent.XMin, newExtent.YMin = -180.0, -90.0&lt;BR /&gt;newExtent.XMax, newExtent.YMax = 180.0, 90.0&lt;BR /&gt;df.extent = newExtent&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt; from here:&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000003000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000003000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Should be able to shift the Ymin Ymax by 5 feet north.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 14:56:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228652#M17730</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-08-13T14:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Move Map in Cardinal Directions</title>
      <link>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228653#M17731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You can't modify the extent object directly.&amp;nbsp; Once you figure out where you want to move it, you will need to make a copy of the extent object.&lt;BR /&gt;&lt;BR /&gt;From the docs:&lt;BR /&gt;&lt;BR /&gt; from here:&amp;nbsp; &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000003000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000003000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Should be able to shift the Ymin Ymax by 5 feet north.&lt;BR /&gt;&lt;BR /&gt;R_&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, I was struggling to find similiar questions or documentation.&amp;nbsp; I will attempt to modify my script.&amp;nbsp; But, I want the ability to move the map(after I read the info provided in the link) N, S, E, or W and by any distance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2013 14:58:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228653#M17731</guid>
      <dc:creator>JamesSmith7</dc:creator>
      <dc:date>2013-08-13T14:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Move Map in Cardinal Directions</title>
      <link>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228654#M17732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just to clarify:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are suggesting using the following as a variable.&amp;nbsp; Then, setting up the if statement?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;df = arcpy.mapping.ListDataFrames(mxd)[0]
newExtent = df.extent
newExtent.XMin, newExtent.YMin = -180.0, -90.0
newExtent.XMax, newExtent.YMax = 180.0, 90.0
df.extent = newExtent&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:07:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228654#M17732</guid>
      <dc:creator>JamesSmith7</dc:creator>
      <dc:date>2021-12-11T11:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Move Map in Cardinal Directions</title>
      <link>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228655#M17733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nope.&amp;nbsp; Just saying that is how you would shift the dataframe once you know how far you want to move it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My data is in State Plane meters, so the output of my df.extent(s) are:&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; df.extent.YMin
150602.61868704704
&amp;gt;&amp;gt;&amp;gt; df.extent.YMax
152774.79701295635
&amp;gt;&amp;gt;&amp;gt; &lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
## So, after you have done whatever if statements you need to determine how far to shift it, you use the code.

if MyShiftNorthTest == true:
&amp;nbsp; deltaY = 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # this is my variable set to 5 "map units" that I want to shift my extent North

if MyShiftEastTest == true:
&amp;nbsp; deltaX = 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # this is my variable set to 5 "map units" that I want to shift my extent East

##Then&amp;nbsp; (and I'll break it up to read it more easily):


df = arcpy.mapping.ListDataFrames(mxd)[0]
newExtent = df.extent
newExtent.XMin = df.extent.XMin + deltaX
newExtent.YMin = df.extent.YMin + deltaY
newExtent.XMax = df.extent.XMax + deltaX
newExtent.YMax = df.extent.YMax + deltaY
df.extent = newExtent
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, since my map units are meters,&amp;nbsp; that would shift my extent north and/or east by 5 meters.&amp;nbsp; If I pass it a negative value, would shift the other way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:07:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228655#M17733</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2021-12-11T11:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Move Map in Cardinal Directions</title>
      <link>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228656#M17734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How far to move the data frame will vary.&amp;nbsp; I want to use the script similiar to the pan tool.&amp;nbsp; Except you are able to enter a value and the map moves, based on the value entered.&amp;nbsp; Are we speaking the same language? :confused:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2013 15:14:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228656#M17734</guid>
      <dc:creator>JamesSmith7</dc:creator>
      <dc:date>2013-08-14T15:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Move Map in Cardinal Directions</title>
      <link>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228657#M17735</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was thinking of using arcpy.mapping to control a closed mxd.&amp;nbsp; for real time pan of the display, this is that language (at least for the dataframe named "Layers"):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp; mxd = arcpy.mapping.MapDocument("CURRENT")&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] newExtent = df.extent newExtent.XMin = df.extent.XMin + deltaX newExtent.YMin = df.extent.YMin + deltaY newExtent.XMax = df.extent.XMax + deltaX newExtent.YMax = df.extent.YMax + deltaY df.panToExtent(newExtent) arcpy.RefreshActiveView() &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if you pass it a positive value for deltaY, it will pan the display north by the entered value (in map units), negative will shift south&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if you pass it a positive value for deltaX, it will pan the display East by the entered value (in map units), negative will shift west&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;R_&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2013 15:51:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228657#M17735</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2013-08-14T15:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Move Map in Cardinal Directions</title>
      <link>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228658#M17736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I was thinking of using arcpy.mapping to control a closed mxd.&amp;nbsp; for real time pan of the display, this is that language (at least for the dataframe named "Layers"):&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;



mxd = arcpy.mapping.MapDocument("CURRENT")

df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
newExtent = df.extent
newExtent.XMin = df.extent.XMin + deltaX
newExtent.YMin = df.extent.YMin + deltaY
newExtent.XMax = df.extent.XMax + deltaX
newExtent.YMax = df.extent.YMax + deltaY
df.panToExtent(newExtent)
arcpy.RefreshActiveView()

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;if you pass it a positive value for deltaY, it will pan the display north by the entered value (in map units), negative will shift south&lt;BR /&gt;if you pass it a positive value for deltaX, it will pan the display East by the entered value (in map units), negative will shift west&lt;BR /&gt;&lt;BR /&gt;R_&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I had in mind.&amp;nbsp; I was unaware of which tool and function would accomplish the job.&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:07:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/move-map-in-cardinal-directions/m-p/228658#M17736</guid>
      <dc:creator>JamesSmith7</dc:creator>
      <dc:date>2021-12-11T11:07:16Z</dc:date>
    </item>
  </channel>
</rss>

