zoomToSelectedFeatures () scale differences 'CURRENT' and 'mxd_path'

3694
1
Jump to solution
11-20-2015 10:43 AM
by Anonymous User
Not applicable

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.

1 Solution

Accepted Solutions
FreddieGibson
Occasional Contributor III

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

full.png

Scale at half screen

half.png

View solution in original post

0 Kudos
1 Reply
FreddieGibson
Occasional Contributor III

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

full.png

Scale at half screen

half.png

0 Kudos