ArcGIS Blog

Mapping

ArcGIS Pro

A new class in arcpy.sharing for web scene layers

By Jonah Lay

Introducing SceneLayerSharingDraft

With the release of ArcGIS Pro 3.4, we’re introducing SceneLayerSharingDraft, a new class in the arcpy.sharing module that brings a new level of support for sharing web scene layers using Python. This article covers the basics of the SceneLayerSharingDraft class and how it allows you to automate sharing web scene layers with associated web feature layers to ArcGIS Online and ArcGIS Enterprise.

As the use of 3D GIS data increases, web scene layers continue to prove invaluable for visualizing large datasets in 3D scenes. Feature-based scene layers—such as point, 3D object, and building scene layers—can have an associated web feature layer, which supports querying, editing, and filtering. These layers offer dynamic statistical insights that you can use for symbology and definition queries.

Previously, publishing web scene layers with associated web feature layers was only possible using the ArcGIS Pro user interface. The SceneLayerSharingDraft class allows you to automate the same workflow with Python, streamlining your sharing process and helping you efficiently maintain your 3D web apps.

Share a web scene layer with an associated web feature layer with ArcGIS Pro or Python
With the SceneLayerSharingDraft class, you can use Python to share scene layers in your ArcGIS Pro project as web scene layers with associated web layers to a portal.

Here’s how it works…

Like other sharing classes such as FeatureSharingDraft and MapImageSharingDraft, the SceneLayerSharingDraft is created using the Map object’s getWebLayerSharingDraft method:

getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables})

To create a sharing draft for a web scene layer, specify the following parameters:

  • server_type—Set HOSTING_SERVER if you want the web scene layer to copy all data; an associated web feature layer is included. Set FEDERATED_SERVER if you want the web scene layer to reference registered data; an associated map image layer and web feature layer are included.
  • service_type—Set SCENE_LAYER.
  • layers_and_tables—Reference the layer in the 3D scene in the project you want to publish using the listMaps function from the ArcGISProject object and the listLayers method on the Map class. The parameter must be a list with a single layer referencing a point, 3D object, or building scene layer.

Once the SceneLayerSharingDraft object is configured, you can set service level properties on the web scene layer and associated web layers. For example, you can configure cached attributes and enable texture optimization on the web scene layer. You can also configure editing, synchronization, and querying capabilities on the associated web feature layer. For a complete list of configurable properties, see Properties.

Next, you can optionally use the new analyzeForSharing method to analyze the SceneLayerSharingDraft object and review any errors, warnings, and messages.

Finally, publish the web scene layer and any associated web layers using the Publish function:

Publish(object, {item_id})

You can use the optional item_id parameter to specify item IDs for the web scene layer and associated web layers. The parameter is honored for web scene layers and web feature layers when sharing to ArcGIS Enterprise 10.8.1 or later. For map image layers, the parameter is honored when sharing to ArcGIS Enterprise 11.2 or later. The item_id parameter must be structured as a dictionary:

{
"web_scene_layer_id":"f62ad2r55geb4c9fa4f2faaf2fea96db",
"web_feature_layer_id":"t31dc5jb6c8h4y5fb9c67e8801e48735",
"map_image_layer_id":"54727ad350f74b7rbfa84e1fr122c071"
}

As shown in the example above, the IDs must be available and contain 32 alphanumeric values ranging from the letters a to f and numbers 0 to 9. An item ID will be automatically created if no ID is specified.

Once the web scene layer and associated web layers are published to ArcGIS Online or ArcGIS Enterprise, caching starts on the server. Once caching is successful, you are ready to use the web scene layer in your scene or 3D application.

We are excited for you to try out this new arcpy.sharing class. For in-depth information on the content covered in this article, including sample codes, see the SceneLayerSharingDraft ArcGIS Pro help topic.

For information on automating sharing web layers (including sharing scene layer packages) and the other classes available in the arcpy.sharing module, see the ArcGIS Pro help topics below.

Note: ArcGIS Pro 3.4 also comes with 133 new properties in the FeatureSharingDraft, MapImageSharingDraft, TileSharingDraft, and MapServiceDraft classes. Read more about this in Streamline your code with new properties in the arcpy.sharing classes.

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.

Share this article

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