AnsweredAssumed Answered

arcpy.mapping export not behaving as expected

Question asked by ucabks0 on Dec 1, 2016
Latest reply on Dec 1, 2016 by ucabks0

Hi,

 

I was running arcpy.mapping tools and noted different behaviour running inside ArcMap python window and outside of it. The following is the partial code extract.

mxd = arcpy.mapping.MapDocument(mxdLocation)
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd,data_frame=df)[0]
currentLyrExtent=lyr.getExtent()  
df.extent = currentLyrExtent
currentLyrName=lyr.name
arcpy.RefreshActiveView()
arcpy.mapping.ExportToPNG(mxd,currentLyrName+".png","PAGE_LAYOUT")

 

This is the exported image after running in ArcMap Python window. Looks ok.

 

 

 

 

 

 

 

 

 

 

 

This is the exported image after running outside of ArcMap. The image only fills up 1/4 of the whole image frame.

What could be wrong?

Outcomes