Looking for a sample showing the new Spatial Analysis Service tasks

1007
7
11-14-2013 08:30 PM
StephenLead
Regular Contributor III
1) I'm looking for a sample showing how to use the new Spatial Analysis Service tasks, eg summarizeWithin.

Unlike other tasks these are not listed on the page at  https://developers.arcgis.com/en/javascript/jsapi and the help page doesn't list methods (eg summarizeWithin.execute).

Do we need to call this task manually using esri.request using the URL http://analysis.arcgis.com/arcgis/rest/services/tasks/GPServer/SummarizeWithin/submitJob?

(There is an example using the summarize nearby widget, but I'd prefer to use the task directly)

2) Does the spatial analysis service only work on ArcGIS.com layers? The documentation says:

The Spatial Analysis service contains a number of tasks that allow you to perform common spatial analyses on your hosted data


but also:

These tools allow end-users to easily perform analysis against layers hosted in Online as well as other layers they have access to.


Thanks,
Steve
0 Kudos
7 Replies
JeremyBartley
New Contributor
The summarize within widget is here:  https://developers.arcgis.com/en/javascript/jsapi/summarizewithin-amd.html

Spatial Analysis service rest api is documented here:  https://developers.arcgis.com/en/rest/analysis/

It requires an ArcGIS organizational or developer subscription. 

The results of analysis can be stored as new hosted layers in your organization subscription or delivered by value (as a feature collection).

When working with the rest api directly you will want to use the arcgis portal class in the api.  Your user will need to sign-in.  Also note that there are several analysis servers depending on where your hosted data is stored.  This can be identified by the helperServices property of the portal after a user has signed in (this is an area of the doc that needs work.  🙂

Jeremy
0 Kudos
StephenLead
Regular Contributor III
Thanks Jeremy,

Some additional samples showing how to interact with the REST API directly would be good.

The results of analysis can be stored as new hosted layers in your organization subscription


This sounds promising for what I'm trying to do. Is it an option to write the output to an existing AGOL layer, ie to edit and existing layer?

The documentation suggests not:

If provided, the task will create a feature service of the results


Could you open an enhancement request to allow the results to be written to an existing (editable) layer?

Thanks,
Steve
0 Kudos
deleted-user-VeZur_n9o0OZ
New Contributor III
Hi Steve/Jeremy,

Did you successfully use a spatial analysis service using the portal class as suggested? Got any code you could share? I'm trying to do the same in a hurry.

Thanks,
James
0 Kudos
StephenLead
Regular Contributor III
Hi James,

Unfortunately I can't help here - I ended up using an alternative approach so I never explored it any further.

Good luck,
Steve
0 Kudos
deleted-user-VeZur_n9o0OZ
New Contributor III
I'm up against a time constraint so I'm open to alternatives. Care to share @geo_james? I'm tech agnostic.

I'm going to start a new thread for my problem. I'm trying to submit the FindNearest task as a geoprocesser task and it's telling me my input params are missing. esri could really do with some code examples an example here:
https://developers.arcgis.com/rest/analysis/api-reference/find-nearest.htm
0 Kudos
StephenLead
Regular Contributor III
I'm up against a time constraint so I'm open to alternatives. Care to share @geo_james? I'm tech agnostic.


By alternative, I mean a totally different approach, where I'm bringing all the datasets in-house for pre-processing rather than trying to do it "live" using ArcGIS Online. So I'm still not much help, sorry.
0 Kudos
DavidColey
Frequent Contributor

Yes, if anyone could actaully tell us what tools and/or scripts are used to generate the Summarize Within or Summarize Nearby GP services that would be very helpful.  Unfortunately, there does not seem to be any help in this regard in either the REST or JavaScript APIs.  As an analyst, I can certainly produce summary statistics on the desktop using a variety of methods and tools.  But that in no way helps us to construct the same GP service in our own Advanced-licenced Server environment which would allow us to create our own jobs.

Thanks

David

0 Kudos