I encountered a problem that zoomToSelectedFeatures() works differently in ArcMap and using ArcPy explicitly in another Python editor having the exact same dataset (one point layer in the data frame) in the MXD file. I tested the same code except MXD path ('CURRENT' in ArcMap) and got different scales. 1:2,167 in ArcMap and 1: 4,053 using ArcPy in another Python editor. I couldn't figure out what was causing the problem. I would very much appreciate any assistance.
mxd = arcpy.mapping.MapDocument(mxd_path) df = arcpy.mapping.ListDataFrames(mxd, 'Layers')[0] df.zoomToSelectedFeatures() print df.scale
Thank you.
Solved! Go to Solution.
This is probably going to be due to the size of the display for the map. When you have ArcMap open the map will possibly be a different size than when you're accessing it remotely. As the size of the map being rendered increases or decreases the scale will change. To show this I've taken screenshots of the sample map document on my machine.
Scale at full screen
Scale at half screen
This is probably going to be due to the size of the display for the map. When you have ArcMap open the map will possibly be a different size than when you're accessing it remotely. As the size of the map being rendered increases or decreases the scale will change. To show this I've taken screenshots of the sample map document on my machine.
Scale at full screen
Scale at half screen