ReturnImageLayer Problems

2747
8
07-13-2010 04:27 PM
WilliamNichols
New Contributor
Having some issues with adding a ReturnImageLayer to the map.  GP service creates a GPRasterDataLayer that should be added to the map through a result map service.  GP service works, and I'm able to submit a job, view the results via the REST interface, and add the result service to a map using the Javascript API.

After some debugging with VS and Fiddler, it appears that the ParameterName for the ReturnImageLayer is blank, and so the request for a mapImage is missing the ParameterName, and an error is returned.  If I add the parameter name into the request by hand (.../jobs/snipjobid/results/PARAMNAME?bbox=-10872311.2728836...) it works. Anyone run into this before?

I've included some of the request headers and responses.  This is using the recent 2.0 SLAPI release and a Pre-release Server 10.

geoprocessorTask.GetResultImageLayerAsync(e.JobInfo.JobId, "Flood_Depth");
GET /ArcGIS/rest/services/ND_SLR/NuecesDelta_SLR/GPServer/SLR_NuecesDelta/jobs/
j8913d1246db449c78436fa745f507520/results/Flood_Depth?f=json& HTTP/1.1

{"value":{"mapImage":{"href":"http://hrigis.tamucc.edu/arcgisoutput/
_ags_map106ed48be6024f549af1cef65e75dec1.png","width":400,"height":400,"extent":{"xmin":-10869299.3108114,"ymin":3224453.07514437,"xmax":-10851171.3108114,"ymax":3242581.07514437,"spatialReference":{"wkid":3857}},"scale":171287.8464}}}


MapObject.Layers.Add(gpImageLayer);
GET /ArcGIS/rest/services/ND_SLR/NuecesDelta_SLR/GPServer/SLR_NuecesDelta/jobs/
j8913d1246db449c78436fa745f507520/results/?bbox=-10872311.2728836,3216048.23047136,-10847376.2748808,3249606.21994377&size=1148,1545&format=png24&transparent=true&imageSR=102100&bboxSR=102100&f=json HTTP/1.1

{"error":{"code":500,"message":"Unable to get value of param '' for Job ID 'j8913d1246db449c78436fa745f507520'. The job may not exist or it could still be executing or could have failed.","details":[]}}
0 Kudos
8 Replies
DominiqueBroux
Esri Frequent Contributor
The parameterName is supposed to be given as argument of the method
geoprocessorTask.GetResultImageLayerAsync. I guess you initialized it correctly.

Which API version are you using? Are you using a proxy url?
0 Kudos
WilliamNichols
New Contributor
The parameterName is supposed to be given as argument of the method
geoprocessorTask.GetResultImageLayerAsync. I guess you initialized it correctly.

Which API version are you using? Are you using a proxy url?


Thanks for quick response, using the new final 2.0 (build 314?) downloaded yesterday, with server 10 pre-release.  Not using a proxyUrl.

Did some further testing, and copied the clipfeatures sample and looked at the requests and responses, and compared them to what I was getting.  The requests look identical, but for some reason, the paramName and dataType are missing from the response, so the ResultImageLayer Parameter Name is null, hence the "Unable to get value of param" when requesting a mapImage.

geoprocessorTask.GetResultImageLayerAsync(e.JobInfo.JobId, "Clipped_Counties");
GET /ArcGIS/rest/services/SamplesNET/USA_Data_ClipTools/GPServer/ClipCounties/jobs/jcadb48bc19394e60a31d307112b2a111/results/Clipped_Counties?f=json& HTTP/1.1

{"paramName":"Clipped_Counties","dataType":"GPFeatureRecordSetLayer","value":{"mapImage":{"href":"http://serverapps.esri.com/arcgisoutput/_ags_map605d9c70cf844c87990be167ac8adcc3.png","width":400,"height":400,"extent":{"xmin":-143.249128919861,"ymin":-8.24912891986064,"xmax":-56.7508710801394,"ymax":78.2491289198606,"spatialReference":{"wkid":4269}},"scale":90880095.9836899}}}


geoprocessorTask.GetResultImageLayerAsync(e.JobInfo.JobId, "Flood_Depth");
GET /ArcGIS/rest/services/ND_SLR/NuecesDelta_SLR/GPServer/SLR_NuecesDelta/jobs/j8913d1246db449c78436fa745f507520/results/Flood_Depth?f=json& HTTP/1.1

{"value":{"mapImage":{"href":"http://hrigis.tamucc.edu/arcgisoutput/_ags_map106ed48be6024f549af1cef65e75dec1.png","width":400,"height":400,"extent":{"xmin":-10869299.3108114,"ymin":3224453.07514437,"xmax":-10851171.3108114,"ymax":3242581.07514437,"spatialReference":{"wkid":3857}},"scale":171287.8464}}}
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Strange.

So the problem is coming from the server and not from the SL API since the REST API returns an incomplete response.

What is the response of the last request concerning the status of your job?

In the sample it's :

GET /ArcGIS/rest/services/SamplesNET/USA_Data_ClipTools/GPServer/ClipCounties/jobs/j3be38a36fe45408ba4da466d98743295/?f=json&_ts=634147921537343750 HTTP/1.1

{
"jobId" : "j3be38a36fe45408ba4da466d98743295",
"jobStatus" : "esriJobSucceeded",
"results" : {
"output_zip" : {"paramUrl" : "results/output_zip"},
"Clipped_Counties" : {"paramUrl" : "results/Clipped_Counties"}
},
"inputs" : {
"Input_Features" : {"paramUrl" : "inputs/Input_Features"},
"Linear_unit" : {"paramUrl" : "inputs/Linear_unit"}
},
"messages" : [
{"type" : "esriJobMessageTypeInformative", "description" : "Submitted."},
{"type" : "esriJobMessageTypeInformative", "description" : "Executing..."},
{"type" : "esriJobMessageTypeInformative", "description" : "Succeeded."}
]
}
0 Kudos
WilliamNichols
New Contributor
Response of last request on job status

GET /ArcGIS/rest/services/ND_SLR/NuecesDelta_SLR/GPServer/SLR_NuecesDelta/jobs/j100769e6ce284eb38d252f4cadabf61a/?f=json&_ts=634147878376562500 HTTP/1.1

{
"jobId":"j100769e6ce284eb38d252f4cadabf61a",
"jobStatus":"esriJobSucceeded",
"results":{
"Flood_Depth":{"paramUrl":"results/Flood_Depth"}},
"inputs":{
"FloodLevelInput":{"paramUrl":"inputs/FloodLevelInput"}},
"messages":[
{"type":"esriJobMessageTypeInformative","description":"Submitted."},
{"type":"esriJobMessageTypeInformative","description":"Executing..."},
{"type":"esriJobMessageTypeInformative","description":"Succeeded."}
]
}

It does appear to be a problem with the response from the REST API.  Thought it might be a problem with the SL API, since I tried the same operation using the javascript API and got it to work.  It appears the JSAPI getResultImageLayer works a bit differently, and and doesn't actually make a call to the server, only when the layer is added to the map does it request a mapImage.

I'll post this in the REST API forum, but if you can think of a workaround it would be appreciated.

Thanks for the help!
0 Kudos
WilliamNichols
New Contributor
A resolution for anyone else who stumbles across this issue, apparently is was an issue with Server 10 Pre Release.  A reformat and install of the official Server 10 fixed the problem.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
I am glad you eventually made it working. You are right it was likely an issue wit pre release version.
0 Kudos
CharlesSmith1
New Contributor
Hi all,

I am unable to get a ResultImageLayer and came across this thread.

I can get a GPFeatureRecordSetLayer using ResultData and add the feature geometries individually.

I am using ArcServer 10.1 so it is not a pre-release problem.

I can see the map service that accompanies the geoprocessing service and the legend / symbology in this map service.

I am doing this with the JavaScriptAPI.

Using Firefox I see a �??500 Internal Server Error�?� but there is no other messages.

Could be as simple as my call:

gp2.getResultImageLayer(jobInfo.jobId, "Test01", imageParameters, addGPServiceResult2, errorProcessing)

function addGPServiceResult2(gpImageLayer) {
   map.addLayer(gpImageLayer);
}

I�??m not sure what the ParameterName �??Test01�?� should refer to although I�??ve tried ever possibility that seemed reasonable.

Any help will be greatly appreciated.

Thanks,
Charles
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Hi Charles,

I�??m not sure what the ParameterName �??Test01�?� should refer to although I�??ve tried ever possibility that seemed reasonable.


To know the parameter names of a GP service, you can make a web request to the GP URL, you will get the infos.
For example, with this service : http://serverapps.esri.com/ArcGIS/rest/services/SamplesNET/USA_Data_ClipTools/GPServer/ClipCounties the output parameter is called 'Clipped_Counties'.

You can also check whether your service is synchronous or asynchronous, because the way to call it depends on that model.


gp2.getResultImageLayer(jobInfo.jobId, "Test01", imageParameters, addGPServiceResult2, errorProcessing)

function addGPServiceResult2(gpImageLayer) {
map.addLayer(gpImageLayer);
}


Looks like it's not Silverlight code:). I suggest you post again your question in the JS forum.
0 Kudos