![Page 1: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/1.jpg)
Automate Publishing of Web Layers
Using ArcPyShilpi Jain
![Page 2: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/2.jpg)
Why automated?
Faster
Reliable
Integrate
![Page 3: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/3.jpg)
ArcPy Sharing Tools
![Page 4: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/4.jpg)
map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables})
Returns a class object based on service_type selected.
http://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm
1. getWebLayerSharingDraft
![Page 5: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/5.jpg)
server_type service_type
HOSTING_SERVER
FEATURE FeatureSharingDraft
TILE TileSharingDraft
FEDERATED_SERVER MAP_IMAGE MapImageSharingDraft
returned object
![Page 6: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/6.jpg)
Properties of returned object
credits
summary
Metadata description
tags
useLimitations
Methods of returned object
exportToSDDraft() – returns the location and name of sddraft
overwritingExistingService copyDataToServer
portalFolder federatedServerUrl
Service Properties serverFolder offline
serverType
serviceName
![Page 7: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/7.jpg)
Demo 1: Sharing to ArcGIS Online
![Page 8: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/8.jpg)
![Page 9: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/9.jpg)
StageService_server (in_service_definition_draft, out_service_definition, {staging_version})
https://pro.arcgis.com/en/pro-app/tool-reference/server/stage-service.htm
2. Stage Service
![Page 10: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/10.jpg)
UploadServiceDefinition_server (in_sd_file, in_server, {in_service_name}, {in_cluster}, {in_folder_type},
{in_folder}, {in_startupType}, {in_override}, {in_my_contents}, {in_public}, {in_organization}, {in_groups})
https://pro.arcgis.com/en/pro-app/tool-reference/server/upload-service-definition.htm
server_type
3. Upload Service Definition
![Page 11: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/11.jpg)
SignInToPortal (portal_url, username, password)
http://pro.arcgis.com/en/pro-app/arcpy/functions/signintoportal.htm
When to use?
If the script is to be run outside Pro.
4. Sign In To Portal
![Page 12: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/12.jpg)
Demo 2: Sharing to Enterprise
![Page 13: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/13.jpg)
![Page 14: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/14.jpg)
Conclusion
Why Automate How to Automate
• Increase efficiency
• Eliminate human error
• Integrate with other GP tools
• arcpy.SignInToPortal
• arcpy.mp.getWebLayerSharingDraft
• arcpy.StageService_server
• arcpy.UploadServiceDefinition_server
![Page 16: Automate Publishing of Web Layers Using ArcPy€¦ · ArcPy Sharing Tools map. getWebLayerSharingDraft (server_type, service_type, service_name, {layers_and_tables}) Returns a class](https://reader031.vdocuments.us/reader031/viewer/2022011901/5f07142f7e708231d41b3262/html5/thumbnails/16.jpg)
Please Share Your Feedback in the App
Download the Esri
Events app and find
your event
Select the session
you attended
Scroll down to
“Survey”
Log in to access the
survey
Complete the survey
and select “Submit”