ENVIView::GeoLink

The GeoLink method geographically links views for use with tools such as Pan, Fly, and Zoom, so that all linked views update locations at the same time. If georeferencing information is not available, use ENVIView::PixelLink. You can have more than one linked set of views at a time (example: views 1 and 2 are one linked set, views 3 and 4 are a second linked set). A view may be a member of only one linked set at a time.

The specific ENVIView where you issue the GeoLink method becomes the lead (or anchor) view that determines the geographic location from which all linked views are centered. To specify a different ENVIView as the anchor, execute the GeoLink method on that view.

If you do not specify the Views argument and set the LINK_ALL keyword, then all existing views with georeferencing information will be geo-linked. If you specify the Views argument when using the GeoLink method, then those views will be geo-linked.

Example

This is an interactive example that shows how to perform geographic linking with four images. Views are organized as follows:

Display Layers in Multiple Views

Copy and paste the following code into the IDL/ENVI) command line.

; Launch the application

e = ENVI()

 

; Open two ENVIRasters

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

SUBDIRECTORY = ['data'])

raster1 = e.OpenRaster(file1)

 

file2 = FILEPATH('qb_boulder_pan', ROOT_DIR=e.ROOT_DIR, $

SUBDIRECTORY = ['data'])

raster2 = e.OpenRaster(file2)

 

; Display the rasters in four views

view1 = e.GetView()

layer1 = view1.CreateLayer(raster1)

 

view2 = e.CreateView()

layer2 = view2.CreateLayer(raster2)

 

view3 = e.CreateView()

layer3 = view3.CreateLayer(raster1, BANDS = [3, 1, 2])

 

view4 = e.CreateView()

layer4 = view4.CreateLayer(raster1, BANDS = [0, 2, 3])

Create a Geographic Link

  1. Geographically link Views 1 (anchor) and 3.
  2. view1.GeoLink, view3

  3. Pan View 3. View 1 pans with it.
  4. view3.Pan, 50, 50

  5. Pan View 2. No other views pan with it.
  6. view2.Pan, 50, 50

Create a Second Geographic Link

  1. Link Views 2 (anchor) and 4.
  2. view2.GeoLink, view4

  3. Pan View 2. View 4 pans with it.
  4. view2.Pan, 50, 50

  5. Pan View 1. Views 1 and 3 pan, while 2 and 4 do not.
  6. view1.Pan, 50, 50

  7. Remove the link set of Views 2 and 4.
  8. view2.GeoLink, /REMOVE

  9. Link View 4 to View 1. View 3 is no longer in the linked group.
  10. view1.GeoLink, view4

  11. Add View 2 to the linked group (Views 1 and 4).
  12. view1.GeoLink, view2, /ADD

  13. Pan View 1. Views 2 and 4 also pan.
  14. view1.Pan, 100, -100

  15. Remove View 1 from the linked group.
  16. view1.GeoLink, /REMOVE

Remove All Views from the Geographic Link

  1. Remove all views.
  2. view2.GeoLink, /UNLINK_ALL

  3. Pan each view. Each one pans individually.
  4. view1.Pan, 20, 20

    view2.Pan, 30, -50

    view3.Pan, 10, -20

    view4.Pan, -20, 5

Syntax

ENVIView.GeoLink [, Keywords=value]

Arguments

Views

Specify an ENVIView, or an array of ENVIViews, to geographically link with the current view.

Keywords

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

ADD

Set this keyword to add views to an existing geo-linked group of views. If you set this keyword on an ENVIView that is not part of the existing geo-linked group, then a new geo-linked group will be created.

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.

LINK_ALL

Set this keyword to geographically link all views. This keyword takes precedence over the optional Views argument. For example, the following code links all views to View 2 (anchor):

view2.GeoLink, /LINK_ALL

REMOVE

Set this keyword to remove the view from the geographic link. If the view to remove is the anchor view and is linked to two or more views, the anchor is reassigned to the first remaining view. If the view to remove is one of only two views, then the linked set is dissolved.

ROTATE_LINK

Use this keyword to establish a new rotate link by specifying which views will rotate together. Use the UPDATE_ROTATE_LINK thereafter to link or unlink views from the rotate link. Here are the options for using this keyword:

UNLINK_ALL

Set this keyword to unlink all of the views. This keyword takes precedence over the optional Views argument. For example, the following code unlinks all views, where View 2 is the anchor view:

view2.GeoLink, /UNLINK_ALL

UPDATE_ROTATE_LINK

Use this keyword to update an existing rotate link (set with the ROTATE_LINK keyword) for the views specified by the Views argument. The views must be already linked to the anchor view on which the GeoLink method was invoked. Here are the options for using this keyword:

UPDATE_ZOOM_LINK

Use this keyword to update an existing zoom link (set with the ZOOM_LINK keyword) for the views specified by the Views argument. The views must be already linked to the anchor view on which the GeoLink method was invoked. Here are the options for using this keyword:

ZOOM_LINK

Use this keyword to establish a new zoom link, by specifying which views will zoom together. Use the UPDATE_ZOOM_LINK thereafter to link or unlink views from the zoom link. Here are the options for using this keyword:

Version History

ENVI 5

Introduced

ENVI 5.2

Added UPDATE_ZOOM_LINK and ZOOM_LINK keywords

ENVI 5.6

Added ROTATE_LINK and UPDATE_ROTATE_LINK keywords

API Version

4.2

See Also

ENVIView, ENVIView::PixelLink