0

I have a GP service that requires a RasterData object as input. The RasterData object should hold a RasterDataSource object, but I'm not sure of the syntax to connect these two classes. The API reference has no examples. I have tried:

var dataSource = new RasterDataSource();
dataSource.workspaceId = "SharedData";
dataSource.dataSourceName = "raster.tif";
var rasterData = new RasterData();
rasterData = dataSource.toJson();

All properties of the RasterData object return "undefined". What is the correct syntax to do this?

1 Answer 1

1

A RasterDataSource() object refers to a file-based raster (i.e. already on the server in a known location).

A RasterData() object refers to either a network resource (i.e. via URL) or a recently uploaded file (i.e. via itemId).

You should not try to convert one into the other.

If the GP service requires a RasterData object, I don't know if you can send a RasterDataSource() object instead (assuming the workspace and file already exist on the server). Have you tried passing just the RasterDataSource()? If that doesn't work, maybe it's expecting you to upload the file first and then pass the itemId?

2
  • Thanks for responding and clarifying Tom. I have tried to pass the RasterDataSource() object and received the error messsage "invalid or missing parameters". RasterData() is definitely the way to go. I have tried using the URL of a raster on my web server: var rasterData = new RasterData(); rasterData.url = "http://webserver.com/raster.tiff" But that returned the same error. What upload operation would you suggest I use? That's where my knowledge of JavaScript is pretty fuzzy. Commented May 23, 2014 at 17:02
  • First confirm that the GP service has the upload capability turned on by browsing to the http://server.example.com/arcgis/rest/services/ServiceName/GPServer/uploads/ end point. If so, then see this Gist: gist.github.com/phpmaps/9791947
    – Tom Wayson
    Commented May 23, 2014 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.