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:

  • Set it to an array of zeros or ones that correspond to the views specified by the Views argument. A value of 1 means that rotate linking is enabled for the corresponding view. Suppose you have five geo-linked views where View 1 is the anchor view, and you want Views 1, 2 and 5 to rotate together. View 1 is automatically included in the rotate link, so you do not need to explicitly specify that view with ROTATE_LINK. Use the following code:

  • view1.GeoLink, [view2, view3, view5], ROTATE_LINK=[1, 0, 1]
  • Set the keyword as follows when adding a new view to an existing geographic link. This example adds View 4 to the rotate link:

  • view1.GeoLink, view4, /ADD, /ROTATE_LINK
  • Set the keyword in combination with LINK_ALL to enable rotate linking on all views.

  • view1.GeoLink, /LINK_ALL, /ROTATE_LINK
  • If you subsequently set the REMOVE or UNLINK_ALL keywords, the rotate link setting is also removed.

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:

  • Set it to an array of zeros or ones that correspond to the views specified by the Views argument. A value of 1 means that rotate linking is enabled for the corresponding view. Suppose you have four geo-linked views that all rotate together (rotate linking is enabled for all views), and you want to disable rotate linking for views 2 and 4. Use the following code:
  • view1.GeoLink, [view2, view3, view4], UPDATE_ROTATE_LINK=[0, 1, 0]
  • Set the keyword as follows to include View 2 with the existing rotate link:
  • view1.GeoLink, view2, UPDATE_ROTATE_LINK=1

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:

  • Set it to an array of zeros or ones that correspond to the views specified by the Views argument. A value of 1 means that zoom linking is enabled for the corresponding view. Suppose you have four geo-linked views that all zoom together (zoom linking is enabled for all views), and you want to disable zoom linking for views 2 and 4. Use the following code:
  • view1.GeoLink, [view2, view3, view4], UPDATE_ZOOM_LINK=[0, 1, 0]
  • Set the keyword as follows to include View 2 with the existing zoom link:
  • view1.GeoLink, view2, UPDATE_ZOOM_LINK=1

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:

  • Set it to an array of zeros or ones that correspond to the views specified by the Views argument. A value of 1 means that zoom linking is enabled for the corresponding view. Suppose you have five geo-linked views where View 1 is the anchor view, and you want Views 1, 2 and 5 to zoom together. View 1 is automatically included in the zoom link, so you do not need to explicitly specify that view with ZOOM_LINK. Use the following code:
  • view1.GeoLink, [view2, view3, view5], ZOOM_LINK=[1, 0, 1]
  • Set the keyword as follows when adding a new view to an existing geographic link. This example adds View 4 to the zoom link:
  • view1.GeoLink, view4, /ADD, /ZOOM_LINK
  • Set the keyword in combination with LINK_ALL to enable zoom linking on all views.
  • view1.GeoLink, /LINK_ALL, /ZOOM_LINK
  • If you subsequently set the REMOVE or UNLINK_ALL keywords, the zoom link setting is also removed.

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