Select to view content in your preferred language

Viewshed GP Tool

2884
2
08-15-2011 12:07 PM
MatthewKnight
Deactivated User
I am trying to use the Viewshed GPTool in Runtime.  I ran the tool successfully in Catalog and packaged it for Runtime, trying to run it with the same data is throwing an exception.

I spun up the service:
LocalGeoprocessingService _viewshedGPService = new LocalGeoprocessingService(_packageFolder + "/Viewshed.gpk");
_viewshedGPService.setServiceType(GPServiceType.SubmitJob);
_viewshedGPService.startAsync();

Then setup the parameters:
List<GPParameter> parameters = new ArrayList<GPParameter>();
GPString in_raster = new GPString("in_raster");
in_raster.setValue(*full path to a .dt1 file*);
parameters.add(in_raster);
  
GPString in_observer_features = new GPString("in_observer_features");
in_observer_features.setValue("/full/path/to/Observers.gdb/Observers");
parameters.add(in_observer_features);
  
GPRasterDataLayer out_raster = new GPRasterDataLayer("out_raster");
parameters.add(out_raster);

GeoProcessor _gpViewshed = new GeoProcessor(_viewshedGPService.getUrl() + "/Viewshed");
GPJobResource gpJobResource = _gpViewshed.submitJob(parameters);
String jobID = gpJobResource.getJobID();

When I try to get the job's status using gp.checkJobStatus(jobID) I get the following error:
Job failed!com.esri.core.io.EsriServiceException: Unable to complete operation.
Error executing tool.: ERROR 000816: The tool is not valid.

I am not sure what this error means, my underlying data should be valid since it worked in catalog.  I am not sure if there is a general problem with the parameters I used, or if the tool works in Runtime yet.  My license level is Advanced.

Any ideas on what might cause this problem?
0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

I'm not sure exactly how you've set up your Geoprocessing model, but I'm surprised to see the raster layer as an input as that would usually be intermediate data given the likely size of the data. This leads me to wonder if you're trying to run the viewshed system tool as-is without including it in a model?

I would expect the inputs of your model to be, for example, a point feature set for the input location (GPFeatureRecordSetLayer) and a linear unit value for the distance (GPLinearUnit). Typically in a Viewshed GP model which is then going to be published/shared as a package or service, the linear unit value is used in conjunction with the point feature set as the inputs to a buffer tool with the output from the buffer then being used to clip the raster on which the viewshed is finally run. You can also expose other parameters such as observer height.

For example this service on SampleServer1 demonstrates the inputs and outputs I would expect to see: http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Elevation/ESRI_Elevation_World/GPServer/V...

Additionally, in beta 1 we do not support raster data as a tool input but do hope to support this in beta 2.

Cheers

Mike
0 Kudos
MatthewKnight
Deactivated User
Cool, I did not know about that service.

However, when I submit my parameters I get back "java.lang.IllegalArgumentException: Invalid or unsupported wkid: 54003".
My input point is WGS84 (wkid 4326), I called both setProcessSR on the GeoProcessor and setSpatialReference on the input GPFeatureRecordSetLayer to set those spatial references as well, but it looks like at some point it's still trying to go to the default SR of 54003 which Runtime I guess does not currently support?

EDIT:  Fixed it, I wasn't setting the outSR on the GeoProcessor to WGS84.
0 Kudos