Chapter 4. Complex ArcPy Scripts and Generalizing Functions

In this chapter, we will move from creating simple scripts based on autogenerated scripts from ModelBuilder to complex scripts that incorporate advanced Python and ArcPy concepts, such as functions. Functions can improve code and save time when writing scripts. They are also useful when creating modules or other reusable code, allowing for standard programming operations to be scripted and ready for future use.

In this chapter, will cover the following topics:

  • Creating functions to avoid repeating code
  • Creating helper functions to work with ArcPy limitations
  • Generalizing functions to make them reusable

Python functions–Avoid repeating code

Programming languages share a concept that has aided ...

Get ArcPy and ArcGIS – Geospatial Analysis with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.