AnsweredAssumed Answered

Move Map in Cardinal Directions

Question asked by jsmith0705 on Aug 13, 2013
Latest reply on Aug 14, 2013 by jsmith0705
I want to move the map by entering the distance.  For example, I want to move the data frame 5 Feet North.  I am using an if elif else statment to provide a statement that moves the map.  The script returns no errors.  I do not want to use df.extent = lyr.getSelectedExtent(), because it zooms to full extent.  I want to be able to move the map.  Similiar to using a pan, but by entering a specific distance in cardinal directions.

import arcpy, os, sys  mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] lyr = arcpy.mapping.ListLayers(mxd, df)[0]  North = arcpy.GetParameterAsText(0) South = arcpy.GetParameterAsText(1) East = arcpy.GetParameterAsText(2) West = arcpy.GetParameterAsText(3)  if North > 0:  whereClause = ''' "North" = '{0}' AND "South" = '{1}' AND "East" = '{2}' AND "West" = '{3}' '''.format(North, South, East, West) elif South > 0:  whereClause = ''' "North" = '{0}' AND "South" = '{1}' AND "East" = '{2}' AND "West" = '{3}' '''.format(North, South, East, West) elif East > 0:  whereClause = ''' "North" = '{0}' AND "South" = '{1}' AND "East" = '{2}' AND "West" = '{3}' '''.format(North, South, East, West) elif West > 0:  whereClause = ''' "North" = '{0}' AND "South" = '{1}' AND "East" = '{2}' AND "West" = '{3}' '''.format(North, South, East, West) else:  whereClause = ''' "North" = '{0}' AND "South" = '{1}' AND "East" = '{2}' AND "West" = '{3}' '''.format(North, South, East, West)

Outcomes