AnsweredAssumed Answered

Can I return a list of attribute values from a geoprocessing service?

Question asked by schlot on Jul 13, 2012
Latest reply on Jul 24, 2012 by clthompson
I have been asked to create a service that will be consumed by a non-GIS application.   The programmer wants to be able to "make a call to GIS" providing the number of a school district as input.  They want the service to return just a list of districts that surround the input number.  Their application will be written in Java, which I know nothing about.

I have considered publishing a model as a geoprocessing service and I have looked at Python.  It seems like I might have more luck in Python, which I've never used before, because at least I could make an array or list of values from the attributes?  I'm not finding much documentation on publishing a Python script as a geoprocessing service.  I assume I can do this?

I started by creating a model that had the tools select by attribute and select by location.   Then I exported this to Python.  It executes OK when I'm in ArcMap.   I'm not sure where to go from there.  I know I need to examine each polygon that is the result of the select by location query and find just the attribute of the district field.

There is no desire to view or create a map in this application.  They just want a list containing the numbers of the adjacent districts.  Even after I get the list,  I'm still not sure what I might need to do to get this to work properly as an ArcGIS Server geoprocessing service.  I am still at version 10.0.

# --------------------------------------------------------------------------- # # Created on: 2012-07-12 15:14:17.00000 #   (generated by ArcGIS/ModelBuilder) # Usage: adjacent <countyName>  # Description:  # ---------------------------------------------------------------------------  # Import arcpy module import arcpy  # Set Geoprocessing environments arcpy.env.scratchWorkspace = "C:\\ESRItest\\model\\process.gdb" arcpy.env.workspace = "C:\\ESRItest\\model\\process.gdb"  # Script arguments countyName = arcpy.GetParameterAsText(0) if countyName == '#' or not countyName:     countyName = "Boone" # provide a default value if unspecified  # Local variables: selected_County = countyName Adjacent_Counties = selected_County county = "county"  # Process: Select Layer By Attribute arcpy.SelectLayerByAttribute_management(county, "NEW_SELECTION", "\"NAME\" = '%countyName%'")  # Process: Select Layer By Location result = arcpy.SelectLayerByLocation_management(selected_County, "BOUNDARY_TOUCHES", "", "", "NEW_SELECTION")  ## NOW WHAT?