RasterizeFeatures

概要

Converts a polygon, polyline, or point feature class to a raster object.

ディスカッション

For more information about how this function works, see the Rasterize Features raster function.

The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.

構文

RasterizeFeatures (raster, feature_class, {class_index_field}, {resolve_overlap_method})
パラメーター説明データ タイプ
raster

The raster used to define the cell size and extent for the feature conversion.

Raster
feature_class

The point, line, or polygon feature class to convert to a raster object. Supported options include the path to the feature class or a FeatureSet.

String
class_index_field

The feature class field to assign values to pixels in the rasterized output. If no field is provided, pixel values will be assigned using the feature class's OBJECTID field.

(デフォルト値は次のとおりです None)

String
resolve_overlap_method

Specifies the method to assign pixel values in areas where features are overlapping.

  • FIRSTOverlapping areas will be assigned a value from the overlapping feature that is listed first in the feature class table. This is the default.
  • LASTOverlapping areas will be assigned a value from the overlapping feature that is listed last in the feature class table.
  • SMALLESTOverlapping areas will be assigned the smallest value from the overlapping features.
  • LARGESTOverlapping areas will be assigned the largest value from the overlapping features.

(デフォルト値は次のとおりです FIRST)

String
戻り値
データ タイプ説明
Raster

The raster object containing pixel values from the input features.

コードのサンプル

RasterizeFeatures example

Converts polygon data containing carbon storage capacity to a raster object.

from arcpy.sa import *
rasterized_polygons = arcpy.sa.RasterizeFeatures("sample.tif",
	"ParkPolygons", "CarbonQuantity", "SMALLEST")
rasterized_polygons.save("C:/arcpyExamples/outputs/ParkRaster.tif")
RasterizeFeatures example

Converts polygon data containing carbon storage capacity to a raster object.

# Import system modules
import arcpy
from arcpy.sa import *

# convert regional park features to raster with carbon quantity field
rasterized_polygons = arcpy.sa.RasterizeFeatures(sample_raster,
	"C:/data/MyData.gdb/ParkPolygons", "CarbonQuantity", "SMALLEST")

# save the output
rasterized_polygons.save("C:/arcpyExamples/outputs/ParkRaster.tif")

関連トピック