Notebooks

ArcGIS Notebooks

What is notebooks?

Notebooks is a Jupyter Notebook scripting and execution environment in a portal that combines Python code, plain language descriptions, visualizations, and data tools. An individual notebook, including its code and resources, is stored as an item in a portal. Notebooks are only available to if you have an ArcGIS Online or ArcGIS Enterprise account, and you have the appropriate privileges.

You can use notebooks to do the following:

  • Execute Python code to access portal items and display maps.
  • Perform advanced analysis and machine learning.
  • Create visualizations to represent your data and analysis results.
  • Share notebooks with other members of your organization.
  • Perform administrative tasks for your organization.

How to use notebooks

The general steps to use notebooks are:

  1. Sign in to your portal.
  2. Click Notebook.
  3. Click New notebook and choose a runtime (Standard, Advanced, or Advanced with GPU).
  4. Add content and web tools to your notebook.
  5. Perform analysis using ArcGIS API for Python.
  6. Share your notebooks with other users in your organization.

Automate workflows

Notebooks can be used to automate workflows to streamline processes, optimize resource usage, and improve productivity.

Some examples are to:

Choose a runtime

Notebooks offer three runtime options for different requirements:

  • Standard: The Standard runtime is suitable for most general tasks and basic analysis. It is ideal for users who do not require advanced geoprocessing capabilities. It is also the best choice when sharing notebooks with users who may not have Advanced runtime privileges.
  • Advanced: The Advanced runtime, which includes ArcPy, is for more complex operations and advanced spatial analysis. It is useful for tasks that require access to ArcGIS geoprocessing tools or when working with large datasets that demand more computational power.
  • Advanced with GPU: The Advanced with GPU runtime is designed for tasks that can benefit from GPU acceleration. This makes it ideal for deep learning applications such as object detection in satellite imagery, or for processing and analyzing large raster datasets.

Below is a comparison of the features and use cases:

RuntimeFeaturesUse Cases
Standard- ArcGIS API for Python
- Hundreds of Python libraries
- Lower resource requirements
- Basic spatial analysis
- Data visualization
- Content management
- Simple automation tasks
Advanced- All Standard runtime features
- ArcPy library
- Additional GIS-specific libraries
- Higher resource requirements
- Complex spatial analysis
- Geoprocessing tasks
- Advanced GIS workflows
- Data science projects
Advanced with GPU- All Advanced runtime features
- GPU acceleration
- Highest resource requirements
- Deep learning tasks
- Image processing
- Large-scale raster analysis
- Computationally intensive modeling

Code examples

The following are examples of some common Python scripts you can run using Notebooks:

Connecting to your portal

Use dark colors for code blocksCopy
1
2
3
4
from arcgis.gis import GIS

# Connect to your portal
gis = GIS("https://www.arcgis.com", "your_username", "your_password")

Adding a feature layer to a map

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from arcgis.gis import GIS
from arcgis.mapping import WebMap

# Connect to your portal
gis = GIS("https://www.arcgis.com", "your_username", "your_password")

# Create a new web map
webmap = WebMap()

# Add a feature layer to the map
feature_layer = gis.content.get("item_id_of_feature_layer")
webmap.add_layer(feature_layer)

# Display the map
webmap

Perform spatial analysis and visualize results

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
from arcgis.geometry import buffer

# Connect to your portal
gis = GIS("https://www.arcgis.com", "your_username", "your_password")

# Get a feature layer
layer = FeatureLayer("feature_layer_url")

# Create a 1000-meter buffer around features
buffered_features = buffer(layer, distances=[1000], unit="meters")

# Visualize the results
map = gis.map()
map.add_layer(buffered_features)
map

Automate administrative tasks

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
from arcgis.gis import GIS

# Connect to your portal
gis = GIS("https://your-portal-url", "admin", "password")

# Find and remove inactive users
inactive_users = gis.users.search(max_users=1000)
for user in inactive_users:
    if user.lastLogin < some_threshold_date:
        user.delete()

Manage and organize your content items

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
from arcgis.gis import GIS

# Connect to your portal
gis = GIS("https://your-portal-url", "username", "password")

# Check for broken URLs in items
for item in gis.content.search(max_items=1000):
    if item.type == 'Web Map':
        # Check URLs in web map layers
        for layer in item.layers:
            if not is_url_valid(layer.url):
                print(f"Broken URL found in {item.title}: {layer.url}")

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.