Convert Raster to Feature

Convert Raster to Feature task

This task converts a raster to a point, line or polygon feature dataset.

Request URL

http://<raster analysis url>/ConvertRastertoFeature/submitJob

Request Parameters

Following is the list of parameters with syntax and details for each.

Parameter

Description

inputRaster

(Required)

The input raster that will be converted to a feature dataset.

Syntax: It can be specified as a Portal Item ID, a URL to an raster image service layer, a cloud raster dataset, or a shared raster dataset.

Data type: GPString

Domain: Integer or float raster

Examples:

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

outputName

This is the output feature service of the results. You define the name of the service. If outputName is not supplied, the task will return a feature collection.

Example:

{
    "serviceProperties": {
        "name": "<service name>"
    }
}

field

(Required)

A field on theinputLayer will be used for the conversion.

It can be any numerical or a string field.

Data type: GPString

Domain: Integer, float or string field

Default: Value

Example:

  • "field": "Landuse"

outputType

The type of output to be created. If the input is a floating point raster, then only a point dataset can be created. If the input is an integer raster, then a point, line or polygon dataset can be created.

Syntax: The outputType can be one of the following:

  • Point — The output is a point dataset.
  • Line — The output is a line dataset.
  • Polygon — The output is a polygon dataset.

Data type: GPString

Domain: Point, Line or Polygon

Default: Point

Example:

  • "outputType": "Polygon"

simplifyLinesOrPolygons

This option that specifies how the features should be smoothed is only available for line and polygon output.

Syntax: outputType

Data type: GPBoolean

Domain: Simplify (true) or No_Simplify (false)

Values: true | false

  • Simplify: The features will be smoothed out. This is the default.
  • No_Simplify: The features will follow exactly the cell boundaries of the raster dataset.

Default: True

context

Context contains additional settings that affect task execution.

For this tool, there are three settings.

  • Extent (extent) — a bounding box that defines the analysis area. Only those areas in the inputZoneLayer that intersect the bounding box will have the statistics calculated.
  • Output Spatial Reference (outSR) — the output raster will be projected into the output spatial reference.
  • Snap Raster (snapRaster) — the output raster will have its cells aligned with the specified snap raster.

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 the topic Checking job status. Once the job has successfully completed, you use the jobId to retrive the results. To track the status, you can make a request of the following form:

http://<raster analysis url>/ConvertRasterToFeature/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>/jobs/<jobId>/results/featureLayer?token=<your token>&f=json

Parameter

Description

outputFeatures

These are the feature results of the conversion from the raster input.

Example:

{"url": 
"http://<raster analysis url>/ConvertRasterToFeature/jobs/<jobId>/results/resultLayer"}

The result has properties for parameter name, data type, and value. The contents of value depends upon the outputName parameter provided in the initial request.

  • If outputName was provided, value contains the url to the feature service layer.

    {
    "paramName":"resultLayer", 
    "dataType":"GPString",
    "value":{"url":"<hosted featureservice layer url>"}
    }
    

  • If outputName was not provided, value contains a feature collection.

    {
    "paramName":"resultLayer",
    "dataType":"GPString",
    "value":{"layerDefinition": {}, "featureSet": {}}
    }
    

Related topics

3/3/2017