Select to view content in your preferred language

geoprocessing service with result map service

1038
1
11-05-2012 07:55 AM
RandallBrown
Emerging Contributor
I have created a geoprocessing service from the results of a Grouping Analysis (new at 10.1).  I included a result map serivce in my gp service, but I have not been able to get it to show up in my web app.  I can take the url built using the jobid and paste it into a web browser and see the map service, so I know it is being created.  The code from my geoprocesser' jobComplete handler is below.  Any help?

Thanks,
Randy

private function gp_jobCompleteHandler(event:GeoprocessorEvent):void
{
 if (event.jobInfo.jobStatus == JobInfo.STATUS_SUCCEEDED)
 {
  gp.getResultData(gp.submitJobLastResult.jobId, "Output_Feature_Class");
     
  var resultMapUrl : String = "http://localhost:6080/arcgis/rest/services/GroupingAnalysis_102100_2/MapServer/jobs/" + event.jobInfo.jobId;
  var resultMapServiceLayer : ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer(resultMapUrl);
  //resultMapServiceLayer.id = "gpLayerResult";
  resultMapServiceLayer.visibleLayers = new ArrayList(['0']);
  map.addLayer(resultMapServiceLayer);            
 }
 else
 {
  showErrorMessage(event.jobInfo.jobStatus);
  CursorManager.removeBusyCursor();
 }
}
Tags (2)
0 Kudos
1 Reply
BjornSvensson
Esri Alum
I have created a geoprocessing service from the results of a Grouping Analysis (new at 10.1).  I included a result map serivce in my gp service, but I have not been able to get it to show up in my web app.  I can take the url built using the jobid and paste it into a web browser and see the map service, so I know it is being created.


The source code for the FlexViewer's Geoprocessing widget can be really helpful when trying to create API applications using geoprocessing.

For your case, see https://github.com/ArcGIS/ArcGISViewerForFlex/blob/master/src/widgets/Geoprocessing/GeoprocessingWid...

private function processResultImageLayer(paramName:String):void
{
    var lastExecutedJob:JobInfo = gp.submitJobLastResult;
    var resultImageLayer:GPResultImageLayer = gp.getResultImageLayer(lastExecutedJob.jobId, paramName);
    resultImageLayer.id = paramName;
    resultImageLayer.name = ("hiddenLayer_" + paramName);
    resultImageLayersOnMap.push(resultImageLayer);
    map.addLayer(resultImageLayer);
    layerOrderer.orderLayers();
}
0 Kudos