POLY2RAS

Converts polygons to a raster


EnvironmentsPYTHON :: EASI :: MODELER
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Example :: Related

Back to top

Description


POLY2RAS converts, or rasterizes, polygons in a vector layer to a raster layer.
Back to top

Parameters


Name Type Caption Length Value range
FILI * String Input file name 1 - 192  
DBVS * Integer Input polygon layer 1 - 1  
FILO * String Ouput file name 1 - 192  
DBOC Integer Output raster channel 0 - 1  
IMGTYP String Output raster type 0 - 15 Raster | Thematic Raster
Default: Raster
FLDNME String Attribute field name 0 - 192 Default: ATTRIBUTE
PIXRES Float Pixel resolution 0 - 2 0.1 -
FTYPE String Output file type 0 - 4 Default: PIX
FOPTIONS String Output file options 0 - 64  
MONITOR String Monitor mode 0 - 3 ON, OFF
Default: ON

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the name of the file containing the polygon vector layer to rasterize.

DBVS

Specifies the vector segment containing the polygons to be converted to rasters. The input vector layer can either be whole polygons or topological polygons.

FILO

Specifies the name of the file to receive the output raster.

If FILO specifies an existing file, the DBOC parameter must specify an existing channel, which will be updated. If FILO does not already exist, a new file will be created. The new file will base its georeferencing on the input polygon data.

DBOC

Specifies the output raster channel to receive the output results.

If the specified output file already exists, this parameter must specify an existing channel. DBOC defaults to 1 only when a new file is created.

When creating a new output channel, its bit depth is automatically determined, depending on the values to be written to the raster.

IMGTYP

Specifies the output raster channel or layer type.

Acceptable values are:

FLDNME

Specifies the name of the attribute field whose value is to be used to grid the polygons. If this parameter is specified as (z-coord), the z-coordinate of the first vertex of each vector shape is used. If the specified attribute does not exist and it is not (z-coord), the ShapeID of the vector shapes are used for gridding. This parameter is ignored when the output is a thematic raster.

The only time the field can be of type text (string) is if it is a classification field created by Object Analyst. In such a case, POLY2RAS can be used to rasterize the Object Analyst classification.

PIXRES

This parameter applies only when a new output file is being created. It allows you to specify a pixel resolution (in meters) for the output file. By default, the pixel size is set be the same as the input file. The pixel size is used to determine the number of pixels and lines in the output file. Thus, decreasing the pixel size results in a larger output file and increased computation time.

Acceptable values are:

x > 0.0, y > 0.0
					

FTYPE

Optionally specifies the output file format type, represented by a three- or four-letter code.

For a complete list of GDB-recognized file types and their codes, see GDB file formats in the Technical Reference section of the CATALYST Professional online Help.

FOPTIONS

Different options are available for different file types (see the FTYPE parameter). The options are described in GDB file formats in the Technical Reference section of the CATALYST Professional online Help.

For PIX format, FOPTIONS defaults to BAND.

MONITOR

The program progress can be monitored by printing the percentage of processing completed. A system parameter, MONITOR, controls this activity.

Available options are:

Back to top

Details

POLY2RAS converts polygons in a vector layer to a raster layer.

First, if the complete boundary of each polygon is specified in a single vector, the polygon scanline conversion algorithm is applied to directly grid the polygons. In order to use this algorithm, each vector in the specified vector layers must be a closed curve (or several closed rings) with at least four vertices (including a pair of duplicated vertices). The scanline conversion algorithm can process polygons with holes or even with islands within holes, as long as the entire boundaries (exterior and interior) of each polygon are given in one shape.

The output channel type is automatically determined, depending on the values to be written to raster.

POLY2RAS accepts whole polygons or topological polygons as input. The output pixel value for a polygon is derived from the vector attribute value whose name is given by the FLDNME (Field Name) parameter unless you're outputting a thematic raster. When creating thematic rasters the pixel values are determined automatically.

Any raster area not covered by a polygon is filled with a background value. This background value (typically chosen as zero, if available) should be different from all other polygon gray levels.

Back to top

Example

Polygons from Irvine.pix segment 31 are converted to a raster layer. The output pixel values will be from the ShapeID of the input polygons. A new file to hold the raster will be created called irv31ras.tif.

EASI>FILI     = "irvine.pix"      ! input polygon file
EASI>DBVS     = 31                ! polygon layer
EASI>FILO     = "irv31ras.tif"    ! output file to be created
EASI>DBOC     =                   ! output channel will be created
EASI>IMGTYP   =                   ! default, "Raster"
EASI>FLDNME   = "ShapeID"         ! use ShapeID as pixel values
EASI>PIXRES   = 10,10             ! make 10 meter square pixels
EASI>FTYPE    = "TIF"             ! output format type
EASI>FOPTIONS =                   ! output format options 

EASI>run poly2ras            
			

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.