2

I have a large number of layout views I would like to export as JPEG maps using ArcMap 10.0. The layout view is based upon a user defined grid. Normally what I would do is manually select a grid, zoom to the selected grid and export the layout as a JPEG. But in this case there are over 1000 to do.

Is it possible to write an ArcMap model that will allow me to Select a Grid (table record) and then Zoom to the selected grid and then export the JPEG, which I can run as a batch?

Using ModelBuilder I imagine I would need to add the "Select" tool and then associate that with a "zoom to selected" script. This is the part I fall down at. While I have a script that does this, I cannot associate it with my selected record.

My grid is a polygon feature dataset (either shapefile or gdb) - basically a user defined grid for a layout at a particular scale. I really just need to zoom to each grid, which will have a numeric label 1 - 1000, in a field called ID, then export the layout of that map grid.

8
  • 1
    This sounds like a use case for Data Driven Pages (DDP) but I think you should edit your question to explain your manual workflow more clearly. For example, if your "grid" is a feature class then it may be suitable to use as the index layer of DDP.
    – PolyGeo
    Commented Feb 20, 2015 at 7:57
  • @PolyGeo - DDP can't be exported to image formats unfortunately. Only to PDF.
    – GISGe
    Commented Feb 20, 2015 at 8:15
  • 1
    @GISGe I think it can, but I better test.
    – PolyGeo
    Commented Feb 20, 2015 at 8:21
  • 3
    @GISGe you can use exportToJPEG when looping over the dataDrivenPages in arcpy to export multiple images, if the mxd has been set up with the data driven pages correctly. Commented Feb 20, 2015 at 8:58
  • 2
    I'm going to remove the words "or PDF" from your question because we have all been working under the impression that JPG was a mandatory requirement. Don't be concerned that I am doing that - it just keeps the answer(s) lined up with the question.
    – PolyGeo
    Commented Feb 20, 2015 at 10:00

1 Answer 1

4

I've had to do something very similar using some cobbled together python script:

>>> field_name = "name"
>>> mxd = arcpy.mapping.MapDocument("CURRENT") 
... for i in range(1, mxd.dataDrivenPages.pageCount + 1):
...    mxd.dataDrivenPages.currentPageID = i
...    row = mxd.dataDrivenPages.pageRow
...    print row.getValue(field_name)
...    arcpy.mapping.ExportToJPEG(mxd, r"C:\temp\XXXX" + row.getValue(field_name) + ".jpg", resolution = 400) 
... del mxd

Each jpeg is given the name of the area which DDP iterates through

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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