Select to view content in your preferred language

Call to world elevation service SummarizeElevation task fails

1447
0
12-16-2013 05:06 AM
RainaldSuchan
Regular Contributor
I am trying to get the elevation for a coordinate point by calling the SummarizeElevation Task of the AGO world elevetion service.
When I call this GP tool I get a message indicating that the execution failed:

Job message: Submitted.
Job message: Executing...
Job message: Failed.

Here is a code sample:

public void getElevation(double x, double y, UserCredentials credentials) {
 SpatialReference spatRef = SpatialReference.create(SpatialReference.WKID_WGS84);
 Geoprocessor processing = new Geoprocessor("http://elevation.arcgis.com/arcgis/rest/services/Tools/Elevation/GPServer/SummarizeElevation", credentials);
 processing.setOutSR(spatRef);  
 processing.setProcessSR(spatRef);
 
 List<GPParameter> params = new ArrayList<GPParameter>();
 GPFeatureRecordSetLayer inFeatures = new GPFeatureRecordSetLayer("InputFeatures");
 inFeatures.setGeometryType(Geometry.Type.POINT);
 inFeatures.setSpatialReference(spatRef);
 inFeatures.addGraphic(new Graphic(new Point(x, y), null));
 params.add(inFeatures);
   
 processing.submitJobAndGetResultsAsync(params, new String[] {"OutputSummary"}, 
   new String[] {}, new GPJobResultCallbackListener() {
  
  @Override
  public void onError(Throwable e) {
   e.printStackTrace();
  }
  
  @Override
  public void onCallback(GPJobResource jobResource, GPParameter[] outParameters) {
   if (jobResource.getMessages() != null) {
    for (GPMessage message : jobResource.getMessages()) {
     System.out.println("Job message: " + message.getDescription());
    }
   }
   if (outParameters.length > 0 && outParameters[0] instanceof GPFeatureRecordSetLayer) {
    ArrayList<Graphic> graphicList = ((GPFeatureRecordSetLayer)outParameters[0]).getGraphics();
    for (Graphic graphic : graphicList) {
     Map<String, Object> attrs = graphic.getAttributes();
     for (Map.Entry<String, Object> entry : attrs.entrySet()) {
      System.out.println("Attr: " + entry.getKey() + " Value : " + entry.getValue());
     }
    }
   }
  }
 });
}


Using the same code with the ViewShed (http://elevation.arcgis.com/arcgis/rest/services/Tools/Elevation/GPServer/Viewshed) is working without any problems. So what ist wrong with my code? Or is there something wrong with the service? How can I ecexute this GP tool?
0 Kudos
0 Replies