Need for automation Specs/ web content cycle Python script for automating the overwrite process of web feature services 1 1 2 2 3 3 4 4 Cleaning up feature services – Live Demo 4 4
services – Difficult to see a comprehensive view of all the metadata on ArcGIS Online – Updating metadata/settings individually can take time – Multiple people managing services and metadata 5
Quarterly exports of TxDOT’s Geospatial Roadway Inventory Database (GRID) that need to be updated on ArcGIS Online Datasets need to be updated but symbology/metadata stays the same Maintain consistency through all of the metadata/settings/etc… for authoritative services on ArcGIS Online 6
the overwrite process of services Organize metadata and settings Maintain consistency Very easy to use 8 Image Cred: https://developers.arcgis.com/python/
“The ArcGIS API for Python is a powerful, modern and easy to use Pythonic library to perform GIS visualization and analysis, spatial data management and GIS system administration tasks that can run both interactively, and using scripts.” “Implemented on top of the REST APIs of the Web GIS platform, but you use Python to connect and interact with the platform.” Representational State Transfer (REST) – exposes constraints to work with the services Application program interface (API) – provides interaction with the exposed services 9
later – Python 3 – conda and the arcgis package pre-installed ArcGIS API for Python v1.5 To run Arcpy and Python API set IDE interpreter to: – C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe Using service definitions to update/publish services 10
updated feature layers from SDE – Create connection to AGOL – Create local sddraft files – Create sd files – Query AGOL and overwrite service – Clean up metadata 13
sddraftList =[] i = 0 for fc in fcList: sddraft_filename = fcList[i] + ".sddraft" sddraft_output_filename = os.path.join(outdir, sddraft_filename) sddraftList.append(sddraft_output_filename) i+=1 sddraftList.sort() #Loop through and create sddraft files for each layer i = 0 for lyrs in m.listLayers(): sharing_draft = m.getWebLayerSharingDraft("HOSTING_SERVER", "FEATURE", lyrs, lyrs) sharing_draft.credits = "TxDOT – TPP – Data Management" sharing_draft.useLimitations = "Copyright 2018…" sharing_draft.exportToSDDraft(sddraftList[i]) # Create Service Definition Draft file i+=1 16