AnsweredAssumed Answered

How to force python script (=geoprocessing service) to return results???

Question asked by 4Bart on Oct 16, 2014
Latest reply on Oct 16, 2014 by JScheirer-esristaff


I need to make a little geoprocessing service based on python script...

Meaning of the service is easy: receive JSON, look if there are any features of one feature class in geodatabase and return the count of features...

General idea of script (as it looks like as a desktop script - thats why there are "AddMessage") is this:

import arcpy data="Database Connections\myDB.sde\" data_fl=arcpy.MakeFeatureLayer_management(data) json=arcpy.GetParameter(0) sr=arcpy.Describe(vo).spatialReference polygon=arcpy.AsShape(json,True) polygon.projectAs(sr) polygon_fl=arcpy.MakeFeatureLayer_management(polygon) arcpy.SelectLayerByLocation_management(data_fl,"INTERSECT",polygon) if arcpy.GetCount_management(data_fl).getOutput(0)!="0":     arcpy.arcpy.AddMessage("you have chosen "+arcpy.GetCount_management(data_fl).getOutput(0)+" features") else:     arcpy.arcpy.AddMessage("no chosen features")


But - I know this is not way how to get some results from geoprocessing service (if i publish this script). How to force python script (=geoprocessing service) to return results??? It must be easy, I think this is kind of "newbie" question, Im still learning...


Thanks for any help!