Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 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?

share|improve this answer
    
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. –  BitterCress May 23 '14 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 May 23 '14 at 17:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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