Skip To Content

Use ArcPy in a notebook

Several ArcPy modules are available in ArcGIS Notebooks through the Advanced notebook runtime.

With the ArcPy site package, you can perform geographic data analysis, conversion, and management. ArcPy allows you to programmatically run all ArcGIS standard geoprocessing tools and provides helper functions and classes.

Learn more about ArcPy

To use ArcPy in your notebook, ArcGIS Notebook Server must be licensed with the Advanced license, and users must have the privilege to create and run ArcPy notebooks.

ArcPy modules

The modules described below are included with ArcPy in ArcGIS Notebook Server.

Data Access

The data access module, arcpy.da, is a Python module for working with data. It allows control of the edit session, edit operation, improved cursor support (including faster performance), functions for converting tables and feature classes to and from NumPy arrays, and support for versioning, replicas, domains, and subtypes workflows.

Learn more about the Data Access module

Geocoding

The Geocoding module, arcpy.geocoding, allows you to explore and set locator properties and automate geocoding workflows. Geocoding is the process of transforming a description of a location—such as a pair of coordinates, an address, or a name of a place—to a location on the earth's surface. A locator is the tool used to perform geocoding operations. With this module, you can view and modify properties on the locator to tune it to your specific geocoding needs by customizing it for performance or quality. You can also use this module to perform various geocoding operations, including finding the location of a place or address, finding the closest place or address to a given location, or generating a set of autocomplete suggestions for partial input.

Learn more about the Geocoding module

Image Analysis

The Image Analysis module, arcpy.ia, is a Python module for managing and processing imagery and raster data. The module also includes functionality provided by the ArcGIS Image Analyst extension, such as all of the geoprocessing functions, as well as advanced functions and classes that allow you to automate your raster processing workflows.

Learn more about the Image Analysis module

Mapping

Arcpy.mp is a Python sub module that is part of the ArcPy site package. It gets installed with ArcGIS Pro and is available to all licenses. It was designed primarily to manipulate the contents of existing projects (.aprx) and layer files (.lyr or .lyrx). It also provides functions to automate exporting and printing. Arcpy.mp can be used to automate map production and is required to build complete map books because it includes functions to export to, create, and manage PDF documents.

Learn more about the Mapping module

Note:
The arcpy.mp module is used in ArcGIS Pro; the arcpy.mapping module is used in ArcGIS Desktop.

Metadata

The Metadata module, arcpy.metadata, is a Python module for accessing and managing an item's metadata. You can explore information describing your maps and data and automate your workflows, particularly for managing standards-compliant geospatial metadata.

Learn more about the Metadata module

Network Analyst

The Network Analyst module, arcpy.nax, is a modern, easy-to-use Python module for working with network analysis functionality provided with the ArcGIS Network Analyst extension. It provides access to the following:

  • Classes that allow you to perform all the supported network analyses
  • Classes that allow you to work with information related to the connectivity of various elements that comprise a network dataset
  • Geoprocessing tools that allow you to pre-process inputs, share your analysis results, or work with network datasets
  • Helper functions and classes that you can use to work with certain data types used by the classes that allow you to perform network analysis

Learn more about the Network Analyst module

The legacy module arcpy.na is not included with ArcGIS Notebooks.

Sharing

The arcpy.sharing module shares web layers using Python.

The sharing module allows you to create a sharing draft from a map in an ArcGIS Pro project, which can then be shared to ArcGIS Enterprise, ArcGIS Online, or ArcGIS Server. A sharing draft is a configurable set of properties for a web layer. Creating a sharing draft is the first step in automating the publishing of a map, layer, table, or list of layers and tables to a web layer using Python. The sharing draft can then be saved as a service definition draft (.sddraft) file.

Learn more about the Sharing module

Spatial Analyst

The Spatial Analyst module is a Python module for analyzing raster data with the functionality provided by the ArcGIS Spatial Analyst extension. It provides access to all the geoprocessing tools available in the Spatial Analyst toolbox as well as other helper functions and classes that allow you to more easily automate your workflows using Python.

Learn more about the Spatial Analyst module

Note:

The Workflow Manager (arcpy.wmx) module is not included with ArcGIS Notebook Server.

Get started with ArcPy in a notebook

To use ArcPy in a notebook, import its library by running a cell with the following lines:

import arcpy
arcpy.GetInstallInfo()['Version']

View the sample notebooks that are included with ArcGIS Notebook Server to learn how ArcPy can be used in your own notebooks.