[GIS] Python geoprocessing tool for ArcGIS online

arcgis-10.2arcgis-onlinearcpygeoprocessing-service

I am looking to create a geoprocessing tool using python in arcGIS 10.2 that will be used in the ArcGIS online web app builder. This will be my first tool for a web application and I would like some information/advice about how to use ArcGIS REST services and hosted feature services in a python geoprocessing tool. When creating tools for ArcMap I use the

arcpy.GetParameterAsText() 

code and then choose a parameter in the script properties window. Is there a specific line of code to use to get feature services and REST services and is there a specific parameter to use?

Also how do I show the result in a web app?

My goal is to save out the results as a pdf file at a user defined location or as a separate html page.

Best Answer

Give Quick Tips: Consuming Feature Services with Geoprocessing a read. It should get you started by providing you ideas of how you can actually consume a feature service with geoprocessing.

  • Either have it as a layer inside the map and use a name match in the script to it.
  • Or use a featureset parameter and use the URL to it

Either way, unless you want to provide the end user the ability to select a different feature service as input, it doesn't make sense to expose a parameter. If you're going to be executing against the same featureservice, just hard code it inside the script itself.

Saving as a PDF: there is already a lot of doc on printing/creating PDF, etc. There is also a lot of posts here on GIS.SE that go into detail. If you still have questions on this part once you get that far, I'd post a new question, with your model/script and where it is you're having problems exactly.

Related Question