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.
To use ArcPy in a notebook, ArcGIS Notebooks must be licensed with the Advanced license, and users must have the privilege to create and run ArcPy notebooks.
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']
To access or share content in your organization, you must be signed in. In ArcGIS Notebooks, you can sign in to your organization without explicitly providing a URL, username, or password by using the following code:arcpy.SignInToPortal("notebook")
ArcPy modules
The modules described below are included with ArcPy in ArcGIS Notebooks.
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.
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.
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.
Mapping
Arcpy.mp is a Python submodule that is part of the ArcPy site package. It is 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 (.lyrx). You can automate the contents of projects without even having to open the application. In some cases it provides capabilities that are not available to ArcGIS Pro, for example, arcpy.mp 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.
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:
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, arcpy.sharing, is a Python module that allows you to automate sharing workflows. Use it to create a sharing draft, which is a configurable set of properties for a web layer, web tool, map service, or geoprocessing service. Creating a sharing draft is the first step in automating the sharing of a GIS resource to ArcGIS Enterprise, ArcGIS Online, or ArcGIS Server.
Spatial Analyst
The Spatial Analyst module, arcpy.sa, is a Python module for analyzing raster and vector 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 functions and classes that allow you to automate your raster processing workflows.
Learn more about the Spatial Analyst module
Note:
The Workflow Manager (arcpy.wmx) module is not included with ArcGIS Notebooks.
View the sample notebooks that are included with ArcGIS Notebooks to learn how ArcPy can be used in your notebooks.
To learn more about how to prepare the workspace environments forArcPy, see Manage content in the user workspace and Upload datasets to use with ArcPy.