1

I'm working on an application where a desired functionality is for users to start with the big picture (i.e. a single map layer), and gradually add more and more conditions to display only the area that satisfies all of them (i.e. the intersection of all the selected layers). I've been able to do this with Javascript on the client, but this has some performance issues and ideally I'd like to process this on the server.

The data I'm working with has already been prepared as polygonal layer or raster layer mapservices. Can I pull data directly from these services for processing?

1
  • you will need to step through it manually 1st before you can understand how to do it programmatically. Go to the catalog view and add a connection to the service. find the layer you desire and drag it into arcmap.
    – Brad Nesom
    Commented Aug 10, 2015 at 13:48

1 Answer 1

4

I assume you want to use a geoprocessing service in your web app along with your map service. I give the Creating GP Services presentation at the ESRI UC, and show a demo of this. This is what I'd consider the least likely scenario in terms of GP services consuming data, thus it's not well documented. That said, you can use a geoprocessing service to work with a feature service. The feature service will stream the features over to the GP service for it to use. This requires some specific setup in both the tool and your javascript app.

First, your tool will need take a string as input. This string will represent the URL to a feature service with the query params. For example, this would be the start code to your tool:

inFS = arcpy.GetParameterAsText(0)

featureset = arcpy.FeatureSet()
featureset.load(fs)

cnt = arcpy.GetCount_management(featureset)  #Or whatever tool/workflow

The web app would pass a URL like: (note the query here is 1=1 and f=json is critical.)

http://server:6080/arcgis/rest/services/fs1/FeatureServer/0/query?where=1%3D1&returnGeometry=true&returnIdsOnly=false&returnCountOnly=false&f=json

The last part is the web app itself. With the parameter named "inputFS" inside the tool itself, this is the code used in JS:

vals = "url to fs ...JS code sets this"
gp = new Geoprocessor(gpServiceUrl);
var params = {
    "inputFS" : vals  
     };
console.log(params);
gp.submitJob(params,gpJobComplete,gpJobStatus,gpJobFailed);

In terms of a RASTER layer...there is a tool you'd need to use the Make Image Service Layer tool, but note that this tool only works off an ImageService, not a map service with a raster. The input parameter would again be a string (the URL itself).

As you work through this, keep in mind that the map/feature service and the GP service really have nothing to do with one another. Yes you want them to consume the same underlying data. But each service by itself has no knowledge of the other. Its the web app which glues these 2 services together by passing the URL as long as the GP service is setup properly to consume it.

4
  • Thanks! I was at the UC, but I must have missed your presentation. I appreciate the clarifications on rasters and the GP service interaction. +1 and I'll accept soon
    – two bugs
    Commented Aug 10, 2015 at 14:08
  • @KHibma do you have a link to your presentation slides? Also, do you have a blog?
    – ianbroad
    Commented Aug 10, 2015 at 22:10
  • No blog, but slides and data for this available here arcgis.com/home/item.html?id=49dce11d6038426f881ed28568311c75
    – KHibma
    Commented Aug 10, 2015 at 22:39
  • 1
    @KHibma thanks, I wish I would have known about your session at the UC!
    – ianbroad
    Commented Aug 11, 2015 at 3:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.