THMR2RAS

Thematic raster to raster


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

Back to top

Description


THMR2RAS converts a thematic raster to a raster.
Back to top

Parameters


thmr2ras(fili, dbic, filo, dboc, fldnme, ftype, foptions)

Name Type Caption Length Value range
FILI * str Input file name 1 -    
DBIC * List[int] Input raster channel 1 - 1  
FILO * str Output file name 1 -    
DBOC List[int] Output raster channel 0 - 1  
FLDNME * str Attribute field name 1 - 64  
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 thematic raster data to be converted into the raster channel.

DBIC

Specifies the channel of thematic raster data to convert.

FILO

Specifies the name of the file to hold the output converted raster channel.

If FILO is specified but does not exist, a new PCIDSK file or GDB-supported file will be created.

DBOC

Specifies the output channel to which the converted raster is written. The pixel values for this raster are based on the selected attribute from the input thematic layer. If this parameter is not specified, output is sent to a new channel.

If FILO is an existing file, this parameter may be left unspecified; THMR2RAS will create a new channel in the most logical position. If DBOC specifies an existing channel, the function will overwrite that channel. A message will appear, warning the user that information may be lost, particularly when writing data from a 16- or 32-bit channel to an 8-bit channel. If DBOC specifies a channel that does not yet exist, even if it is the next channel in the sequence (the channel that would be created if DBOC was left blank), an error message appears.

If FILO specifies a file that does not already exist, DBOC should be left unspecified or set to 1. A value greater than 1 will cause the function to error.

DBOC cannot be the same as DBIC. DBOC should have a sufficiently large data type to accept values from DBIC, otherwise truncation will occur. For example, if DBIC attribute values range from 0 to 10,000, an 8-bit DBOC results in loss of data, while a 16-bit DBOC is sufficient.

FLDNME

Specifies the name of the attribute field to use when encoding the new raster layer.

The attribute must be numeric, as these values are written as pixel values in the output raster channel. The attribute name is not case-sensitive.

FTYPE

Optionally specifies the output file format type, represented by a three- or four-letter code. The format type must be a GDB-recognized file type. If FILO specifies an existing file, FTYPE should not be specified since the existing file will be updated and its type won't be changed.

Supported file format codes include: The default value is PIX.

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

Optionally specifies the file creation options to be applied when creating the output file. These are specific to the file format; in each case, the default of no options is allowed. FOPTIONS can be used to specify the compression schemes, file format subtypes, and other information.

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.

Back to top

Details

THMR2RAS converts the thematic raster to a raster by encoding each pixel with a value based on a selected attribute. The attribute must be a numeric data type.

A thematic raster is a raster with associated attributes. Normally, rasters present spatial information as pixel values. Thematic rasters have an associated attribute table that can store more information than just a pixel value. In some cases, you may want to use THMR2RAS to convert a thematic raster to a regular raster. You specify an existing attribute to provide the pixel values to burn into the output raster and the information from the rest of the attributes is not part of the output layer.

Back to top

Example

The file RasRain.pix is a thematic raster representing percipitation levels in California. The amount of rain has been categorized into four groups as stored in the Weight attribute. THMR2RAS will be used to create a new raster that has pixel values set via that Weight attribute.

from pci.thmr2ras import thmr2ras

fili     = "RasRain.pix"       # input thematic raster file
dbic     = [1]                 # input channel
filo     = "RainWeight.pix"    # raster file to be created
dboc     = []                  # a new channel will be created in RainWeight.pix
fldnme   = "Weight"            # encode the attribute "Weight"
ftype    = ""                  # defaults to PIX
foptions = "RLE"               # Run Length Encode the output

thmr2ras(fili, dbic, filo, dboc, fldnme, ftype, foptions)

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