Summary
Converts a raster to a feature dataset as points, lines, or polygons.
Illustration
Usage
This raster analysis portal tool is available when you are signed in to an ArcGIS Enterprise portal that has an ArcGIS Image Server configured for Raster Analysis . When the tool is invoked, ArcGIS Pro serves as a client and the processing occurs in the servers federated with ArcGIS Enterprise. The portal tool accepts layers from your portal as input and creates output in your portal.
The input raster layer supports a layer from the portal, a URI or URL to an image service, or the output from the Make Image Server Layer tool. This tool does not support local raster data or layers.
Rasters can be converted to point, line, or polygon features.
Syntax
arcpy.ra.ConvertRasterToFeature(inputRaster, field, outputType, {simplifyLinesOrPolygons}, outputName, {createMultipartFeatures}, {maxVerticesPerFeature})
Parameter | Explanation | Data Type |
inputRaster | The input raster layer. | Feature Set |
field | A field that specifies the conversion value. It can be any integer or text value. A field containing floating-point values can only be used if the output is to a point dataset. The default is the Value field, which contains the value in each raster cell. | Field |
outputType | Specifies the output type.
| String |
simplifyLinesOrPolygons (Optional) | Specifies whether lines or polygons will be simplified (smoothed). The smoothing is done in such a way that the line contains a minimum number of segments while remaining as close as possible to the original raster cell edges.
This parameter is only supported if outputType is LINE or POLYGON. | Boolean |
outputName | The output feature class that will contain the converted points, lines, or polygons. | String |
createMultipartFeatures (Optional) | Specifies whether the output polygons will consist of single-part or multipart features.
This parameter is only supported if outputType is POLYGON. | Boolean |
maxVerticesPerFeature (Optional) |
The vertex limit used to subdivide a polygon into smaller polygons. This parameter produces similar output as that created by the Dice tool in the Data Management toolbox. If left empty, the output polygons will not be split. This is the default. This parameter is only supported if outputType is POLYGON. | Long |
Derived Output
Name | Explanation | Data Type |
outputFeatures | The output features. | Feature Class |
Code sample
This example converts a raster to polygon features.
import arcpy
arcpy.ConvertRasterToFeature_ra('https://MyPortal.esri.com/server/rest/services/Hosted/Landuse/ImageServer',
'Value', 'POLYGON', 'SIMPLIFY', 'outFeatures')
This example converts a raster to polygon features.
#-------------------------------------------------------------------------------
# Name: ConvertRasterToFeature_Ex_02.py
# Description: Convert a raster to polygon features.
#
# Requirements: ArcGIS Image Server
# Import system modules
import arcpy
# Set local variables
inRaster = 'https://MyPortal.esri.com/server/rest/services/Hosted/Landuse/ImageServer'
inField = 'Value'
outType = 'POLYGON'
simplify = 'SIMPLIFY'
outFeatures = 'outFeatures'
arcpy.ConvertRasterToFeature_ra(inRaster, inField, outType, simplify, outFeatures)
Environments
Licensing information
- Basic: Requires ArcGIS Image Server
- Standard: Requires ArcGIS Image Server
- Advanced: Requires ArcGIS Image Server