GCPREAD

Read GCPs from a text file and write to a GCP segment


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

Back to top

Description


GCPREAD reads ground control points (GCP) from a specified text file and writes them to a new GCP segment.
Back to top

Parameters


gcpread(file, dbgc, dbsn, dbsd, mapunits, elevref, elevunit, tfile, gcpform)

Name Type Caption Length Value range
FILE * str Output image file name 1 - 256  
DBGC List[int] GCP segment number 0 - 1 Default: -999999999
DBSN str Output GCP segment name 0 - 8  
DBSD str Output GCP segment description 0 - 64  
MAPUNITS str GCP map units 0 -   See description
ELEVREF str Elevation reference 0 - 6 MSL, ELLIPS
ELEVUNIT str Elevation units 0 - 7 METER, FEET, US_FEET
TFILE * str Input GCP text file 1 -    
GCPFORM str GCP data text format 0 - 5 2D, 2DERR, 3D, 3DERR, BULK
Default: 3D

* Required parameter
Back to top

Parameter descriptions

FILE

The name of the PCIDSK image file to which to write the GCP segment.

A new GCP segment (type 215) will be created.

DBGC

The GCP segment number in the input file that contains GCP information. During processing, the existing GCP information in the specified GCP segment is overwritten. If the GCP segment does not exist, an error message is displayed. If no value is specified for this parameter, a new GCP segment is created in the output file (FILE).

DBSN

The name, up to eight characters, of the output GCP segment. If a name is not specified, the default name GCP is applied.

DBSD

A description, up to 64 characters, of the contents or origins of the output data. If you do not specify a description, an empty string is applied for the parameter.

MAPUNITS

The units in which the second set of GCP coordinates is measured. The first set of GCP coordinates is measured in pixels by default.

The standard definitions are as follows:

If no value is specified for this parameter, the map units will be read from the text file specified for the Input GCP text file (TFILE) parameter, provided the map units are provided in the file. If no value is specified for this parameter, and the text file does not provide map units, or if the map units specified by this parameter are different from those provided in the text file, GCPREAD will throw an exception. To change the current projection of the GCPs, you must modify the text file directly.

Note: The map units you specify must be the same units as your GCPs.

For a complete list of supported projections and Earth models, see Understanding map projections. The format of the map-units string is described in Output units.

ELEVREF

The vertical reference for elevation values.

Valid values are defined as follows:

If no value is specified for this parameter, the elevation reference is read from the text file specified for the Input GCP text file (TFILE) parameter, provided it is specified in the file. If the text file also does not contain elevation reference, the default value of MSL is used.

If the elevation reference specified for this parameter differs from that in the text file, GCPREAD throws an exception.

This value is used only if GCPREAD creates a new GCP segment (see parameter DBGC).

ELEVUNIT

The code for the units of the elevation values in the GCP data.

Note: FEET stands for international feet.

If no value is specified for this parameter, the elevation units are read from the text file specified for the Input GCP text file (TFILE) parameter, provided it is specified in the file. If the text file also does not contain elevation units, the default value of METER is used.

If the elevation units specified for this parameter differ from those in the text file, GCPREAD throws an exception.

This value is used only if GCPREAD creates a new GCP segment (see parameter DBGC).

TFILE

The path and file name of the input text file from which to read the GCP coordinates.

For more information about the required format of the text file, see the description of the GCPFORM parameter.

GCPFORM

The code for the format of the GCP data in the input GCP text file.

The naming convention of the codes is as follows:

where:

Back to top

Return Value

Returns: execution status

Type:  PCI_INT

The return value is 0. This function returns only if it executes successfully; otherwise, it throws an exception

Back to top

Details

GCPREAD transcribes GCP data from a specified text file to a GCP segment in an image file. The function accommodates several formats of the GCP data in the input text file. You specifiy the format by using the GCP format (GCPFORM) parameter.

The data can be written to an existing GCP segment or to one that is created by GCPREAD. When the segment is created, its name and description are specified by the caller or given default values by this function. This information is not contained in the input text file.

A GCP may be for use as georeferencing control (a "GCP"), or for use in assessing the accuracy of a rectification result (a "check point"). The information read from the input text file includes a flag value (S) that distinguishes between the two. You can also view a report in CATALYST Professional Focus that shows which points are GCPs and which are check points. On the Files tab in Focus, right-click the GCP segment and click View.

Back to top

Example

Read the GCP data from the text file gcp.txt, and then write the GCPs to a new segment in the PCIDSK file irvine.pix. The GCP data in the text file is in the "3DERR" format.

from pci.gcpread import gcpread

tfile = "gcp.txt"
gcpform = "3DERR"
file = "irvine.pix"
dbgc = []       # empty, so a new GCP segment will be created
dbsn = ""       # the GCP segment will be named "GCP" by default
dbsd = ""       # the GCP segment will have no descriptor string
mapunits = "UTM 11 E0"
elevref = ""    # empty, so the default value of "MSL" will be used
elevunit = ""   # empty, so the default value of "METER" will be used

gcpread(file, dbgc, dbsn, dbsd, mapunits, elevref, elevunit, tfile, gcpform)

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