Using Python to copy data from feature service on AGOL to feature class on SDE?

2676
2
Jump to solution
03-08-2018 10:52 AM
SladeSawyer
New Contributor II

I am trying to create a tool to record and analyze data on structures through Survey123. The overall process is to record data points in Survey123 and the feature service created by Survey123, move it to our SDE environment, and then do geoprocessing/analysis on it.

Doing this manually is easy peasy: load the feature service into an mxd through Add Data, Copy from the feature service into an identical and empty feature class and then do the joins, overlay analysis, and all the other analysis.

My shop is currently using ArcMap 10.4 and AGOL.

However, I would very much like to use python to do this as It would just not be feasible to do all this manually over the long term.  My initial research points me towards using ArcGIS API for Python, but that seems to be a daunting new set of tools, workflow, and creating and setting up a new environment for what is a pretty simple task. Or is it that simple?

Is API for Python the best tool to achieve my goals of copying data from a feature service to SDE using python?

Are there better tools or workflows to do this?

I'm not looking for someone to create the plan or workflow, just to let me know if I am barking up the wrong tree. And if I am correct in that API for Python is the correct tool, maybe a suggestion on learning materials for it. It seems as though ArcGIS API is a little out of my current reach regarding python skill and database structure/knowledge, but I wouldn't mind learning something new.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

I think the Python API is a good idea for this. One thing to note is that the API is Python 3, while ArcMap is Python 2. You will need to set up a different environment for each and run them one after the other unless you are using Pro. If you have Pro this can all be put into one and setting up the API is easier. Esri has a bunch of sample notebooks, and one that does what you describe by downloading a dataset. Then you can do an Arcpy script to use the downloaded data. Here are the links:

Install and set up | ArcGIS for Developers 

Managing your content | ArcGIS for Developers  (See 'Download item data')

Overall, the Python API aspect of this would be ~5 lines of code. Hope this helps!

View solution in original post

2 Replies
by Anonymous User
Not applicable

I think the Python API is a good idea for this. One thing to note is that the API is Python 3, while ArcMap is Python 2. You will need to set up a different environment for each and run them one after the other unless you are using Pro. If you have Pro this can all be put into one and setting up the API is easier. Esri has a bunch of sample notebooks, and one that does what you describe by downloading a dataset. Then you can do an Arcpy script to use the downloaded data. Here are the links:

Install and set up | ArcGIS for Developers 

Managing your content | ArcGIS for Developers  (See 'Download item data')

Overall, the Python API aspect of this would be ~5 lines of code. Hope this helps!

SladeSawyer
New Contributor II

Thanks for replying, Ethan.

I've looked through the links you provided, and they are promising. More good news is that we have ArcPro and we Analysts and Technicians have been told it is the way of the future so we should look to engage with it when we can. Well, this looks like a good one!

I have a few questions about jupyter notebooks and how to create scripts in that environement, but I think that's for another post. I'll mark your response as correct as it answers my original question well.

Thanks again!