In 2014, Esri introduced Scene Layers which are items in the Web GIS architecture that are used to represent 3D GIS features and that combine a scalable graphics cache with attributes, symbology, and can connect to feature services. Esri applications that consume scene layers are able to use indexing and multiple levels of detail (LODs) in the scene layer to display large data sets quickly across different platforms including on the web and in mobile apps. Scene layers currently contain information on 3D objects, integrated mesh, and 3D point layers. We are also working on additional layers and capabilities to use and interact with other types of 3D information as scene layers.
ArcGIS Pro 1.3 introduces a new GP tool 'Create Scene Layer Package' that encapsulates a scene layer in a scene layer package ‘.spk’ file that can be uploaded to ArcGIS Online or Portal for ArcGIS to be shared as scene layers. Some Esri applications will also be able to directly read and display some types of scene layer packages, such as ArcGIS Earth 1.2 and Drone2Map 1.0. The new GP tool creates a single .spk file for each input feature class dataset.
In some environments, users want to be able to repeatedly create scene layers for archive, distribution, and to update or replace existing scene layers. Like most GP tool, the Create Scene Layer Package tool can be used with the ArcPy Python API to automate scene layer package creation.
The following is an example script illustrating how a user with multiple multipatch datasets can use the ArcPy Python API of the GP tool and create scene layer packages. To get detailed help for the tool refer to the tool documentation. The following script accepts an input file geodatabase containing several multipatch feature classes. It loops through each feature class and creates a corresponding layer file (.lyrx) and a scene layer package (.spk). Sample output the file prints is also shown below.
import arcpy import os # Set input and output data locations geodatabase = r'\\data_share\SPK_Automation\ScriptingData.gdb' output_path = r'E:\temp\createSPKsample' upload_to_portal = False # Set arcpy environment arcpy.env.workspace = geodatabase #Handle errors try: # Get list of multipatch feature classes feature_list = arcpy.ListFeatureClasses(feature_type="Multipatch") print("Found " + str(len(feature_list)) + " multipatch feature classes for processing.") # Loop through each multipatch feature and create a scene layer package. counter = 0 for current_feature in feature_list: print("Processing feature class: " + current_feature) feature_path = geodatabase + os.path.sep + current_feature #Create a temporary feature layer from the current multipatch feature class arcpy.MakeFeatureLayer_management(feature_path, "temp_in_memory_feature" + str(counter)) #Save the temporary feature layer into a layer file of extension .lyrx output_lyrx_name = output_path + os.path.sep + current_feature + ".lyrx" arcpy.SaveToLayerFile_management("temp_in_memory_feature" + str(counter), output_lyrx_name) print(" Layer file created at: " + output_lyrx_name) #Create a scene layer package for the current feature class output_spk_name = output_path + os.path.sep + current_feature + ".spk" arcpy.CreateSceneLayerPackage_management(output_lyrx_name, output_spk_name) print(" Successfully created scene layer package at: " + output_spk_name) counter = counter + 1 #Upload scene package to portal if required #Note - this section would work only if ArcGIS Pro is started and signed into the desired #portal if (upload_to_portal): arcpy.SharePackage_management(output_spk_name) except Exception as spk_ex: print("Error processing. Details: " + str(spk_ex)) print(arcpy.GetMessages())
The script prints an output such as below to the screen.
Found 4 multipatch feature classes for processing. Processing feature class: Portland_untextured Layer file created at: E:\temp\createSPKsample\Portland_untextured.lyrx Successfully created scene layer package at: E:\temp\createSPKsample\Portland_untextured.spk Processing feature class: RI_colored Layer file created at: E:\temp\createSPKsample\RI_colored.lyrx Successfully created scene layer package at: E:\temp\createSPKsample\RI_colored.spk Processing feature class: SF_textured Layer file created at: E:\temp\createSPKsample\SF_textured.lyrx Successfully created scene layer package at: E:\temp\createSPKsample\SF_textured.spk Processing feature class: Singapore_repeatingTextures Layer file created at: E:\temp\createSPKsample\Singapore_repeatingTextures.lyrx Successfully created scene layer package at: E:\temp\createSPKsample\Singapore_repeatingTextures.spk
Output files are created in filesystem as shown in image below:
Once you have one or more SPKs, you can try some of the following with them:
- Upload them to ArcGIS Online or to your Portal for ArcGIS and share them as scene layers
- View scene layers shared in ArcGIS Online or Portal for ArcGIS with ArcGIS Pro, Earth, or in web scenes, including within Web AppBuilder
- View SPKs directly with ArcGIS Earth (3D Object and Integrated Mesh scene layers only)
The buildings being displayed below were packaged as an SPK, uploaded to ArcGIS Online, and shared as a scene layer. They can now be consumed in the Web Scene Viewer, ArcGIS Earth and ArcGIS Pro.