How to update feature layers on ArcGIS Enterprise with spatial views of SQL Server with Python API?

464
8
10-30-2018 08:20 AM
deleted-user-XxVvJu7MUIrG
New Contributor II

Hello everyone,

I am trying to update feature layers used in web maps on ArcGIS Enterprise with ArcGIS API for Python. I can have access to their feature sets by the code. I am using the sample of "Updating Features in a Feature Layer". The sample uses csv file to update the feature layer. Are there any possibilities to use spatial view of SQL Server to update feature layers? I converted the spatial view to a query layer and then converted it to a feature class, but I could not use the feature class for merging. I received the following error message:

can not merge DataFrame with instance of type <class 'arcpy.arcobjects.arcobjects.Result'

Please help me for this case.

Thank you!



0 Kudos
8 Replies
JakeSkinner
Esri Esteemed Contributor
0 Kudos
deleted-user-XxVvJu7MUIrG
New Contributor II

Hi Jake,

Thanks for sharing the tool. I really appreciate it. I am trying to run the tool, it is failed. It looks like the URL of the feature service is not correct. 

The URL I am using for the tool is similar to the following. 

https://servergis.CompanyName.com/arcgis/rest/services/Hosted/NameOfFeatureService/FeatureServer/0 

Thank you

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Can you share the service to a Group in ArcGIS Online and invite my user account (jskinner_CountySandbox)?  I'll download a copy, re-upload, and then try executing the tool.

0 Kudos
deleted-user-XxVvJu7MUIrG
New Contributor II

I need your email address to invite you to ArcGIS Online. 

0 Kudos
JakeSkinner
Esri Esteemed Contributor

You won't need to create a user account for me.  You can invite my user account that already exist.  Within an ArcGIS Online Group click invite user and uncheck Only search for members in.  Search for jskinner_CountySandbox and send the invite to that account. 

0 Kudos
deleted-user-XxVvJu7MUIrG
New Contributor II

I sent an invitation to you. 

0 Kudos
JakeSkinner
Esri Esteemed Contributor

I was able to get this to work.  Here are the steps I took in ArcGIS Pro after I downloaded the service as a feature class:

1.  Published the feature class to ArcGIS Online

2.  Exported a selection out of the feature class

3.  Updated the Design Elevation for the export to 10

4.  Executed the tool using the ElementNumber field as the unique identifier:

The service updated successfully with the new features who have a Design Elevation of 10.

0 Kudos
deleted-user-XxVvJu7MUIrG
New Contributor II

Hello Jake,

Thanks for sending the result. I believe that the tool is working well. It seems that there is an issue on my end. I created a new feature class and divided it in two parts. So, the second part is appended to the first part by the tool. I published the first part as "Hosted Feature Layer" on both ArcGIS Online and Enterprise. I executed the tool, but I received two different error messages. 

For ArcGIS Online, it looks that everything is working well, but no new row is appended to the hosted feature layer. I checked the tool twice. One time with defining a field value and the other time with no field value. Both had the following error. 

This is the error message.

ArcGIS Online Error

For ArcGIS Enterprise, there is a problem in connection.

It is "ConnectionError: HTTPSConnectionPool(host=' ', port=7443): Max retries with url: /arcgis/sharing/rest/generateToken

ArcGIS Enterprise Error

Thank you

0 Kudos