ENVIView::GetExtent

The GetExtent function method returns the four corners of the current view in geographic (the default), map, Military Grid Reference System (MGRS), or data coordinates.

Note: Only one coordinate keyword (DATA, GEO, MAP, MGRS) may be set.

Example

; Launch the application

e = ENVI()

 

; Open a file

file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $

SUBDIRECTORY = ['data'])

raster = e.OpenRaster(file)

 

; Display the data

view = e.GetView()

layer = view.CreateLayer(raster)

 

; Get the extent of the view in lon, lat

extent = view.GetExtent()

PRINT, 'Four Corners of the Current View'

PRINT, extent

Syntax

Result = ENVIView.GetExtent([, Keywords=value])

Return Value

Result is an array of four points that defines the four corners of the currently-selected view, starting at the bottom left and proceeding clockwise.

For geographical coordinates, result has the form [lon1, lat1, lon2, lat2, lon3, lat3, lon4, lat4].

For map coordinates, result has the form [x1, y1, x2, y2, x3, y3, x4, y4].

For data coordinates, result has the form [x1, y1, x2, y2, x3, y3, x4, y4], where x and y are the pixel locations.

For MGRS coordinates, result is of the [point1, point2, point3, point4], where the elements are strings.

Keywords

Keywords are applied only during the initial creation of the object.

DATA

Set this keyword to an ENVIRasterLayer object belonging to an ENVIView. When this keyword is set, the function method returns the locations of the pixels in this layer.

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.

GEO

Set this keyword to return the extent in longitude and latitude coordinates (for geographical coordinate systems). This is the default behavior if no coordinate keyword is set.

MAP

Set this keyword to return the extent in eastings and northings (for projected coordinate systems).

MGRS

Set this keyword to return the extent as an alphanumeric string of Military Grid Reference System (MGRS) coordinates. Use the NUM_DIGITS keyword to set the precision for MGRS coordinates.

NUM_DIGITS

This keyword is valid only if you also set the MGRS keyword.

Set this keyword to an integer between 0 and 5 to change the precision (the number of digits in the northing and easting) of the returned MGRS coordinates. If this keyword is not set, the number of digits returned is 5 (1-square-meter precision).

Version History

ENVI 5

Introduced

API Version

4.2

See Also

ENVIView, ENVIView::SetExtent