HOW TO
It may sometimes be advantageous to automate the process of extracting an Esri Scene Layer Package (SLPK) to an AWS S3 bucket and do all the work using Python, as opposed to doing it from the command line or ArcGIS Pro. The script below can also be run using the Windows Task Scheduler.
The following Python script can be used to extract an SLPK to an S3 bucket. The assumption is that there is an .acs connection file already created. In this example, since the Python script, the .acs file and the .slpk are within the same directory, there is no need to specify the file path.
import arcpy
import os
os.getcwd()
dir = os.path.dirname(__file__)
def main():
acs_connection = os.path.join(dir,"test.acs")
slpk_file = os.path.join(dir,"testpackage.slpk")
arcpy.management.ExtractPackage(
in_package=slpk_file,
output_folder=None,
cache_package="CACHE",
storage_format_type="COMPACT",
create_ready_to_serve_format="EXTRACTED_PACKAGE",
target_cloud_connection=acs_connection
)
arcpy.AddMessage("succeeded")
if __name__ == "__main__":
main()
The output can be seen within the S3 bucket by using the .acs file within ArcGIS Pro by adding a Cloud storage connection.
Article ID: 000032316
Get help from ArcGIS experts
Download the Esri Support App