Friday, January 18, 2013

10.1 SP 1 32 bit vs 64 bit

I ran across an interesting forum posting about the differences of 32 vs 64 bit python.

Check it out here:

It's worth a good read to understand if you install the 64-bit background processor provided at SP 1 how it operates and works on your machine.

Remember if you do install the 64-bit version of python, you will have to install the 64-bit of all your extensions as well.


Thursday, January 3, 2013

ArcPy 10.1 - Multiple Data Frames and Data Driven Pages

Data driven pages is a great way to automate map production over a given area, and it works right out of the box with a single data frame.  If you have 2 or more data frames though, you will need to control the movement of each data frame object by performing some sort of coding (ArcObjects or ArcPy).

A simple way to move multiple data frames is to:

  1. Get a list of all data frames
  2. Identify the parent data frame
  3. Move the extents of the other data frame
Sounds simple?  Well it is.

To get started, get a reference to the map document

mxd = arcpy.mapping.MapDocument("CURRENT")

Change "CURRENT"  to a path if not run in ArcMap.  Then list all the data frames

dfs = arcpy.mapping.ListDataFrames(mxd)

Now how do you know what data frame is the parent data frame or what data frame is a child data frame? Luckily at 10.1, the data driven page object provides a property called dataFrame, which returns the DataFrame object.  At 10.0, you would either use names or indexing values to determine which is the parent or not, but this example is for 10.1.

ddp = mxd.dataDrivePages
parentDF = ddp.dataFrame

Next step is to pan the other data frames to the extent of the parent data frame's extent.

for pageNum in range(1, ddp.pageCount + 1):

   for df in dfs:
      ddp.currentPageID = pageNum
      row = ddp.pageRow
      extent = row.Shape.extent
      if ( == and (df.scale == parentDF.scale):
         print 'I found the parent frame'
   arcpy.mapping.ExportToPNG(mxd, r"C:\Project\OutPut\ParcelAtlas_" + str(pageNum) + ".png")

Here we have a bunch of code that loops through each data driven page area and then modifies each underlying data frame that isn't the parent.  After the data frames are changes, the code then exports the maps to PNG to the '...\output' folder with reference to the page number.