Hello everyone,
I’m trying to replicate the “Share As Web Layer” functionality (shown in the screenshot) using the ArcGIS Pro SDK.
Here are my questions:
Is there a direct API in ArcGIS Pro SDK to share a feature layer (or raster layer) as a web layer to ArcGIS Online / Enterprise?
If not, is there any workaround through the SDK that mimics the desktop workflow (right-click → Share As Web Layer)?
Any insights, documentation links, or code examples would be very helpful.
Thanks in advance!
@UmaHarano , @Wolf
Hello,
@UmaHarano , @Wolf , @GKmieliauskas ,
Please could someone help me with this query?
It would be a great help if anyone could provide some insights.
Regards,
Abhijeet
I am not aware of a way to accomplish this with the API.
I recommend posting this request in the Pro ideas site for the API support.
I am trying to find the script / GP tool that can be used to 'share' or 'publish' a feature layer as a web layer. Until then you can at least present your users programmatically with the 'share feature layer as web layer' dockpane using this snippet:
IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("esri_sharing_SharingAsWebLayerPaneBtn");
if ((wrapper is ICommand command) && command.CanExecute(null))
command.Execute(null);
Hello @Wolf ,
Thank you for your insights. I tried this workflow, but I want to autopopulate the Geoprocessing tool through code. It doesn’t achieve the desired result.
After some digging we found this:
An overview of the Publishing toolset—ArcGIS Pro | Documentation
which indicates that it is possible to publish a feature layer as a web layer. It appears that to accomplish this is very complicated. I will try to publish a sample that publishes a feature layer as a web layer. I'll put the sample on this thread as well - if i can get it to work.
Thank you @Wolf , I am waiting for you to provide me with a example.
Sorry about the delay we started to certify 3.6...
I attached a sample ArcGIS Pro Add-in project that includes the python script used to publish a feature layer as a web layer. Because the code is using ExecuteToolAsync to run the python script the script can utilize the existing ArcGIS Pro portal connection eliminating the need to passing user name/ password to the script.
here is the sample's readme:
Wolf,
Thank You for the reply above. Your Python script works well.
It does seem like the workflow you scripted in Python would be practical as a C# Method in the ArcGIS Pro SDK. And it seems like there would be a huge number of customers that could use this functionality.
Yes... I know... I could suggest this as an "idea".
It is certainly possible that I am missing something... but it does not appear possible to load a tpkx file to ArcGIS Online with Python.
The tpkx files appear to be more advantageous to my customers because they can be loaded to a device and read natively from the Field Maps app. That is extremely advantageous for several reasons. There are still many cellular dead spots (and more extremely slow spots) in the world. Satellite cellular connections will soon change this to some extent... however, this data will always need a lot of bandwidth... which means that for quite some time it will be best to store the mapping data on a device.
Again... Thank You for your work.