Import ground-truth points into an existing segmentation

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

Back to top


OAGTIMPORT will import a series of training or accuracy samples points into the attribute table of a segmentation. The training or accuracy samples must be vector points (not polygons) with a field containing the class names.
Back to top


oagtimport(gtfili, gtvs, gtfldnme, filv, dbvs, filo, dbov, ftype, outfldnme, samptype, resrule, majpct)

Name Type Caption Length Value range
GTFILI* str Input Ground-truth File 1 -    
GTVS List[int] Input Ground-truth Vector Segment 0 - 1  
GTFLDNME* str Ground-truth Field Name 1 -    
FILV* str Input vector file. 1 -    
DBVS List[int] Segment number of vector layer. 0 - 1  
FILO* str Output file name. 1 -    
DBOV List[int] Output vector segment. 0 - 1  
FTYPE str Output file type 0 -   PIX | SHP
Default: PIX
OUTFLDNME str Output field name for ground-truth points. 0 -    
SAMPTYPE str Sample type. 0 - 8 Training | Accuracy
Default: Training
RESRULE str Conflict-resolution rule. 0 - 8 None | First | Majority
Default: None
MAJPCT List[int] Majority percentage 0 - 1 0 - 99
Default: 51

* Required parameter
Back to top

Parameter descriptions


Specifies the name of file containing the ground-truth points (training or accuracy samples).


The segment number of the vector layer containing the ground-truth points.

If GTVS is not specified, the last segment that exists in GTFILI is used.


Specifies the field name of the ground-truth file attribute table containing the class names to import.

Note: Object Analyst is case sensitive. For example, values of "Forest" and "forest" will be interpreted as two classes.


Specifies the name of the file that contains existing segmentation.


Specifies the number of the vector layer containing the segmentation to be updated. If DBVS is not specified, the last segment that exists in FILV is used.


The name of the output file to which to write the segmentation. The file name which is specified can be an existing file or a new output file.


The segment number of the vector layer of the output file to which to write ground-truth points. When an existing segment is specified for DBOV it will be overwritten.

If FILO specifies an existing file and DBOV is not specified, a new vector layer will be appended to FILO.

When FILO specifies a new file to be created, DBOV will be ignored and the results will be written to the new file.


The format of the output file.

The following formats are supported:

The default is PIX.


Specifies the output field name in the segmentation attribute table that will receive the training or accuracy samples. If OUTFLDNM is left blank, the name of field specified in GTFLDNME is copied over.

If the specified field name already exists, its content will be updated (not overwritten).

If the specified field name exists but the field is not of type text, an error results.


Samples type can be training or accuracy assessment.


Specifies the conflict-resolution rule to use when points belonging to different land-cover class intersects the same object. Options are:

If necessary, you can adjust the minimum percentage threshold by the MAJPCT parameter. By doing so, objects below the threshold are not updated.

Note: When there is no majority; for example, if four classes are at 25 percent, or when the majority threshold you specify is not met, no values are imported for such objects.


Specifies the majority threshold in percentage. This is only applicable when the RESRULE parameter is set to Majority. In such case, when there are multiply points found in one object, only objects that have a unique majority, above the provided MAJPCT value, will be imported.

Back to top


Typical Workflow

Object Analyst Workflow

Importing ground-truth points using OAGTIMPORT

OAGTIMPORT uses ground-truth points as training or accuracy samples so that they can be imported into the polygon vector layer created by OASEG. The ground-truth point layer needs to contain a field with class names because these will be used as samples to run the classification during the future stages. The land-cover class field of the point is assigned to the polygon that geospatially contains the point. Since polygons do not overlap, each point can only be mapped onto one polygon. However, in the case that a polygon contains more than one sample point with conflicting class values, the specified method under RESRULE will be used to resolve the conflict . Hence, OAGTIMPORT requires two files: a segmentation vector layer and a ground-truth point layer.

Note: OAGTIMPORT requires you to have ground-truth point data. If you do not have such data, consider using Focus Object Analyst to collect training and accuracy samples rather than using OAGTIMPORT.


The results from OAGTIMPORT are written to an output file specified as FILO. In the next step, OAFLDNMEXP uses attributes from this vector file as input to convert it into a text file.

Back to top


Import the ground-truth information from points from ground_truth_file.pix into some segmented polygons in segments_file.pix.

from pci.oagtimport import oagtimport
samptype ="Training"


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