VECSEL

Vector selection and subsetting


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

Back to top

Description


VECSEL selects vectors in a defined window, one or more ranges of attributes, or both, to produce a new vector layer. You can also run VECSEL to perform vector thinning on the output vectors.
Note: VECSEL does not support topological polygon layers as input. You can convert topological polygons into whole polygons by using TPOLY2POLY.
Back to top

Parameters


vecsel(fili, dbvs, filo, inclus, usegeo, dbvw, attrng, thin, dbsn, dbsd, fldnme, 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 1 -    
INCLUS str Inclusive operation 0 - 3 Yes | No
Default: Yes
USEGEO str Use georeferencing bounds 0 - 3 On | Off
Default: Off
DBVW List[float] Database vector window 0 - 4 X-offset, y-offset, x-size, y-size
ATTRNG List[float] List of attribute ranges 0 -    
THIN List[float] Percentage of vector thinning 0 - 1 0.0 - 100.0
DBSN str Name of output segment 0 - 8  
DBSD str Description of output segment 0 - 64  
FLDNME str Field name for range selection 0 - 64  
FTYPE str Output file type 0 - 4 Default: PIX
FOPTIONS str Output file options 0 -    

* Required parameter
Back to top

Parameter descriptions

FILI

The name of the input file containing the vector segment to process.

DBVS

The vector segment to process.

FILO

The name of the file to which to write the output data.

If the file does not exist already, a new file is created based on the values specified for the FTYPE and FOPTIONS parameters. If the file exists already, its format must allow the file to be updated. A new vector segment will be appended to the existing file.

When your output file exists already, you need not specify a value for the FTYPE and FOPTIONS parameters.

The output file can be the same as the input file, provided that the input file meets the preceding criteria.

INCLUS

Whether or not the vector selection is inclusive.

You can choose from the following options:

USEGEO

Whether to use the bounds specified in the georeferencing segment of the input file as the clip window.

You can choose from the following options:

DBVW

The vector window (x-offset, y-offset, x-size, y-size) in which to clip the vectors.

If no value is specified for this parameter, the entire channel is used by default. Window units are expressed according to the units defined in the input vector segment (for example, METER or UTM). The x-offset and y-offset define the upper-left starting point of the window. X-size defines the window width and y-size defines the window height. You must specify all four values.

Note: X-size and y-size can be negative values. This is important when processing projection or LAT/LONG vectors.

If On is specified for the USEGEO parameter, this parameter is ignored.

This parameter is optional.

ATTRNG

The ranges of attributes for selection of the input vector data.

You specify ranges in pairs of values. In each pair, the first value defines the start of the range and the second value defines the end of the range. If you specify an odd number of values, the last value is used as a range of one value.

You can specify a range as follows:
For example, suppose you specify attribute ranges as follows:
ATTRNG=1,1,20,31.7,41.3
With the parameter value specified as such, vectors and points with an attribute value of 1 (a range of 1 to 1), or in the range of 20 to 31.7, or a value of 41.3 (a range of 41.3 to 41.3) are selected.
Note: You can specify up to a maximum of eight pairs.

This parameter is optional.

THIN

The percentage of vector data to drop, or thin. This is useful for reducing the number of vertices in the vector set. You can specify the value in a range from 0 through 99.9. By default, no thinning is applied, which retains all of the data.

For more information, see Vector thinning.

Note: The percentage of thinning you specify is a goal. The actual amount thinned is reported after processing by VECSEL is complete.

This parameter is optional.

DBSN

The name of the new vector segment.

If no value is specified for this parameter, VECSEL uses the name of the input vector segment and copies it to the output.

This parameter is optional.

DBSD

The contents or origins of the new vector data.

If no value is specified for this parameter, VECSEL uses the description of the input vector segment and copies it to the output.

This parameter is optional.

FLDNME

The field name to use for range selection.

You must specify a value for this parameter to select values based on attributes. In addition to any existing numeric attribute, a special value, ShapeID, is also supported.

The names are not case-sensitive.

For example, suppose you specify the FLDNME and ATTRNG parameters as follows:

With the parameters specified as such, VECSEL selects all the vectors having a value of 100 to 1000 in the field named "Elevation".

This parameter is optional.

FTYPE

The format of the output file. The format type must be a GDB-recognized file type.

If you specified an existing file as the output file, do not specify a value for this parameter. The file will be updated by VECSEL without changing its type.

Supported file formats include, among others:

The default value is PIX.

For a complete list of GDB-recognized file types, see GDB-supported file formats

This parameter is optional.

FOPTIONS

The file-creation options to apply on creating the output file. These are specific to the format of the file. In each case, the default of no options is allowed. You can specify the compression schemes, file-format subtypes, and other information.

If you specified an existing file as the output file, do not specify a value for this parameter. The file will be updated by VECSEL without changing its type.

For a complete list of GDB-recognized file types, including the options available for each, see GDB-supported file formats

This parameter is optional.

Back to top

Return Value

Returns: 

Type:  PCI_INT

Returns the segment number for the output vectors.

Back to top

Details

VECSEL extracts vectors from an existing vector segment, as specified by a window, one or more ranges of attributes, or both. The vectors are extracted as output to a new vector segment. No changes are made to the input vector segment. You can use VECSEL to split up imported vector data that may be too large for other vector functions. You can also perform vector thinning on the output vectors.

The input file contains the input vector segment to process. The type of vector selection process is specified by the inclusive operation. By default, VECSEL includes as output all vector data values in the specified window, one or more ranges of attributes, or both. However, you can also exclude the vector data values, if necessary.

The inclusive operation governs selection by both window and attribute ranges, if both are specified. In such cases, it may be advantageous to run VECSEL twice: once for the window selection, and a second time using the output from the first run as input to the second run for the attribute ranges.

You can define an area of vector processing by using the georeferencing segment in your input file or by the input window you specify. However, if you elect to use georeferencing bounds, and also specify an input window, the input window will be ignored. If you specify neither georeferencing bounds nor an input window, VECSEL processes all of the vectors, regardless of their location in the input file. The units of the window are those of the input vector segment, such as UTM.

Vectors can be processed by their attribute value, specified as a list of attribute ranges. If no attribute range is specified, all of the vectors are processed, regardless of their attribute value.

To thin vertices from the output vectors, you can specify a percentage to thin. For more information, see Vector thinning.

If you run VECSEL as an inclusive operation, all vector data on or within the window, if specified, and on or within the attribute range or ranges, if specified, are retained in the output vector segment. If you run VECSEL as an exclusive operation, all vector data on or outside the window, if specified, and outside the attribute range or ranges, if specified, are retained in the output vector segment.

If you specify the segment name for the DBSN parameter and the description for the DBSD parameter before running VECSEL, the algorithm uses these values for the new vector segment. If you do not specify values, VECSEL uses the name and description from the input vector segment. In EASI, the segment number of the output vector data is written to an output parameter, LASC.

Vector thinning

To thin vertices from the output vectors, you can specify a percentage to thin. The percentage can be any value ranging from 0 through 99.9.

During processing, VECSEL samples the vertices, as specified. For example, a value of 50 drops every other vertex in the output vector. A value of 25 drops every fourth vertex.

Note: The percentage of thinning you specify is a goal. The actual amount thinned is available in a report, which VECSEL produces on completion of processing.

The algorithm preserves all line and point structures by always retaining both end points in a line and all points. Only vertices between end points in a line are eligible for thinning.

For an example that applies vector thinning, see this example that applies vector thinning.

Back to top

Examples

Defaults

If all of the options for vector selection are specified as default values, the input vector segment is copied to a new output vector segment.

from pci.vecsel import vecsel

fili	= "irvine.pix"	# input file
dbvs	= [25]		# input vector segment
filo	= "vecsel.pix"	# new output file
inclus	= ''		# default, "Yes";  inclusive selection
usegeo	= ''		# default, "Off"; do not use georeferencing
dbvw	= []		# default, process all vector data
attrng	= []		# default, use all vector data
thin	= []		# default, no vector thinning
dbsn	= ''		# use name from input segment
dbsd	= ''		# use description from input segment
fldnme	= ''		# default, not selecting by attribute values
ftype	= ''		# default, use PIX
foption	= ''		# default, use ''

vecsel( fili, dbvs, filo, inclus, usegeo, dbvw, attrng, thin, dbsn,\
dbsd, fldnme, ftype, foption )
Note: If all of the options for vector selection are specified as default values, and you elect not to run VECSEL as an inclusive operation, the input segment is copied to the output segment. Although you might expect that this would produce the opposite of the preceding example, all of the vector data is valid and is moved to the output vector segment. This is because there is no window or attribute ranges to exclude the vector data.

Output all vector data on and inside a specified input window.

from pci.vecsel import vecsel

fili	= "irvine.pix"	# input file
dbvs	= [25]		# vector segment to process
filo	= "vecsel.pix"	# new output file
inclus	= ''		# default, "Yes"; inclusive selection
usegeo	= ''		# default, "Off"; no georeferencing
dbvw	= [431000,3729000,1000,-1000]	# clip window in UTM
attrng	= []		# default, use all vector data
thin	= []		# default, no vector thinning
dbsn	= ''		# use name from input segment
dbsd	= ''		# use description from input segment
fldnme	= ''		# default, not selecting by attribute values
ftype	= ''		# default, use PIX
foption	= ''		# default, use ''

vecsel( fili, dbvs, filo, inclus, usegeo, dbvw, attrng, thin, dbsn,\
dbsd, fldnme, ftype, foption )

Output all vector data on and outside a specified input window.

from pci.vecsel import vecsel

fili	= "irvine.pix"	# input file
dbvs	= [25]		# vector segment to process
filo	= "vecsel.pix"	# new output file
inclus	= 'No'		# exclusive selection
usegeo	= ''		# default, "Off"; no georeferencing
dbvw	= [431000,3729000,1000,-1000]	# clip window in UTM
attrng	= []		# default, use all vector data
thin	= []		# default, no vector thinning
dbsn	= ''		# use name from input segment
dbsd	= ''		# use description from input segment
fldnme	= ''		# default, not selecting by attribute values
ftype	= ''		# default, use PIX
foption	= ''		# default, use ''

vecsel( fili, dbvs, filo, inclus, usegeo, dbvw, attrng, thin, dbsn,\
dbsd, fldnme, ftype, foption )

Output all vector data with an attribute in a range.

from pci.vecsel import vecsel

fili	= "irvine.pix"	# input file
dbvs	= [25]		# vector segment to process
filo	= "vecsel.pix"	# new output file
inclus	= ''		# default, "Yes"; inclusive selection
usegeo	= ''		# default, "Off"; no georeferencing
dbvw	= []		# default, process all vector data
attrng	= [1700205,1700210]	# range of attributes to process
thin	= []		# default, no vector thinning
dbsn	= ''		# use name from input segment
dbsd	= ''		# use description from input segment
fldnme	= ''		# name of existing field to query
ftype	= ''		# default, use PIX
foption	= ''		# default, use ''

vecsel( fili, dbvs, filo, inclus, usegeo, dbvw, attrng, thin, dbsn,\
dbsd, fldnme, ftype, foption )

Example applying vector thinning

The following example thins all vectors by 75 percent. To see if any principle vertices (corner vertices) were dropped, verify the thinned vectors by overlaying them on the input vectors.

from pci.vecsel import vecsel

fili	= "irvine.pix"	# input file
dbvs	= [25]		# input vector segment
filo	= "vecsel.pix"	# new output file
inclus	= ''		# default, "Yes";  inclusive selection
usegeo	= ''		# default, "Off"; do not use georeferencing
dbvw	= []		# default, process all vector data
attrng	= []		# default, use all vector data
thin	= [75]		# thin vectors by 75 percent
dbsn	= ''		# use name from input segment
dbsd	= ''		# use description from input segment
fldnme	= ''		# default, not selecting by attribute values
ftype	= ''		# default, use PIX
foption	= ''		# default, use ''

vecsel( fili, dbvs, filo, inclus, usegeo, dbvw, attrng, thin, dbsn,\
dbsd, fldnme, ftype, foption )

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