GPRasterData

3260
2
04-18-2016 08:24 AM
ChristinaKochan1
Occasional Contributor

What is a valid input value for the GPRasterData type? I created a GPK from the Clip Raster tool and no inputs I have tried have been successful. The constructor is GPRasterData(string name, System.Uri uri, string format).

For the Uri, I have tried using a path from an ArcGISOnline server, from an ArcGISDynamicMapServiceLayer, and from just the local file system, but every time my Geoprocessor SubmitJobAsync returns Failed with no additional information. I have had success with all other types of GPParameters with various other GPKs I have created, but this one just won't work and won't give me any more information about the failure.

Please, can someone point me to a working example using the GPRasterData type? This application will be in an entirely offline environment so the input will need to be locally accessible.

I did find this question stating that using an elevation service path as the input will not work. So what does work??

0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

Unfortunately the LocalServer cannot download raster datasets from remote servers and only supports local datasets. The name parameter is the name of the task parameter and the Uri should be the path to your raster on disk e.g. "C:\MyData\MyRaster.tif". Another option is to use inline variable substitution to expose a GPString parameter from your task which is used as the raster path within the model/script.

Cheers

Mike

ChristinaKochan1
Occasional Contributor

It turns out the problem with the local file input was that I wasn't specifying UriKind.Relative when creating the Uri. If I let it use the default of UriKind.Absolute then it appends "file:///" to the front of the Uri path, which causes the GPK to fail.

It might be worth adding this info to the API documentation for the GPRasterData class.

0 Kudos