ArcGIS Blog

Analytics

ArcMap

Getting started with Python map automation

By Rob Elkins

ArcGIS 10 provides a new Python mapping module (arcpy.mapping) that
allows you to interact with the contents of map documents and layer
files without necessarily needing to interactively open an ArcMap
session.  The methods, properties and functions available in this new
map scripting API enable you, for example, to automate changing data
sources, modify layer properties, export and print maps, as well as
automate the creation of thematic maps and map series.  Because the new
mapping module is part of the ArcPy geoprocessing framework, scripts can
be used within ArcGIS Desktop but also published to ArcGIS Server as
geoprocessing services making it much easier to make mapping and
printing capabilities available on the server.

The following links are resources that will help you learn more about
arcpy.mapping as well as sample scripts available for download:

  •  A “Python Scripting for Map Automation in ArcGIS 10
    video presented at the 2010 Developer’s Summit is an excellent starting
    point.  This presentation not only introduces arcpy.mapping but also
    demonstrates many of its use cases.
  • ArcGIS Desktop help has a complete section dedicated to the ArcPy mapping module.  Embedded within the help are over 100 different, practical help samples that can be copied/pasted into your applications.
  • Approximately 20 script tools that perform routine map and layer management tasks, printing and exporting, as well as basic cartographic operations
  • script tool
    that combines Data Driven Pages, arcpy.mapping, and the ReportLab site
    package to generate a map series that includes index pages
  • script that automatically repositions a locator map on a page layout avoiding overlap with underlying features.
  • script that calculates adjacent page numbers to be used for a map series.

Share this article