The AddGeometry method adds polygons, polylines, or points to an ROI.
Example
e = ENVI()
file = Filepath('qb_boulder_msi', ROOT_DIR=e.Root_Dir, $
SUBDIRECTORY=['data'])
raster = e.OpenRaster(file)
view = e.GetView()
layer = view.CreateLayer(raster)
roi = EnviRoi(NAME='Tennis Court', COLOR='Green')
data = [[480872.7214d, 4428333.0664d], $
[480908.2576d, 4428333.0664d], $
[480907.5742d, 4428265.4108d], $
[480873.3289d, 4428265.7720d], $
[480872.7214d, 4428333.0664d]]
roi.AddGeometry, data, coord_sys=raster.SpatialRef.Coord_Sys_Str, /POLYGON
roiLayer = layer.AddRoi(roi)
Syntax
ENVIROI.AddGeometry, Data [, Keywords=value]
Arguments
Data
A 2xn array that defines the vertex data, stored as double-precision floating point. Data can represent UTM map coordinates or Geographic Lat/Lon coordinates. X is easting or longitude, and Y is northing or latitude.
Keywords
COORD_SYS
Set the ENVIRaster reference that establishes the coordinate system reference for the ROI locations contained in the data. This keyword is not required; however, if it is not specified, ENVI will be unable to reproject the ROI geometry correctly. COORD_SYS supports only standard projections (Geographic Lat/Lon and UTM).
ERROR
Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.
When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.
See Manage Errors for more information on error handling in ENVI programming.
POINT
Set this keyword to indicate that the data arrays define a set of individual vertices.
POLYGON
Set this keyword to indicate that the data arrays define a closed polygon. The first and last data point in data points must be the same. When you set the POLYGON keyword, you must specify at least three non-collinear vertices.
POLYLINE
Set this keyword to indicate that the data array define a polyline. When you set the POLYLINE keyword, you must specify at least two unique vertices.
Version History
API Version
4.3
See Also
ENVIROI, ENVIRaster, ENVIROI::ClearGeometry