Exporting multiple layouts to multiple jpegs

1343
1
12-05-2011 05:36 AM
ThomasVincent1
New Contributor
Hello
I have got a map with 40 layers that need to be printed to JPG. They should all be printed independently. The scope does not change, the background does not change, only the selected layer is different.
How can I come by this problem. I started looking into arcpy but have seen that looping is more in modelbuilder.
Thx
0 Kudos
1 Reply
JeffBarrette
Esri Regular Contributor
Have you tried looking into the arcpy.mapping module?  There is an export to JPG function.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/ExportToJPEG/00s300000038000000/

You can very easily turn on and turn off layers, export, change dataframe extents, etc.

The following link is a great starting point:

http://blogs.esri.com/dev/blogs/arcgisdesktop/archive/2011/09/30/new-resources-available-for-getting...

Here is some very basic code:
mxd = arcpy.mapping.MapDocument("current")
#turn off all layers
for lyr in arcpy.mapping.ListLayers(mxd):
  lyr.visible = False
#turn one layer on at a time and export
for lyr in arcpy.mapping.ListLayers(mxd):
  lyr.visible = True
  arcpy.mapping.ExportToJPG(mxd, "C:\\Temp\\"+ lyr.name + ".jpg")
  lyr.visible = False

del mxd
0 Kudos