ArcGIS REST API

Generate Raster

Description

Generate Raster diagram

The Generate Raster task is a service that allows you to execute raster analysis on a distributed server deployment. The analysis can be specified either with a predefined server raster function keyword, or by giving a JSON object representation of a raster function chain.

Request parameters

ParameterDetails
rasterFunction

(Required)

Raster function to perform analysis on the input raster dataset. The value can be a string keyword for predefined raster functions such as NDVI, a JSON object that describes a raster function chain with a built-in functions that are known to the server, or the contents of a raster function template file (*.rft.xml) Please refer to the complete list of Raster Analysis functions to execute on a distributed server.

outputRaster

(Required)

The location where the service will generate the output raster.

Syntax: A JSON object describes the output raster.

Example:

{"itemId": <portal item id>}
{"url": <image service url}
{"serviceProperties":{"name":"testrasteranalysis",
  "serviceUrl":"https://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"},
  "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b", "folderId", "sdfwerfbd3ec25584d0d8f4",: }}

rasterArguments

The JSON string to specify the raster function arguments' value. It is optional because the argument value can also be defined in the function template. The rasterArguments parameter supports the RasterInfo argument for all raster functions. The information stored in RasterInfo allows you to specify the output raster dataset's properties such as cell size, extent, and nodata.

This parameter is optional as the arguments value can also be defined in the function template.

{
  "Raster": {
    "itemId": <portal item id>, 
    "url": <image service url>,
    "uri": <cloud raster uri or shared data path> 
  },   
  "ResamplingType": 1
}

rasterProperties

The rasterProperties setting can be used to set the output raster's key metadata properties.

{"SensorName": "Landsat 8", "CloudCover": 20}

context

Contains the additional setting Output Spatial Reference (outSR), which specifies where the output will be projected into the output spatial reference.

{"outSR": {spatial reference}}

f

The response format. The default response format is html.

Values: html | json

Response

When you submit a request, the task assigns a unique job ID for the transaction.

Syntax:

{
"jobId": "<unique job identifier>",
"jobStatus": "<job status>"
}

After the initial request is submitted, you can use the jobId to periodically check the status of the job and messages as described in Checking job status. Once the job has successfully completed, you use the jobId to retrieve the results. To track the status, you can make a request of the following form:

https://<raster analysis tools url>/GenerateRaster/jobs/<jobId>

When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:

https://<raster analysis tools url>/GenerateRaster/jobs/<jobId>/results/outRaster

Example usage

The following is a sample request url for GenerateRaster:

https://services.myserver.com/arcgis/rest/services/System/RasterAnalysisTools/GPServer/GenerateRaster/submitJob

JSON request example

rasterFunction=NDVI&
outputRaster={"itemId": "780d648db3545bba8861ad98df824a4"}&
rasterArguments={"Raster": {"itemId": "04180233981a4b978755d854687e149e"},"VisibleBandID":"3","InfraredBandID":"4"}&
rasterProperties={"SensorName": "Landsat 8", "CloudClover": 20}

JSON response example

The response returns the outRaster output parameter, which has properties for parameter name, data type, and value. The content of value is always the output raster dataset itemId and the image service url.

{
    "paramName": "outRaster",
    "dataType": "GPString",
    "value": {
        "itemId": "f121390b85ef419790479fc75b493efd", 
        "url": "https://<server name>/arcgis/rest/services/Hosted/<service name>/ImageServer"
    }
}