This task creates a single ROI 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 ROI points and displayed on top of a shaded-relief image.
e = envi()
ASCIIFile = FILEPATH('ascii.txt', $
SUBDIRECTORY = ['examples', 'data'])
ImageFile = Filepath('natural_earth_shaded_relief.jp2', $
Subdir=['data'], Root_Dir=e.Root_Dir)
Image = e.OpenRaster(ImageFile)
Task = ENVITask('ASCIIToROI')
Task.INPUT_URI = ASCIIFile
Task.LINES_TO_SKIP = 5
Task.ROI_NAME = 'Weather stations'
Task.DATA_COLUMNS = [1,2]
Task.Execute
View = e.GetView()
Layer = View.CreateLayer(Image)
roiLayer = Layer.AddROI(Task.OUTPUT_ROI)
Extent = Task.OUTPUT_ROI.GetExtent(Image)
View.SetExtent, Extent, DATA=Layer
Syntax
Result = ENVITask('ASCIIToROI')
Input properties (Set, Get): COORD_SYS, DATA_COLUMNS, GEOMETRY_TYPE, INPUT_URI, LINES_TO_SKIP, OUTPUT_ROI_URI, ROI_COLOR, ROI_NAME
Output properties (Get only): OUTPUT_ROI
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)
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_ROI
This is a reference to the output ROI.
OUTPUT_ROI_URI (optional)
Specify a string with the fully qualified path and filename for OUTPUT_ROI.
ROI_COLOR (optional)
Specify a three-element byte array with the color of the output ROI; for example: [0, 128, 0].
ROI_NAME (optional)
Specify a string with the name of the output ROI.
Version History
API Version
4.3
See Also
ENVITask, ASCIIToVector Task