What this book covers
Part 1: Introduction to Python Modules for ArcGIS Pro
Chapter 1, Introduction to Python for GIS, introduces the core components of Python required for the automation of ArcGIS Pro and other Esri productions. This chapter also includes an overview of Python syntax to introduce the required data structures and scripting concepts.
Chapter 2, Basics of ArcPy, explains the syntax and modules available for ArcPy, a Python package that it is very important to be familiar with for map production and data management for ArcGIS Pro. You will explore the functions and modules available in ArcPy, and do some geoprocessing in the ArcGIS Pro window using ArcPy.
Chapter 3, ArcGIS API for Python, introduces ArcGIS API for Python. This is a Python package designed to work with web GIS and allows you to work directly with data on ArcGIS Online or ArcGIS Enterprise. We will cover how to set up and manage a virtual environment within ArcGIS Pro, and introduce ArcGIS Pro Notebooks, which are similar to Jupyter Notebooks. The ArcGIS Notebooks will be used throughout the book as a way to write and run Python in ArcGIS Pro.
Part 2: Applying Python Modules to Common GIS Tasks
Chapter 4, Data Access Module and Using Cursors, covers how to use the Data Access module to assist in automating import steps in geoprocessing tasks. The Walk
function will be used to walk through directories to find datasets. The search, insert, and update cursors will be used for finding and updating data within feature classes.
Chapter 5, Publishing to ArcGIS Online, covers how to publish and organize data on ArcGIS Online from within ArcGIS Pro. We will use ArcGIS API for Python in ArcGIS Pro Notebooks to publish, append, and edit data. We will also show you how repetitive tasks involved in managing ArcGIS Online content can be automated using Python.
Chapter 6, ArcToolbox Script Tools, demonstrates the process of turning a Python script into a script tool. A script tool is stored in a custom toolbox and runs like an ArcGIS tool. Creating script tools is a great way to share your scripts, as it allows non-Python users in your organization to run tools you developed for specific tasks.
Chapter 7, Automated Map Production, introduces the arcpy.mp
module that is used to automate map production tasks. We will see how to use Python to update broken data source links, add/move/remove data layers from a map, adjust the symbology of a layer, work with the different layout elements, and export maps.
Part 3: Geospatial Data Analysis
Chapter 8, Pandas, Data Frames, and Vector Data, introduces you to using Pandas for geospatial data analysis. We cover some Pandas basics, how to get data in and out of Pandas DataFrames, and look at a GeoJSON-to-CSV file-to-shapefile workflow that relies on Pandas.
Chapter 9, Raster Analysis with Python, demonstrates how to use the raster tools in the arcgis
and arcpy
modules to work with raster and imagery layers. We look at creating rasters, saving them, and accessing their properties, as well as how the Spatial Analyst toolset enables more advanced spatial modeling and analysis.
Chapter 10, Geospatial Data Processing with NumPy, covers how and when you can use the NumPy module when working with raster data. We look at some basic NumPy array manipulations and how they are used in the context of geospatial analysis.
Part 4: Case Studies
Chapter 11, Case Study: ArcGIS Online Administration and Data Management, contains case studies showing you how to create Notebooks within ArcGIS Pro to administer your ArcGIS Online account. These Notebooks will allow you to manage users, report credits, reassign items, and download and rename photos. All of this can be done from within ArcGIS Pro using the ArcGIS API for Python, and ArcGIS Pro Notebooks.
Chapter 12, Case Study: Advanced Map Automation, is a case study showing you how to create a map automation from start to finish. We walk through the different map settings that cannot be changed with arcpy.mp
to help create a good template for your map automation. Then, we use arcpy.mp
to create a map series showing the different minority status of the block groups around bus lines that were suspended in 2020 to identify any potential environmental justice issues.
Chapter 13, Case Study: Interactive Data Science Web Map, is a case study that demonstrates an extract, transform, load (ETL) workflow applied to the problem of predicting crop yields using agricultural data from around the world. We write a Notebook that performs data collection, data cleaning, and fits a random forest model to make our predictions, and then create a simple JavaScript web app on top of our Python code.