simon.law

ArcGIS 10.0 - Arcpy Map Export: how to get the actual maextent in the exported image?

Discussion created by simon.law on Feb 24, 2014
Latest reply on Feb 26, 2014 by jbarrette-esristaff
Environment:
ArcGIS 10.0

As v10 doesn't have out-of-box printing service, we are developing a simple one to export map layers to image (JPEG). The service is called in web browser.

Input params:
XMin, YMin, XMax, YMax, Scale, requiredImageWidth, requiredImageHeight

Output params:
image url
exported image extent(XMin, YMin, XMax, YMax)

sample code:
#configuration params
config.mxdTemplate = "test.mxd"


# Get the map document template
mapDoc = arcpy.mapping.MapDocument(config.mxdTemplate)

# Get data frame
dataFrames = arcpy.mapping.ListDataFrames(mapDoc)
dataFrame = dataFrames[0]

# Set map extent
newExt = dataFrame.extent
newExt.XMin = xMin
newExt.XMax = xMax
newExt.YMin = yMin
newExt.YMax = yMax
dataFrame.extent = newExt
dataFrame.scale = scale

#export
arcpy.mapping.ExportToJPEG(mapDoc, outputJpgPath,
                        data_frame=dataFrame,
                        df_export_width=inputImageWidth,
                        df_export_height=inputImageHeight)


so far the service has successfully exported map to JPEG file;

but what is the way to get the actual extent represented by the exported image?

The actual extent is different from the input extent. it is affected by dataFrame's extent and image size.

any ideas? thanks!

Outcomes