Vector encoding

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

Back to top


LINE2RAS encodes (burns) vector data into a raster image channel using the attribute or Z value associated with each line and/or point in a vector segment. GRDINT or PYRINT is used afterwards to grid (interpolate) raster values between encoded vectors yielding a complete surface, for example, a complete Digital Elevation Model (DEM).
Back to top


line2ras(fili, dbvs, filo, dboc, fldnme, burnval, connect, pixres, ftype, foptions)

Name Type Caption Length Value range
FILI* str Input file name 1 -    
DBVS* List[int] Input vector segment 1 - 1  
FILO str Output file name 0 -    
DBOC List[int] Encoded raster channel 0 - 1  
FLDNME str Field name to use for elevation values. 0 - 64 SHAPEID | ZCOORD | Field Name
BURNVAL List[float] Value to burn 0 - 1 Default:
CONNECT List[int] Connectedness of lines (4 or 8) 0 - 1 4 | 8
Default: 8
PIXRES List[float] Output pixel resolution (m) 0 - 2  
FTYPE str Output file type 0 - 4 Default: PIX
FOPTIONS str Output file options 0 - 64  

* Required parameter
Back to top

Parameter descriptions


Specifies the name of the file containing the vector layers to be encoded into the raster channel.


Specifies the vector segment from the input file to be encoded. The input vector segment contains lines (such as elevation contours), where each line has an attribute value. All specified vector segments must use the same coordinate system (PIXEL, UTM, etc.).


Specifies the name of the file to receive the output raster channel. If this parameter is not specified, FILI is used.

If the output file is specified but does not already exist, a new file is created with a single 32 bit real channel to encode the vector data.


Specifies the output raster channel to receive the encoded vector data.

If the specified output file FILE exists, this parameter must be specified and the channel must exist. If the output file does not exist, this parameter should be left unspecified.


Specifies the field containing the elevation (or Z) values. The field name must exist in the attribute table of the vector layer. The acceptable range of elevation values depends on the data type of the output channel.

Values include:
Note: Field names are not case-sensitive. If values are specified in parameter BURNVAL then FLDNME should not be specified.


Optionally specifies a value to use during encoding for ALL lines and points in the input vector segment. Use of this parameter will mean that the FLDNME parameter is ignored.

The range for this value depends on the data type of the output channel.


Specifies the connectedness for line segments encoded into the output image channel. Points are always encoded as a single dot.

Supported values are:
Note: Any value other than 4 or 8 is invalid.


Specifies the output pixel resolution, in meters, for the new output file (FILO) if it is created.

The specified pixel size determines the number of pixels and lines in the output file. A smaller pixel size results in a larger output file and increased computation time.

PIXRES values are used only when the output file (FILO) is specified but does not yet exist; otherwise PIXRES is ignored. If this parameter is defaulted, the pixel resolution is taken from the georeferencing of input file FILI.


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.


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


LINE2RAS encodes the vector segment data from the input file to an output image channel. Attribute values for each vector segment are either specified by the user (parameter BURNVAL), or by actual attribute values stored for each line and point structure in the vector segment (a field or the Z coordinate using parameter FLDNME).

LINE2RAS is used in gridding vector data. Gridding is the process of creating a raster image grid, given vector (line and point) data. For example, LINE2RAS can encode elevation contour lines into an image channel after which an interpolation function such as PYRINT or GRDINT can be used.

If the units for storing vector data are not PIXEL, but are UTM or any other type, the database must be georeferenced (using GEOSET) prior to running LINE2RAS. The units for georeferencing must be the same as those used to collect the vector data. The current georeferencing information for the database may be obtained by running GEOREP.

If the output file FILO already exists the CLR function can be used to clear all pixels in the output channel to a background value (usually zero) before encoding vector data with LINE2RAS. If the output file is created then a background value and data type for the channel are automatically determined. Typically the background value is 0 unless this conflicts with the burned in vector data values.

Only one vector layer (or segment) may be encoded at a time. LINE2RAS can be run multiple times, using the same output channel, if more than one vector layer needs to be encoded. Vector data must all be in the same projection as the output file. Function VECPRO can be used to reproject vector layers.

Each vector may contain more than one attribute field. The FLDNME (Field Name) parameter specifies the attribute field to use or whether the actual Z values associated with each vertex or point should be used.

Function GRDVEC performs a similar function to LINE2RAS but can only write into an existing file while LINE2RAS can automatically create an output file or write to an existing file.

Back to top


Create a raster channel from vector channel 25 in the file "irvine.pix". This exercise reads vector data from the input file "irvine.pix" and stores it to a raster image channel in the newly created output TIF format file, "riv25.tif" in the same projection as "irvine.pix" and at 10m resolution.

from pci.line2ras import line2ras

fili     = "irvine.pix"    # input file
dbvs     = [25]            # input line layer
filo     = "irv25.tif"     # output file
dboc     = []              # output channel
fldnme   = ""              # no field name specified
burnval  = [100]           # pixel value for all shapes
connect  = [8]             # eight connected lines
pixres   = [10,10]         # output resolution
ftype    = "TIF"           # output format type
foptions = ""              # format options

line2ras(fili, dbvs, filo, dboc, fldnme, burnval, connect, pixres, ftype, foptions)

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