Classify

URL:
https://<rasteranalysistools-url>/Classify
Methods:
GET
Version Introduced:
10.6.1

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:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
//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

Use dark colors for code blocksCopy
1
2
3
4
{"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:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
//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:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
//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:

Use dark colors for code blocksCopy
1
2
3
4
{
"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:

Use dark colors for code blocksCopy
1
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:

Use dark colors for code blocksCopy
1
https://<raster analysis tools url>/Classify/jobs/<jobId>/results/outputRaster

Example usage

The following is a sample request URL for Classify :

Use dark colors for code blocksCopy
1
https://<raster analysis tools url>/Classify/submitJob?

JSON Request example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
{
 "paramName": "outputRaster",
 "dataType": "GPString",
 "value": {
  "itemId": "f121390b85ef419790479fc75b493efd",
  "url": "https://<server name>/arcgis/rest/services/Hosted/<service name>/ImageServer"
 }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.