Book Image

ArcPy and ArcGIS - Second Edition

By : Silas Toms, Dara OBeirne
Book Image

ArcPy and ArcGIS - Second Edition

By: Silas Toms, Dara OBeirne

Overview of this book

ArcGIS allows for complex analyses of geographic information. The ArcPy module is used to script these ArcGIS analyses, providing a productive way to perform geo-analyses and automate map production. The second edition of the book focuses on new Python tools, such as the ArcGIS API for Python. Using Python, this book will guide you from basic Python scripting to advanced ArcPy script tools. This book starts off with setting up your Python environment for ArcGIS automation. Then you will learn how to output maps using ArcPy in MXD and update feature class in a geodatabase using arcpy and ArcGIS Online. Next, you will be introduced to ArcREST library followed by examples on querying, updating and manipulating ArcGIS Online feature services. Further, you will be enabling your scripts in the browser and directly interacting with ArcGIS Online using Jupyter notebook. Finally, you can learn ways to use of ArcPy to control ArcGIS Enterprise and explore topics on deployments, data quality assurances, data updates, version control, and editing safeguards. By the end of the book, you will be equipped with the knowledge required to create automated analysis with administration reducing the time-consuming nature of GIS.
Table of Contents (13 chapters)
Introduction to ArcGIS Online

The ArcGIS Pro Python window

Click on the Analysis tab at the top of the ribbon and choose the Python option:

You should see the Python window appear at the bottom of the interface:

There are two regions of the Python window; they are called Python Prompt and Transcript. In the following figure, you can see each region if we pass a print function:

You should notice how the print function is slightly different here from its appearance in Python 2.7. In Python 3, instead of typing print "hello world", you have to pass the string to a print function, for example, print("hello world"). This is one of the differences between Python 2 and Python 3, which we will cover in more detail in the following section.

Let’s look at how else we can use the Python window in ArcGIS Pro. In your instance of Pro, add the Bus_Stops feature class from our working geodatabase...