Select to view content in your preferred language

Does ArcGIS API for Python work in a published geoprocessing service?

11-12-2020 06:15 AM
Regular Contributor

Apologies in advance as this question could fit in many different sections on the board, but hopefully someone will understand what I'm asking here! I need to be able to access our web GIS through a published geoprocessing service to pull down layers that were shared from the new Field Maps application (namely, I need to get markup layers). I have a web map that was built using the Javascript API and I'm envisioning a button to run the geoprocessing service as I do with so many others. Here's the workflow I need:

1) Click button on web map built with ArcGIS API for Javascript

2) It runs a geoprocessing service on the server. This geoprocessing service contains the arcgis module.

3) arcgis module logs into AGOL or Portal (I haven't figured it out yet), navigates to a group, and pulls down the markup layers. I will then use arcpy to manipulate them how I want (inside the same script) and then send an email to the user with the resulting FGB in a zip file. 

I have many geoprocessing services running arcpy scripts when a button is clicked on the web map built with JS, but I'm unsure if the arcgis module can be run on the server (ArcGIS Enterprise 10.7). Has anybody successfully done something like this?

0 Kudos
1 Reply
by Anonymous User
Not applicable


Yes, it does work in a geoprocessing service but you must first ensure you sign into your Portal or AGOL instance. 

And you should have no problem using both 'arcpy' and 'arcgis' libraries together as you see fit.

you're probably already doing this by calling the gp service from Javascript but if the gp service running in Server is set to run asynchronously then wait for the result in your JS call to be completed and returned.

Proceed from there.