POLY2BIT

Converts polygons to a bitmap


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

Back to top

Description


POLY2BIT converts a polygon layer to a bitmap layer. All input polygons are assigned a pixel value of 1 in the output bitmap.
Back to top

Parameters


poly2bit(fili, dbvs, filo, dbsd, 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 Output file name 1 -    
DBSD str Output segment descriptor 0 - 64
Default: Bitmap polygons gridded from vectors
PIXRES List[float] Output pixel resolution 0 - 2 0.0000000001 -
FTYPE str Output file type 0 - 4 Default: PIX
FOPTIONS str Output file options 0 - 64  

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the name of the file that contains the input vector segment to be processed.

DBVS

Specifies the input segment containing the polygon vectors from which the bitmap layer will be created. The input vector layer can either be whole polygons or topological polygons.

FILO

Specifies the name of the file to which the new bitmap layer will be saved.

DBSD

Specifies a descriptor for the output bitmap segment. Descriptor may be up to 64 characters long.

PIXRES

This parameter applies only when a new FILO is being created. It allows you to define the pixel resolution or size (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. Decreasing the pixel size results in a larger output file and increased computation time.

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

Details

POLY2BIT accepts an input polygon layer (either a whole polygon or topological) and converts all inside areas to a bitmap layer. All of the polygons are represented as 1s in the output bitmap.

If the specified output file does not exist, a new file is created with the same projection information as the input polygon segment.

Back to top

Example

A bitmap layer is built based on the polygons in lakes.shp and is saved to a bitmap segment in a new TIF file, lakesBIT.tif.

from pci.poly2bit import poly2bit

fili     = "lakes.shp"       # input polygon file
dbvs     = [1]               # polygon layer
filo     = "lakesBIT.tif"    # output file to be created
dbsd     = ''                # use default, "Bitmap polygons gridded from vector"
pixres   = [10,10]           # make 10 meter square pixels
ftype    = "TIF"             # output format type
foptions = ""                # output options

poly2bit( fili, dbvs, filo, dbsd, pixres, ftype, foptions )

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