RAS2THMR

Add attributes to a raster channel


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

Back to top

Description


RAS2THMR creates a thematic raster layer by creating a linked attribute table for the input raster data. The attribute table includes information about the input raster, such as the unique pixel value, the area covered by each unique pixel value and, when classification metadata is present, class names and descriptions.
Back to top

Parameters


ras2thmr(fili, dbic, filo, dboc, dbsd, areaonly, nodatval, 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  
DBSD str Output segment descriptor 0 - 64 Default: Attributes from Raster
AREAONLY str Only create area attribute 0 - 3 YES| NO
Default: YES
NODATVAL List[float] NoData value 0 - 1  
FOPTIONS str Output file options 0 - 64  

* Required parameter
Back to top

Parameter descriptions

FILI

Specifies the file that contains the input raster channel to be processed.

DBIC

Specifies the input raster channel to be processed.

FILO

Specifies the name of the PCIDSK database file that will contain the output raster and attribute table.

The attribute results are stored as a vector layer, which is linked to the input raster channel through the newly created PixelValue attribute.

If the specified name does not exist, a new file is created with one channel and one vector layer containing the output result.

DBOC

Specifies the output raster channel that will be written to.

If the output file exists, a value for DBOC must be specified. Defaults to 1 only when a new file is created.

DBSD

Specifies a descriptor for the output vector segment holding the attributes. The descriptor can be up to 64 characters.

If not specified, the default descriptor is "Attributes from Raster".

AREAONLY

Specifies which attributes to add to the output data.

You can create an attribute table consisting of only the area or the area and perimeter:

Note: Computing the perimeter for a thematic raster can be time-consuming. Also, because of the nature of rasters, the perimeter values tend to be substantially larger than the corresponding values for polygon areas.

NODATVAL

Specifies a NoData (or background) value for the input channel. Pixels with this value are excluded from processing.

If no value is specified for this parameter, the NoData value for the channel is taken from the input layer metadata.

FOPTIONS

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

The options are described in GDB file formats in the Technical Reference section of the CATALYST Professional online Help.

This parameter is optional.

Back to top

Details

RAS2THMR creates a thematic raster layer from an input raster layer with an associated attribute table. The attribute table is stored as a vector layer, which is linked to the raster output channel through metadata.

The attribute values can include Area only or Area and Perimeter. These values are calculated based on the pixels of the input raster channel.

If the input raster contains suitable classification metadata, that information is automatically transferred to the appropriate fields in the output attribute table. That is, when the input raster is the result of a PCI classification process, two addtional fields, Name and Description, are created in the output thematic raster.

The segment name and descriptor are created automatically from the input raster file.

Back to top

Example

Update channel 6 in irvine.pix to have an associated attribute table and therefore be a thematic raster. A new vector segment will be appended to irvine.pix to store the raster attributes.

from pci.ras2thmr import ras2thmr

fili     = "irvine.pix"    # input raster file
dbic     = [6]             # using channel 6 from irvine.pix
filo     = "irvine.pix"    # output file to be created
dboc     = [6]             # update the input channel
dbsd     = ""              # defaults to "Attributes from Raster"
areaonly = ""              # defaults to "YES" so only Area is computed
nodatval = []              # defaults to DBIC's NO_DATA_VALUE
foptions = ""              # unnecessary since FILO exists

ras2thmr(fili, dbic, filo, dboc, dbsd, areaonly, nodatval, foptions)

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