publish with python a feature service that is not hosted

3907
13
11-25-2017 05:54 AM
roialgavish
New Contributor III

Hello,

Is there a way to publish with python a feature service that is not hosted (in my sde)?

Thank you.

0 Kudos
13 Replies
TorbjornSvangård
New Contributor II

Ok, if I understood you correctly, the python code I refered to only works since ArcGIS Pro 2.3 (January 2019)?

0 Kudos
DorothyShreve
New Contributor II

This script worked wonderfully until we upgraded to ArcGIS Pro 2.9.1, then I had to switch the way firstChild was set in order to get feature server enabled in the sddraft. Throws a bunch of errors but seems to be working anyway 🙂

extElement.firstChild.data = 'true'

became:

extElement.firstChild.nodeValue = 'true'

0 Kudos
MatthewWalker
New Contributor II

I am also looking to write a python script that will publish a feature layer (that does not contain '(hosted)' in its name-it behaves differently than a regular feature layer, and I cannot consume that feature layer from a third party software).  I've only found documentation on using getWebLayerSharingDraft, exporting that draft using exportToSDDraft, staging that draft using StageService_server, then uploading using UploadServiceDefinition_server, but then it published a 'Feature_Layer (hosted)' and I cannot use that layer in a webmap.  I cannot find the difference between a Feature Layer and a Feature Layer (hosted), nor how to create the former using an arcpy script.

(my ultimate goal is to feed into a script the feature classes I want, and have the script set symbology, enable Sync and editing, name the layers a specific name, publish 3 different feature layers, then bundle them into a web map, ready for consumption by a third party software-it has to have exact configurations, thus the need for a script that configures the map the same way every time).

0 Kudos
roialgavish
New Contributor III

Hi,

I did found a solution I don’t fully remember it now but I crated SD draft and before crating the SD itself I parse it with an xml library and changed the values so it will be a feature service from my SDE.

Its and old code that I did for a client so I don’t have it on my, but this was the idea, and it worked.

I don’t remember if it was for this part of the code but I use both of the python env in this script both python 3 and python 2, because off different capability that I needed. It was done with subprocess.

Good Day.

0 Kudos