This task creates a vector from the geometry of a columned ASCII file.

Example


This example opens a column-delimited ASCII file containing meteorological data for 15 weather stations. The first column contains geographic longitudes, and the second column contains latitudes. The ASCII data are converted to a vector layer, which is then displayed on top of a shaded-relief image.

; Start the application
e = envi()
 
; Open an ASCII file
ASCIIFile = FILEPATH('ascii.txt', $
  SUBDIRECTORY = ['examples', 'data'])
 
; Open a shaded relief image
ImageFile = Filepath('natural_earth_shaded_relief.jp2', $
  Subdir=['data'], Root_Dir=e.Root_Dir)
Image = e.OpenRaster(ImageFile)
 
; Get the task from the catalog of ENVITasks
Task = ENVITask('ASCIIToVector')
 
; Define inputs
Task.INPUT_URI = ASCIIFile
Task.LINES_TO_SKIP = 5
 
; Specify column 1 for X coordinate and 
; column 2 for Y coordinate
Task.DATA_COLUMNS = [1,2]
 
; Run the task
Task.Execute
 
; Display the result
View = e.GetView()
Layer = View.CreateLayer(Image)
Layer2 = View.CreateLayer(Task.OUTPUT_VECTOR)
View.Zoom, /FULL_EXTENT, LAYER=Layer2

Syntax


Result = ENVITask('ASCIIToVector')

Input properties (Set, Get): COORD_SYS, DATA_COLUMNS, GEOMETRY_TYPE, INPUT_URI, LINES_TO_SKIP, OUTPUT_VECTOR_URI

Output properties (Get only): OUTPUT_VECTOR

Properties marked as "Set" are those that you can set to specific values. You can also retrieve their current values any time. Properties marked as "Get" are those whose values you can retrieve but not set.

Methods

This task inherits the following methods from ENVITask:

AddParameter

Execute

Parameter

ParameterNames

RemoveParameter

Properties


This task inherits the following properties from ENVITask:

COMMUTE_ON_DOWNSAMPLE

COMMUTE_ON_SUBSET

DESCRIPTION

DISPLAY_NAME

NAME

REVISION

TAGS

This task also contains the following properties:

COORD_SYS (optional)

Specify the input coordinate system of the incoming geometry.

DATA_COLUMNS (required)

Specify an integer array with the column numbers corresponding to X and Y geometry data. The X column contains longitudes or eastings. The Y column contains latitudes or northings. For example, if the third column of the ASCII file contains longitudes and the fourth column contains latitudes, set DATA_COLUMNS to [3, 4].

GEOMETRY_TYPE (optional)

Specify a string indicating the geometry type. The choices are:

  • Polygon
  • Polyline
  • Point (default)
  • Multipoint

INPUT_URI (required)

Specify the fully qualified URI to an input ASCII file that contains the geometry records.

LINES_TO_SKIP (optional)

Specify the number of lines to skip at the beginning of the ASCII file.

OUTPUT_VECTOR

This is a reference to the output vector.

OUTPUT_VECTOR_URI (optional)

Specify a string with the fully qualified path and filename for OUTPUT_VECTOR.

Version History


ENVI 5.5.3

Introduced

API Version


4.2

See Also


ENVITask, ENVIASCIIToROI Task