ArcGIS Blog

Announcements

ArcGIS API for Python

What's New in ArcGIS API for Python 2.4.0 (September 2024)

By Nicholas Giner and Mariia Lubinova

The ArcGIS API for Python (e.g. “the Python API”) released version 2.4.0 on September 24, 2024.  The focus of this release is on modernization and improved usability, but we’ve also prioritized bug fixes and added hundreds of updates and enhancements throughout the API.  Read some of the highlights organized into major themes and common workflows below, and check out the full release notes here.

New map widget for improved mapping and visualization

The map widget of the arcgis.mapping module has long been popular with Python API users because it allows you to visualize your spatial data and analysis results on interactive web maps directly in a Jupyter (or ArcGIS) Notebook.  In version 2.4.0, we’ve added a new, modern version of the map widget into the API.  Here are some things to be aware of:

  • The previous arcgis.mapping and arcgis.widgets modules have been deprecated and refactored into the new arcgis.map module.
  • You can now use the API to design your map widget in a notebook (e.g. add layers, symbolize, add bookmarks, etc.), then save this map widget as a web map that can be seamlessly consumed in the Map Viewer and other supported web applications.
  • The new map widget provides you with internal validation when creating pop-ups, renderers, and symbols.
  • In version 2.4.0 (and going forward), the new map widget will support the latest version of the JavaScript API, which enables you to take advantage of the latest features in the JavaScript API.
  • The new map widget also works with the next generation of Jupyter Notebooks (Jupyter Notebook 7 and JupyterLab 4). With the upcoming releases of ArcGIS Pro 3.4, ArcGIS Enterprise 11.4, and the November 2024 ArcGIS Online update, all ArcGIS Notebooks products will be Jupyter Notebook 7-based, which means they will be compatible with the new map widget!
Map widget in a notebook
Example of the code for the previous map widget (v2.3.x and earlier).
new map widget in a notebook
Example of the code for the new map widget (v2.4.x and after).

New Service class for streamlined access to GIS Services

The foundational purpose of the ArcGIS API for Python is to “be the Python API to your web GIS”.  In other words, it provides a Pythonic way to interact with ArcGIS REST services from ArcGIS Online or ArcGIS Enterprise.

Within ArcGIS, there are hundreds of available services in the categories of mapping & location, portal & data, and spatial analysis, and the ArcGIS API for Python has classes, functions, and methods for interacting with many of them.  Prior to this release, users might have multiple import statements in their code based on the specific types of services they are working with (calling).

ArcGIS for Python multiple import statements to access GIS services
Example of using multiple import statements and making service type-specific calls to access GIS services.

In the 2.4.0 release, we’ve worked to streamline access to all GIS services through the Service class of the new arcgis.layers module.  This is one single class (and single import statement!) that provides a centralized and easy way to access any supported GIS service, without the user specifying or even knowing what type of service it is.  Given the sheer volume of different types of services within the ArcGIS system, this is a huge win!

ArcGIS for Python import statement to access multiple different GIS services
Example of using one import statement and one class to access multiple different GIS services.

Administration

Administering your web GIS can refer to managing users, groups, infrastructure, and servers, or customizing the look and feel of your ArcGIS Online or Enterprise.  Here are some highlights from the 2.4.0 release:

  • Support for the new User Types – As you may be aware, Esri updated the ArcGIS user type model in June 2024. User types control what licenses are assigned to a user, and therefore what capabilities they have access to.  We know that many of our customers use the ArcGIS API for Python to automate creation of user accounts, and to configure all of the licenses, privileges, etc. that are associated with them.  As such, we have ensured that our underlying code has been adjusted to account for these new user type changes, so that your existing code will continue to work and will pick up these changes when you create new users with the API.
  • Check offline licenses – Another administrative enhancement we’ve added at 2.4.0 is the ability to check offline Named User licenses. This allows organization administrators to programmatically identify the users in their ArcGIS Online organization who have taken a license offline, such that they can be monitored over time or contacted regarding the organization’s offline licensing policies.  Thanks to this issue submitted in the ArcGIS API for Python public GitHub repo, we’ve added this functionality for checking offline ArcGIS Pro licenses.
  • Recycle bin support – In June 2024, Esri introduced the Recycle Bin to ArcGIS Online. This allows individual users or administrators to recover items that have been deleted from the organization.  Like we do with many new features that are added to ArcGIS, the Python API team added functionality to work with the Recycle Bin programmatically in version 2.2.0.  At 2.4.0, we’ve added enhancements to allow organization administrators to access and recover Recycle Bin content from the whole organization, as well as the ability to restore deleted content to a specific folder.

