Classify

Classify

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

Request URL

http://<analysis url>/Classify/submitJob?
inputRaster={"itemId": "1780d648db3545bba8661ad98df824a4"}& inputClassifierDefinition={"EsriClassifierDefinitionFile":0,
"FileVersion":3,"NumberDef initions":1,"Definitions":[{"Classifier":"SupportVector","NumberClasses":2,"RasterIsSe gmented":true,
"NumberSegmBands":3,"NumberExtraBands":3,"Size":false,"Color":false ,"Mean":true,"Sigma":false,"Compactness":false,
"Rectangular":false,"Classes":[{"Class Value":1,"ClassName":"veg","Red":8,"Green":20,"Blue":38},{"ClassValue":2,
"ClassNa me":"imp","Red":174,"Green":107,"Blue":68}],"Mins":[0,0,0],"Maxs":[255,255,255],"T rainingSampleFile":"20160802120154mMJY",
"Raster1":"seg_GRnir_ps8.tif","Raster2": "GRnir_ps8.tif","MaxNumSamplesPerClass":500,"CrossValidationRate":0.98989898989 898994,
"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.5 2829131652661065,0.33179271708683478,0.31316526610644257]},
{"sv_coeff":[-32],"vector":[0.54283648959552633,0.56703250197839716,0.57356836814945555]}]}] }& 
outputName={“itemId": "04180233981a4b978755d854687e149e"}& additionalInputRaster={"itemId": "1780d648db3545bba8661ad98df824a4"}

Request Parameters

Parameter

Description

inputRaster

(Required)

Portal Item ID, Image Service URL, cloud raster dataset, or shared raster dataset that will be classified.

Syntax: A string describes the input raster.

Example:

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

Note: If multiple inputs are given the itemId takes the priority.

inputClassifierDefinition

(Required)

The classifier definition JSON generated from the Train Classifier service.

Syntax: a string describes the classifier definition.

Example:

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

outputName

(Required)

The location where the service will generate the output raster.

Example:

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

Note: If multiple inputs are given the itemId takes the priority.

additionalInputRaster

Portal Item ID, Image Service URL, cloud raster dataset, or shared raster dataset that will be classified. This can be a segmented raster.

Syntax: A string describes the input raster.

Example:

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

Note: If multiple inputs are given the itemId takes the priority.

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, use the jobId to retrieve the results. To track the status, you can make a request of the following form:

http://<analysis url>/Classify/jobs/<jobId>

Accessing results:

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:

http://<raster analysis url>/Classify/jobs/<jobId>/results/outputRaster?token=<your token>&f=json

Parameter

Description

outputRaster

The output raster item ID and URL.

Example: {"url": "http://<raster analysis url>/Classify/jobs/<jobId>/results/outputRaster"}

The result has properties for parameter name, data type, and value. The content of the 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"
 } 
}

Related topics

3/3/2017