Skip To Content

Classify

Description

Classify diagram

The Classify task will create categories of pixels based on the input raster and the classifier definition JSON that was generated from the Train Classifier service.

Request parameters

ParameterDetails
inputRaster

(Required)

Portal item ID, image service URL, cloud raster dataset, or shared raster dataset that will be classified. If multiple points are given, the itemId takes priority.

Syntax: A string describes the input raster

Example:

//Portal Item ID
{"itemId": <portal item id>}

//Image Service URL
{"url": <image service url}

//Service Properties
{"serviceProperties":{"name":"testrasteranalysis",
  "serviceUrl":"https://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"},
  "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b", "folderId", "sdfwerfbd3ec25584d0d8f4",: }}

inputClassifierDefinition

(Required)

The classifier definition JSON generated from the Train Classifier service.

Syntax: A string describes the classifier definition


{"EsriClassifierDefinitionFile":0,
 "FileVersion":3,"NumberDefinitions":1,
 "Definitions":[...]
}

outputName

(Required)

The location where the service will generate the output raster. If multiple inputs are given, the itemId takes priority.

Syntax: A JSON object describes the output raster.

Example:

//Portal Item ID
{"itemId": <portal item id>}

//Image Service URL
{"url": <image service url}

//Service Properties
{"serviceProperties":{"name":"testrasteranalysis",
  "serviceUrl":"https://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"},
  "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b", "folderId", "sdfwerfbd3ec25584d0d8f4",: }}

additionalInputRaster

The portal item Id, image service URL, cloud raster dataset, or shared raster dataset that will be classified. This can be a segmented raster. If multiple inputs are given, itemIds take priority.

Syntax: A string describes the input raster.

Example:

//Portal Item ID
{"itemId": <portal item id>}

//Image Service URL
{"url": <image service url}

//Service Properties
{"serviceProperties":{"name":"testrasteranalysis",
  "serviceUrl":"https://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"},
  "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b", "folderId", "sdfwerfbd3ec25584d0d8f4",: }}

Response properties

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 jobId to periodically review the status of the job and messages as described in Checking job status. Once the job has successfully completed, use jobId to retrieve the results. To track the status, you can make a request of the following form:

https://<raster analysis tools url>/Classify/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>/Classify/jobs/<jobId>/results/outputRaster

Example usage

The following is a sample request URL for Classify:

https://<raster analysis tools url>/Classify/submitJob?

JSON Request example


 inputRaster={"itemId": "1780d648db3545bba8661ad98df824a4"}&
 inputClassifierDefinition={
  "EsriClassifierDefinitionFile": 0,
  "FileVersion": 3,
  "NumberDefinitions:" 1,
  "Definitions":[
    {"Classifier": "SupportVector",
     "NumberClasses": 2,
     "RasterIsSegmented": true,
     "NumberSegmBands": 3,
     "NumberExtraBands": 3,
     "Size": false,
     "Color": false,
     "Mean": true,
     "Sigma": false,
     "Compactness": false,
     "Rectangular": false,
     "Classes":[
       {"ClassValue": 1,
        "ClassName": "veg",
        "Red": 8,
        "Green": 20,
        "Blue": 38
       },
       {"ClassValue": 2,
         "ClassName": "imp",
         "Red": 174,
         "Green": 107,
         "Blue": 68
       }
     ],
     "Mins": [0,0,0],
     "Maxs": [255,255,255],
     "TrainingSampleFile": "20160802120154mMJY",
     "Raster1": "seg_GRnir_ps8.tif",
     "Raster2": "GRnir_ps8.tif",
     "MaxNumSamplesPerClass": 500,
     "CrossValidationRate": 0.98989898989898994,
     "svm_type": "c_svc",
     "kernel_type": "rbf",
     "gamma": 0.03125,
     "costC": 32, 
     "nr_class": 2,
     "total_sv": 2,
     "rho": [-0.87380599975585938],
     "label": [0,1],
     "nr_sv": [1,1],
     "SV":[
       {"sv_coeff": [-32],
        "vector": [0.54283648959552633,0.56703250197839716,0.57356836814945555]
       }
     ]  
    }
  ]
 }&
 outputName={"itemId": "04180233981a4b978755d854687e149e"}&
 additionalInputRaster={"itemId": "1780d648db3545bba8661ad98df824a4"}

JSON response example

The response returns the outputRaster 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": "outputRaster",
 "dataType": "GPString",
 "value": {
  "itemId": "f121390b85ef419790479fc75b493efd", 
  "url": "https://<server name>/arcgis/rest/services/Hosted/<service name>/ImageServer"
 } 
}