Select to view content in your preferred language

Multiple data driven frames?

23459
30
10-03-2011 03:08 PM
TrishRice
Deactivated User
I had an idea and want to see if it's possible/if anyone's done it.  Can you combine data driven pages with having multiple data frames on your layout?

Example:
-Two frames on a layout, one on left and one on right
-10 data driven pages
-It would display DDP's 1, 3, 5, 7, 9 in the left frame and DDP's 2, 4, 6, 8, 10 in the right frame, for a total of 5 sheets of paper.

I just experimented in ArcMap 10 with two data frames with DDP's turned on and it only updates one of them, the other remains static.
0 Kudos
30 Replies
JeffBarrette
Esri Regular Contributor
Data Driven Pages (DDP) uses one index layer to drive extents.  If your two data frames on each page have different extents then I don't think you can do this with only DDP.

If both of your data frames have the same extent (but display different layers) you could do this.  See the following help topic:
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Customizing_your_map_extent/00s9000000...

Your scenario can be accomplished with the arcpy.mapping scripting environment.  You would set the two data frame extents independantly using whatever method you need.

Jeff
0 Kudos
FedericoValfrè_di_Bonzo
Deactivated User
Same problem here.
No one knows a solution?
0 Kudos
JeffBarrette
Esri Regular Contributor
The solution would need to include arcpy.mapping.  Here is a great example in help where two different MXDs are used to handle facing pages (left and right pages use different layout settings).  All pages are combined into one fine PDF using arcpy.mapping.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s90000002p000000.htm

Jeff
0 Kudos
FedericoValfrè_di_Bonzo
Deactivated User
The solution would need to include arcpy.mapping.  Here is a great example in help where two different MXDs are used to handle facing pages (left and right pages use different layout settings).  All pages are combined into one fine PDF using arcpy.mapping.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s90000002p000000.htm

Jeff


Thank you, this is a great idea!
But my data frames don't show the same extent and are on the same mxd. I need 1 layout withe all teh data frames...I think that I have to learn arcpy.mapping...
0 Kudos
TrishRice
Deactivated User
Thanks, jbarrette.  This isn't exactly what I meant with my question but your answer for data frames with the same extent helped me with a different project.

What I originally had in mind was like Federicovdb's problem.  Having multiple data frames with different extents on the same layout, and still using data driven pages.  For example, facing pages but with the facing pages on the same sheet of paper.  It's just a curious inquiry at the moment (no work tasks depending on this) but I'm sure there would be useful applications.
0 Kudos
JeffBarrette
Esri Regular Contributor
Let me explain this a little more clearly.  In your scenario, you have 2 data frames on a single layout but with different extents.  No matter how you address this, you need the equivalent of two index layers; one to drive the first extent, the second to drive the other extent.

Your options:
1) Use DDP to drive the first extent and arcpy.mapping to drive the second extent
or
2) Use arcpy.mapping to drive both extents.

Below is some sample code that sets the 1st data frame's extent based on each feature extent in the first layer:
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd)[0]
rows = arcpy.SearchCursor(lyr.dataSource):
for row in rows:
    newDFExt = row.getValue("Shape").extent
    df.extent = newDFExtent
    arcpy.mapping.ExportToPDF(mxd, somepath)
del mxd


The logic could be easily extended to multiple data frames.

I hope this helps,
Jeff
0 Kudos
Raphael_Augusto_FoscariniFerre
Regular Contributor

I tired, but didnt work. Something was wrong, i fixed, line 4, requires no colon : at the end

But still doesnt work. Changes the extent, but doesnt export pdf. What is wrong?

mxd = arcpy.mapping.MapDocument("CURRENT")  
df = arcpy.mapping.ListDataFrames(mxd)[0]  
lyr = arcpy.mapping.ListLayers(mxd)[0]  
rows = arcpy.SearchCursor(lyr.dataSource)
for row in rows:  
    newDFExt = row.getValue("Shape").extent  
    df.extent = newDFExt
    arcpy.mapping.ExportToPDF(mxd, r"D:\TEMP\datadriven")  
del mxd  
0 Kudos
JeffBarrette
Esri Regular Contributor

Hello Raphael,

I apologize for the accidental (colon) typo.  I should have tested the code first. I believe the issues you are running into has to do with your pdf output file.  Because you are iterating through multiple features, you need to build the PDF to uniquely name each file.  In the example below, I'm using the features "NAME" property and building the outputpath/filename.

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd)[0]
rows = arcpy.SearchCursor(lyr.dataSource)
for row in rows:
  newDFext = row.getValue("Shape").extent
  df.extent = newDFext
  somepath = "C:/Temp/" + row.getValue("NAME") + ".pdf"
  arcpy.mapping.ExportToPDF(mxd, somepath)

0 Kudos
TrishRice
Deactivated User
Thanks.  I'll fiddle around with that and see what happens.
Let me explain this a little more clearly.  In your scenario, you have 2 data frames on a single layout but with different extents.  No matter how you address this, you need the equivalent of two index layers; one to drive the first extent, the second to drive the other extent.

Your options:
1) Use DDP to drive the first extent and arcpy.mapping to drive the second extent
or
2) Use arcpy.mapping to drive both extents.

Below is some sample code that sets the 1st data frame's extent based on each feature extent in the first layer:
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd)[0]
rows = arcpy.SearchCursor(lyr.dataSource):
for row in rows:
    newDFExt = row.getValue("Shape").extent
    df.extent = newDFExtent
    arcpy.mapping.ExportToPDF(mxd, somepath)
del mxd


The logic could be easily extended to multiple data frames.

I hope this helps,
Jeff
0 Kudos