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)
8
Introduction to ArcGIS Online

Creating a script tool

Script tools are common within GIS. ArcToolbox includes many script tools, and ArcGIS for Desktop allows for personal toolboxes with a mix of models and script tools. This example will demonstration how to create the front end graphic user interface or GUI that will pass the correct parameters in the correct order to the script.

The first step is to create a custom tool box to hold the script tool. Perform the steps listed here:

  1. Open up ArcCatalog, and right-click on the SanFrancisco.gdb file Geodatabase.
  2. Select New and then Toolbox from the menu.
  3. Call the toolbox Chapter5Tools.
  4. Right-click on Chapter5Tools, and select Add, then select Script.

The following menu will appear, allowing you to set up the script tool. Add a title Name with no spaces, and a label as well as a description. I prefer to run script tools in the foreground to see the messages it...