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

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

Remarque :
The arcpy.mp module is used in ArcGIS Pro; the arcpy.mapping module is used in ArcMap.

Network Analyst

At 10.7.1, the arcpy.nax module is available in ArcGIS Notebooks.

The Network Analyst module, arcpy.nax, is a modern, easy-to-use Python module for working with network analysis functionality provided with the Extension ArcGIS Network Analyst. 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

Remarque :

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.