6

Is it possible to export a Map Frame to JPEG with a world file (JPW) that respects its extent?

Using ArcGIS Pro 2.0.1 (and I think the behaviour at 1.4.1 was the same) I have noticed something that seems odd. Using the GUI it is possible to have a Map active and Share | Export Map to produce a JPEG (*.jpg) file with an accompanying world file (*.jpw) that appears to be what is seen in that Map at the time it is exported.

To see this:

  1. Create a new project called TestProject in C:\Temp using Map.aptx as a template.
  2. Run the ArcPy code below to write a test feature class (fishnet) into its file geodatabase.

import arcpy
testFC = r"C:\Temp\TestProject\TestProject.gdb\TestFC"
if arcpy.Exists(testFC):
    arcpy.Delete_management(testFC)
arcpy.management.CreateFishnet(testFC,
                               "152 -25", "152 -24", 0.1, 0.1, 10, 10, None,
                               "NO_LABELS", "DEFAULT", "POLYGON")
sr = arcpy.SpatialReference("Geocentric Datum of Australia 1994")
arcpy.management.DefineProjection(testFC,sr)

  1. In ArcGIS Pro add the feature class to the project's only Map
  2. Insert a Layout into that project (I used A4 Portrait)
  3. On that Layout insert a Map Frame using the Map (not at the Default scale)
  4. Make the Map active, and use Share | Export Map to C:\Temp\Map.jpg and tick the Create world file box. This makes C:\Temp\Map.jpw as well

The Map looks like this in ArcGIS Pro:

enter image description here

The Layout looks like this in ArcGIS Pro:

enter image description here

When I use ArcMap 10.5 to check whether the world file is working I need to edit the coordinate system (Geocentric Datum of Australia 1994) onto Map.jpg using the Catalog window first, but then I can display it against the OpenStreetMap basemap to see:

enter image description here

which does not look great but it was quick to make and looks like it is the area I am after.

In contrast, when I try to do the same thing using ArcPy for ArcGIS Pro there is not a method to export from a map object but there is one to do it from a map frame:

import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Temp\TestProject\TestProject.aprx")
lyt = aprx.listLayouts("Layout")[0]
mf = lyt.listElements("MapFrame_Element", "Map Frame")[0]
mf.exportToJPEG(r"C:\Temp\Map2.jpg",96,True)

This took 10-20 mins to complete and produced this when I viewed it in ArcMap and gave it the same coordinate system (Geocentric Datum of Australia 1994):

enter image description here

I have no idea why it produces an image over such a large extent, and I am assuming that it is doing that which causes it to take so long to export.


The behaviour is the same with ArcGIS Pro 2.1.2 when trying to exportToTiff and create a GeoTIFF.

  • Perhaps add content of bloated world file to question body. – FelixIP Mar 6 '18 at 0:47
1
+100

This isn't an answer but a confirmation of PolyGeo's issue. I've tested the methodology using ArcGIS Pro 2.1.1 and replicated the results.

I tried setting the data frame to fixed extents with no difference to the output.

I then tried a new project based on the Blank template, removing the basemap and adding in my own feature classes. The export still defaults to some pre-defined extent.

Layout View
Layout View

Exported JPG Exported JPG

I think this issue needs to be raised with ESRI Technical Support as a possible bug.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.