| Environments | PYTHON :: EASI :: MODELER |
| Quick links | Description :: Parameters :: Parameter descriptions :: Details :: Example :: Related |
| Back to top |
| Back to top |
poly2ras(fili, dbvs, filo, dboc, imgtyp, fldnme, pixres, ftype, foptions)
| Name | Type | Caption | Length | Value range |
|---|---|---|---|---|
| FILI * | str | Input file name | 1 - | |
| DBVS * | List[int] | Input polygon layer | 1 - 1 | |
| FILO * | str | Ouput file name | 1 - | |
| DBOC | List[int] | Output raster channel | 0 - 1 | |
| IMGTYP | str | Output raster type | 0 - 15 | Raster | Thematic Raster Default: Raster |
| FLDNME | str | Attribute field name | 0 - | Default: ATTRIBUTE |
| PIXRES | List[float] | Pixel resolution | 0 - 2 | 0.1 - |
| FTYPE | str | Output file type | 0 - 4 | Default: PIX |
| FOPTIONS | str | Output file options | 0 - 64 |
| Back to top |
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.
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.
| Back to top |
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 |
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.
from pci.poly2ras import poly2ras fili = "irvine.pix" # input polygon file dbvs = [31] # polygon layer filo = "irv31ras.tif" # output file to be created dboc = [] # output channel will be created imgtyp = "" # default, "Raster" fldnme = "ShapeID" # use ShapeID as pixel values pixres = [10,10] # make 10 meter square pixels ftype = "TIF" # output format type foptions = "" # output format options poly2ras( fili, dbvs, filo, dboc, imgtyp, fldnme, pixres, ftype, foptions )
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.