Calling the SummarizeElevation task of AGO World Elevation Service fails

3239
6
12-16-2013 05:38 AM
RainaldSuchan
Occasional Contributor
I am trying to call the SummarizeElevation task of the AGO World Elevation Service using the REST API with pure HTTP calls.

In the first step I get a token with my AGO account (https://www.arcgis.com/sharing/generateToken). Then I make a HTTP call to this URL:

http://elevation.arcgis.com/arcgis/rest/services/Tools/Elevation/GPServer/SummarizeElevation/submitJob?InputFeatures={"geometryType":"esriGeometryPoint","spatialReference":{"wkid":4326},"features":[{"geometry":{"x":9.4,"y":50.3}}]}&f=json&token=HxFbZ4vykUBrsLhQghhKsYEcspjJEuqs5aJ3EOBpMoOxlehswHyMlI29ZpEN06j1Yk6xhKD1pfOc6Bqn-eYe484vxBoE469ZUuRhPPlXx6DfWNZkUsnM0YeLt1U5z7Yh


I get back a job id, but when I then get the job status, I get a status failed and no result is created.
Is there something wrong with the URL or the input values? Or what ist going wrong?

Also in the submitJob test page: http://elevation.arcgis.com/arcgis/rest/services/Tools/Elevation/GPServer/SummarizeElevation/submitJ... I can't get it working.

On the other hand the ViewShed task of the same service works with the same input values in the URL without any problem.
6 Replies
KevinHibma
Esri Regular Contributor
I'm not the owner of this, but I've looked at it and it does appear to be behaving strangely.
I've notified the relevant people and we'll take a closer look.
(I'll re-post when I get more information)

thanks
KevinHibma
Esri Regular Contributor
Ok, it actually does look ok.
I was trying to consume it in Desktop and didn't understand why I couldn't enter a point. I was made aware that this service can take a point, line or poly as input. Because of this, no schema is set.

After adding an OID field and value to your input JSON, it works.
Give this a try.
{
    "geometryType": "esriGeometryPoint",
    "spatialReference": {
        "wkid": 4326
    },
    "fields": [
        {
            "name": "OID",
            "type": "esriFieldTypeOID",
            "alias": "OID"
        }
    ],
    "features": [
        {
            "attributes": {
                "OID": 1
            },
            "geometry": {
                "x": 9.4,
                "y": 50.3
            }
        }
    ]
}
RainaldSuchan
Occasional Contributor
Great, that works! Thank you very much Kevin. You made my day.

Is there a way to recignze in the task description whether I need to provide an OID field? For me it is not clear, why I need it in the SummarizeElevation task but not in the Viewshed task.

It would be good, if the service could send an error message with some information about the reason why the execution didn't work.

I have another question about this GP Service. Does it also support the SOAP interface? I couln't get the WSDL at http://elevation.arcgis.com/arcgis/services/Tools/Elevation/GPServer?wsdl
I would also like to get the elevation of a coordinate point using SOAP.

Thanks
Rainald
KevinHibma
Esri Regular Contributor
Glad to hear it works.

I'll pass on your feedback about the OID field.

As for using SOAP, the only information I can find is on this page: https://developers.arcgis.com/en/rest/elevation/ which states:
The Elevation Analysis services can be accessed through a REST API. More information on the services, the source data, and how to access them is available in Getting started with Elevation Analysis services.

(making no mention of SOAP)
RainaldSuchan
Occasional Contributor
Ok, then it seams that the Service doesn't support the SOAP Interface.

I have some additional feedback to this service and the REST API to call it:

My task was quite simple: I just wanted to get the elevation for a given x/y coodinate. Normally I would say that should only take about one or two hours.
In the documentation I saw, that I have to get a token first, because the service needs authentication. So I used an HTTP call to
https://www.arcgis.com/sharing/generateToken?username=<AGOUser>&password=<AGOPassword>&f=json&referer=<MyReferer>
In the following calls to the service I append a URL parameter for the token:
<ServiveUrl>&token=<MyToken>
an send this by an HTTP request. But that just doesn't work! I get back an "Invalid token".
It took me a long time to get that working. It worked for me, if I add the HTTP header 'Referer' to the call with the same value as I specified in the token request:

GET <ServiveUrl>&token=<MyToken> HTTP/1.1
Host: elevation.arcgis.com
Referer: <MyReferer>

Then the service accepts the token. But i didn't find this in the documentation. Just adding the token to the URL is not working.
When I use fiddler to analyse the HTTP traffic send by an application using an Esri client API, I see that it sets a cookie with the token. Maybe this is another way to ge the request working. But where is all this described?

The second problem was the one with the input JSON and the correct syntax which I described in this thread above.

In total it took me about 4 days to simply get the elevation for a coordinate point. I would be glad if this would be easier and the dokumentaion would be better.


Regards
Rainald
KevinHibma
Esri Regular Contributor
Rainald,

My apologies this was a painful task.
I've shared this thread and your comments with some people here internally for their review.
I can't comment much on the token/headers as this isn't in my specialty, I can comment a little more on the input JSON though.

This particular service, documented here: https://developers.arcgis.com/en/rest/elevation/api-reference/summarize-elevation.htm
requires a complete gpfeaturerecordset as input (mentioned previously). We recommended submitting a complete parameter for all online services. Including all elements of a parameter should generally reduce unexpected results. This includes the definition of fields, spatialref and geometry. The syntax example hints at that, but doesn't provide a sample you can copy/paste. Again, I'll share this feedback with the team and see if we can provide better information.