Basics of ArcPy
Now that you have an understanding of python syntax you can start working with the ArcPy package. ArcPy is the Python package provided by ArcGIS to perform and automate geoprocessing and map production tools tasks. In addition to the geoprocessing tools available in ArcGIS you have access to additional modules, functions, and classes. When combined you can create workflows and standalone tools that simplify and automate complex analysis and map production.
This chapter will cover:
- Ensuring your Python Environment is set up for ArcPy
- ArcPy Tools and how to use them in ArcGIS Pro
- Accessing environment settings in ArcPy
- Functions in ArcPy
- ArcPy Modules
Checking your ArcPy Install
The ArcPy package allows you access to the geoprocessing function of ArcGIS Pro. Python packages contain multiple modules, functions, and classes. A package is set up with a hierarchical structure and uses dot notation for the modules and functions.
ArcPy is installed with ArcGIS for Pro and ArcGIS Desktop. ArcPy has been used to write Python scripts in ArcGIS since ArcGIS 10.0. It is the official ArcGIS scripting language and can be used to automate analysis and map production workflows. ArcGIS desktop uses Python 2.7, which is currently up to release 2.7.18. ArcGIS Pro uses a new version of Python, Python 3. The most recent release of Python 3 is Python 3.9.5. You can check what version of Python you have installed by going to the Project>Python>Installed Packages and finding Python.
To use the ArcPy package it must be imported. Most scripts start with import statements to allow access to all the modules that are part of the package. To import...