Thursday, August 18, 2011

Tips for Map Book Automation

The mapping module for Arcpy is awesome!  I can't wait to see what happens at 10.1.  Everything should be automated, and here is some tips that might help everyone develop map books a little better:
  1. Manage unneeded objects, delete them from memory if they are not needed anymore using the del statement.  (you can always extend some object to use using statements as well)
  2. If the area of interest is large and the grid area is small, it's going to take a long time to complete.  Get a cup of coffee!
  3. Eliminate the need to reference multiple Map Documents.  If you need a left and right page, use one Map Document and turn the layers on/off as needed.
  4. Use cached local map services if possible for basemap data.  This should speed production up.
  5. Modules like shutil.copy() can be quicker than some arcpy functions, so use them.
  6. Always check to see if the PDF file name exists (os.path.isfile()) and use arcpy.CreateUniqueName() frequently
  7. If the map book is going to be large (2000+ pages), consider splitting the book into multiple books
  8. Subprocessing module can be your friend and enemy, use it wisely or it will destroy you.
  9. Reference local data, not data over the network when possible
Now go automate your map production!

Please add your comments/tips to improve map automation, I'd love see what you have encountered.