ArcGIS Blog

Mapping

ArcGIS Pro

Streamline your code with new properties in the arcpy.sharing classes

By Jonah Lay

ArcGIS Pro 3.4 comes with 133 new properties created for classes in the arcpy.sharing module. These properties match settings in the user interface when you configure a web feature layer, map image layer, web tile layer, or map service. Use them in your Python scripts to achieve more with less code.

The arcpy.sharing classes allow you to create a sharing draft, a configurable set of properties for a web layer or service. This article applies to new properties in the classes below.

Class Description

FeatureSharingDraft

Creates a sharing draft for a hosted web feature layer or a hosted table

MapImageSharingDraft

Creates a sharing draft for a map image layer with an optional web feature layer on a federated server

TileSharingDraft

Creates a sharing draft for a web tile layer

MapServiceDraft

Creates a sharing draft for a map service on a stand-alone server

Previously, these sharing drafts only contained the most common web layer or service properties. To configure settings such as time zone, pooling type, and WFS, you probably modified the service definition draft file (.sddraft) using third-party XML editors or XML Python libraries. Now, you no longer need to modify the .sddraft file to configure these settings. Instead, simply set the desired property on the sharing draft object.

In the example below, extensive code in ArcGIS Pro 3.3 (left) modifies the .sddraft file to set map operations, include an associated feature layer, and enable feature capabilities for a map image layer. You can now set the same properties with three simple lines of code in ArcGIS Pro 3.4 (right).

Comparison of code to set properties in ArcGIS Pro 3.3 (left) and ArcGIS Pro 3.4 (right). Extensive code in 3.3 to set map operations, include a feature layer, and enable feature capabilities, contrasted with three simple lines of code in 3.4 achieving the same tasks.

We can’t cover all 133 properties in this article, so the following table highlights new properties you may find useful.

Properties Description User Interface

sharing.sharingLevel

 

 

 

sharing.groups

The sharing level of the web layer:

  • OWNER
  • ORGANIZATION
  • EVERYONE

The group names, separated by commas.

Sharing level settings

featureCapabilities

The enabled capabilities, separated by commas. The following capabilities are supported:

  • Query
  • Create
  • Update
  • Delete
  • Sync
  • Extract
  • Editing
Embedded Image

timezone.ID

The time zone in which date values are stored. The string value must match one of the official time zone IDs recognized by the Windows operating system. For a list of time zones, see Time zones in the Microsoft documentation. Embedded Image

pooling.type

The type of instance pooling that will be used.

  • SHARED
  • DEDICATED
Embedded Image

 

For a complete list of new and existing properties, visit FeatureSharingDraft, MapImageSharingDraft, TileSharingDraft, and MapServiceDraft in the ArcGIS Pro help documentation. The sample codes found in the topics are updated to include some of the new properties. You can use the samples to create a script tool, allowing you to run it like any other geoprocessing tool in ModelBuilder models.

The arcpy.sharing module in ArcGIS Pro 3.4 also includes a new class for web scene layers. For more information, see SceneLayerSharingDraft.

For further information, visit the ArcGIS Pro page or the What’s New documentation and post your questions in the ArcGIS Pro board in Esri Community.

 

 

Card image source: © Soho A studio – stock.adobe.com

Share this article

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