Select to view content in your preferred language

Help running Arcpy script on Arcgis Server?

1390
5
02-21-2019 07:23 AM
DaronNichols
Emerging Contributor

The ultimate goal is to have a  geoform /  Survey123 app to collect data in a point feature (I know how to create this, no problem), then convert them to polygons based on an underlying parcel layer so they can be seen on a viewer. I can write a script to run on desktop that works with a few simple spatial joins and appends (but this isn't an option as the script has to run on a routine basis), and can kind of use ArcGIS API for Python to do it (for credits) on portal, however I'm struggling to write a stand alone, server side script that references a point feature services/hosted feature class, runs the necessary tasks, and uses the output to update the feature service/ hosted feature class that would be in the viewer.

I'm brand new when it comes to working with ArcGIS servers, so any help would be greatly appreciated.

Tags (1)
0 Kudos
5 Replies
BlakeTerhune
MVP Regular Contributor

It sounds like you've already got a script, can't you just schedule it to run on your server?

Python

0 Kudos
DaronNichols
Emerging Contributor

I guess I should clarify, in arcgis pro is a simple matter of running a spatial join and append. When publishing the script/model to ArcGIS Server the geoprocessing task will only act on static data (the way it looks when the tool was published) and the output is a rest endpoint with a random name. Even if I could figure out how to capture the output, the tool wont recognize changes to the input layer.

0 Kudos
BlakeTerhune
MVP Regular Contributor

I may still be missing something, but a geoprocessing service runs using the current state of the input layer, not a copy of the input layer when it was published.

write a stand alone, server side script that references a point feature services/hosted feature class, runs the necessary tasks, and uses the output to update the feature service/ hosted feature class that would be in the viewer

Is the "point feature service" you mentioned the same as the feature service in the viewer? Could you describe your goal with more specific names so it's easier to follow?

0 Kudos
DaronNichols
Emerging Contributor

Apologies for my confusion, I really appreciate your help. Our client wants two things from us, the first is an intake form, such as a geo form or survery 123, the other is a web viewer. The form will collect real estate information, and a point on the relevant parcel(Form Points), however for the viewer they want to see the parcel polygon in question(Viewer Polys), not just the point.

This isn't difficult to do on ArcGIS Pro, I could just set up a map with the two feature services(Form Points, Viewer Polys) and the parcel polygons for our entire county, spatial join the new Form Points to the parcels, and append the result over to the Viewer Polys feature service in the viewer, I could even set up a script to do those tasks.

However, I'm running into issues putting that script onto our server, so we could have it run periodically. It's starting to look like instead of just scripting the geoprocessing tools, I'm going to have to add code to login into AGOL, call down the Form Points feature service, process it, and publish the resulting Viewer Polys back to AGOL, is that right? This is usually handled behind the scenes in ArcGIS Pro so I think that's where I am getting lost.

0 Kudos
BlakeTerhune
MVP Regular Contributor

I haven't done this but it looks like using the ArcGIS API for Python is probably the way to go.

Updating your hosted feature services with ArcGIS Pro and the ArcGIS API for Python 

0 Kudos