<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcGIS 10.0 - Arcpy Map Export: how to get the actual maextent in the exported image? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcgis-10-0-arcpy-map-export-how-to-get-the-actual/m-p/477214#M37355</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Environment:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS 10.0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Input params:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;XMin, YMin, XMax, YMax, Scale, requiredImageWidth, requiredImageHeight&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Output params:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;image url&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;exported image extent(XMin, YMin, XMax, YMax)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sample code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
#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,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data_frame=dataFrame,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df_export_width=inputImageWidth,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df_export_height=inputImageHeight)
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so far the service has successfully exported map to JPEG file; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but what is the way to get the actual extent represented by the exported image? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The actual extent is different from the input extent. it is affected by dataFrame's extent and image size.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any ideas? thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Feb 2014 18:54:11 GMT</pubDate>
    <dc:creator>SimonLeo</dc:creator>
    <dc:date>2014-02-24T18:54:11Z</dc:date>
    <item>
      <title>ArcGIS 10.0 - Arcpy Map Export: how to get the actual maextent in the exported image?</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-0-arcpy-map-export-how-to-get-the-actual/m-p/477214#M37355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Environment:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS 10.0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Input params:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;XMin, YMin, XMax, YMax, Scale, requiredImageWidth, requiredImageHeight&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Output params:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;image url&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;exported image extent(XMin, YMin, XMax, YMax)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;sample code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
#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,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data_frame=dataFrame,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df_export_width=inputImageWidth,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; df_export_height=inputImageHeight)
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so far the service has successfully exported map to JPEG file; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but what is the way to get the actual extent represented by the exported image? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The actual extent is different from the input extent. it is affected by dataFrame's extent and image size.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;any ideas? thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Feb 2014 18:54:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-0-arcpy-map-export-how-to-get-the-actual/m-p/477214#M37355</guid>
      <dc:creator>SimonLeo</dc:creator>
      <dc:date>2014-02-24T18:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS 10.0 - Arcpy Map Export: how to get the actual maextent in the exported im</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-0-arcpy-map-export-how-to-get-the-actual/m-p/477215#M37356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Exporting a dataframe to get the exact extent is tricky for a couple of reasons.&amp;nbsp; First, the aspect ratio of the provided coordinates may not match the shape of the frame.&amp;nbsp; Second, the output depends on the DPI settings of the computer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The easiest way to get what you want is to build a layout with a dataframe that is the same size of the layout.&amp;nbsp; Export the layout instead of just the data frame.&amp;nbsp; Exporting the layout allows you to use the layout page units rather than try to calculate height and width in pixel length.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 14:05:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-0-arcpy-map-export-how-to-get-the-actual/m-p/477215#M37356</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2014-02-25T14:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS 10.0 - Arcpy Map Export: how to get the actual maextent in the exported im</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-0-arcpy-map-export-how-to-get-the-actual/m-p/477216#M37357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff, thanks for your reply. I must say that I don't quite understand the way you proposed. I think I know the reasons why it's tricky. could you elaborate a little more? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the image height and width are given from web UI. so these two values are known.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;a little more about the whole situation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;this is a printing service that deals with a lot of features. The feature data are from a separate service hosted by an application server(diff from ArcGIS Server). One way to print them is to send the data from web UI to ArcGIS Server, but those are a lot of data that needs a long while for transmission. Another way is to let ArcGIS Server print basemap and map service layers, then send the exported image to application server and draw all features over exported basemap image. But to draw, we need to know the exported image's map extent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Exporting a dataframe to get the exact extent is tricky for a couple of reasons.&amp;nbsp; First, the aspect ratio of the provided coordinates may not match the shape of the frame.&amp;nbsp; Second, the output depends on the DPI settings of the computer.&lt;BR /&gt;&lt;BR /&gt;The easiest way to get what you want is to build a layout with a dataframe that is the same size of the layout.&amp;nbsp; Export the layout instead of just the data frame.&amp;nbsp; Exporting the layout allows you to use the layout page units rather than try to calculate height and width in pixel length.&lt;BR /&gt;&lt;BR /&gt;Jeff&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 15:40:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-0-arcpy-map-export-how-to-get-the-actual/m-p/477216#M37357</guid>
      <dc:creator>SimonLeo</dc:creator>
      <dc:date>2014-02-25T15:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS 10.0 - Arcpy Map Export: how to get the actual maextent in the exported im</title>
      <link>https://community.esri.com/t5/python-questions/arcgis-10-0-arcpy-map-export-how-to-get-the-actual/m-p/477217#M37358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;All I'm suggesting is that you try exporting your MXD Layout rather than a dataframe.&amp;nbsp; Create an MXD with a layout that has a a single dataframe that is the same size/orientation as the layout.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2014 16:55:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcgis-10-0-arcpy-map-export-how-to-get-the-actual/m-p/477217#M37358</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2014-02-26T16:55:56Z</dc:date>
    </item>
  </channel>
</rss>

