I'd like to create a geoprocessing service in ArcGIS Server (10.2) which uses an existing map service as input. I have been trying to do this with a ModelBuilder model, but it's copying the existing map service data to my GP service.
More precisely, what I am doing is using a NRCS soil map unit layer and intersecting with a farm field boundary layer. Both the soil layer and the farm field layer get published with another process.
None of the ESRI examples of GP services show using existing map services as inputs, unless I am missing something.
-
1How are you running this on Desktop (to get a result that you could publish to Server)? GP tools don't work against MapServices. They'll work against FeatureServices, but not map.KHibma– KHibma2014年12月12日 19:58:32 +00:00Commented Dec 12, 2014 at 19:58
-
I do have a FeatureService running for the layers. But I don't see how to use these as input in a ModelBuilder, all I can do is add the database connection from SDE. Doing that, all the data gets copied to the server when I publish. Yes, the SDE geodatabase is registered.Dirk HH– Dirk HH2014年12月14日 14:21:12 +00:00Commented Dec 14, 2014 at 14:21
-
If using a FS, give this a read: blogs.esri.com/esri/arcgis/2013/10/10/… you cant directly use a FS as input. You can only use a layer which references a FS.KHibma– KHibma2014年12月15日 14:38:21 +00:00Commented Dec 15, 2014 at 14:38
-
Thanks, Kevin. This is the missing detail I was looking for. I'll post back how it goes after I do the Python script.Dirk HH– Dirk HH2014年12月16日 15:12:39 +00:00Commented Dec 16, 2014 at 15:12
-
I have a python script which does a select by attributes working for one layer, which is the field boundary (for a farm). Now I need to intersect this with a larger layer, soil map units. If I can get the extent of the 1st layer, I can get just the soil map unit polygons needed (there's 1000s even in my test on one county). What's the python method for an extent on a layer? Eventually I will figure it out, but thought I'd ask here :-)Dirk HH– Dirk HH2014年12月16日 21:48:34 +00:00Commented Dec 16, 2014 at 21:48
1 Answer 1
The answer for me was to look at http://blogs.esri.com/esri/arcgis/2013/10/10/quick-tips-consuming-feature-services-with-geoprocessing/ and then create Python scripts which directly extract what's needed out of me map services.
Below is an example, which is running off an ArcGIS server on my desktop. It's doing what Select by Attribute would otherwise do. In this case, it's selecting a farm field boundary by name. The field boundary runs as a feature service and users draw the boundaries using the JSAPI Edit Dijit.
I'd hope that ESRI would add some more standard tools which would directly do this sort of thing. Maybe in 10.4, since 10.3 is already out the door this week...
# SelectFieldByName.py
# Get an ArcGIS server feature set
# input
# 0: FeatureService URL
# 1: Field Name
# output
# Feature Set
# Modification History
# dhh 15Dec2014 Original
import arcpy
import os
import sys
import traceback
import urllib
# Get the Parameters
fsBaseURL = arcpy.GetParameterAsText(0)
fieldName = arcpy.GetParameterAsText(1)
where = urllib.quote(r"Name='{}'".format(fieldName))
fields = '*'
token = ''
# REST query of mapservice
query = r"/query?where={}&outFields={}&returnGeometry=true&f=json&token={}".format(where, fields, token)
fs = arcpy.FeatureSet()
fsURL = fsBaseURL + query
arcpy.AddMessage("Loading {}.".format(fsURL))
fs.load(fsURL)
arcpy.AddMessage("Loaded {} finished.".format(fsURL, fs.JSON))
arcpy.SetParameter(2, fs);
Explore related questions
See similar questions with these tags.