Content management

We know that managing content in an efficient and automated manner is one of the most common tasks our customers do with the ArcGIS API for Python.  As such, content management workflows drive many of our development projects when considering new releases.  Here are a select few…

  • Item classification support – Item classification is the process of assigning data or items with a specific label.  It is widely used by government agencies and other businesses to assign levels of protection, restrict access to, or control dissemination of individual pieces of data or content within the organization.  With the upcoming release of ArcGIS Enterprise 11.4, portal administrators can define and apply a classification and dissemination schema to each item in the portal.  At 2.4.0, we’ve added functionality to programmatically enable or disable item classification via the Python API’s new ClassificationManager class.
  • Update Living Atlas v2.0 content in ArcGIS Enterprise – At Enterprise 11.3 or higher, users can update ArcGIS Living Atlas content as updates become available, rather than waiting to upgrade to a new version of Enterprise. Version 2.4.0 of the Python API contains support for programmatically checking for, scheduling, and downloading Living Atlas updates.
  • Remapping items – the new remap_data method allows you to easily replace data sources in web maps or applications with new data sources. This can be helpful if data becomes corrupted or outdated, or if you are replacing test data with production data.

Analysis and Data Science

In the area of analysis and data science, we’ve added Python API support for the Last Mile Delivery solver. This solver allows businesses to spatially optimize the deliveries made by their vehicle fleet.

Following the release of Notebook web tools in the June 2024 update of ArcGIS Online, we’ve also added functionality for working with notebook web tools in ArcGIS Online.  You can now publish, overwrite, and consume notebook web tools programmatically using the ArcGIS API for Python!

In every release, we continue to innovate and evolve in the area of GeoAI (machine learning and deep learning) by adding new functionality to the arcgis.learn module of the Python API.  Some highlights include:

  • Fine-tuning the Prithvi foundation model*
  • A new deep learning foundation model for time series forecasting of climate/weather data (ClimaX)*
  • Model extensibility for Text AI models
  • New object detection models

SDK (Documentation, guides, and samples)

  • Deprecation announcements
    • As the API evolves, we want you to know about not only what we are adding, but also what is being deprecated/removed.  Our main goal is for your code to run as smoothly as possible with each version update!
  • New guides
    • Time series forecasting with ClimaX
    • Using third-party large language models (LLMs) in ArcGIS Pro’s Text Analysis tools
  • New sample notebooks
    • Fine-tuning the Segment Anything Model for flood inundation mapping
    • Fairness in machine learning using AutoML
  • If you need to access documentation for previous versions of the Python API, you can access them here:
Python API Old documentation

Community and collaboration

We want to remind you that there are excellent resources available for getting help with the API and sharing your feedback.  You can use the ArcGIS API for Python Esri Community page to ask specific questions, suggest ideas for enhancements and improvements, connect with other users, and read recent blogs.  You can also use the ArcGIS API for Python public GitHub repo to submit bugs, enhancement requests, and other issues.  The team really does monitor these pages very closely, and we use your feedback and suggestions to help us prioritize what we build into the API going forward.  So please use them!

Share this article

Subscribe
Notify of
0 Comments
Oldest
Newest
Inline Feedbacks
View all comments