ENVIAnnotationSet

This is a reference to an annotation set, which consists of one or more annotation types in a single layer. Types include arrows, circles, polygons, polylines, rectangles, symbols, and text.

Example

; Start the application

e = ENVI()

 

; Open an input file

file = FILEPATH('qb_boulder_msi', $

  ROOT_DIR=e.ROOT_DIR, SUBDIRECTORY = ['data'])

raster = e.OpenRaster(file)

 

; Display the raster layer

View = e.GetView()

RasterLayer = View.CreateLayer(raster)

 

; Create an annotation set using Geographic Lat/Lon

; WGS-84 as the spatial reference

annotation = ENVIAnnotationSet(/GEOGRAPHIC)

 

; Label the community park

annotation.AddCircle, $

  -105.22101050, 39.9917, $ ; X and Y coordinates

  [300.0, 200.0], $ ; ellipse axes (m)

  LINE_COLOR='lime green', NAME='Park polygon'

 

annotation.AddText, $

  -105.22118409, 39.99424191, $ ; X and Y coordinates

  'East Boulder!C Community Park', $

  GLYPH_COLOR='lime green', NAME='Park label'

 

; Label the reservoir

annotation.AddText, $

  -105.20407487D, 39.99911740D, $ ; X and Y coordinates

  'Baseline!C Reservoir', $

  GLYPH_COLOR='light sky blue', NAME='Reservoir label'

 

; Save the annotation set

outFile = e.GetTemporaryFilename()

annotation.Save, outFile

 

; Display the annotation layer

AnnLayer = View.CreateLayer(annotation)

Syntax

Result = ENVIAnnotationSet([Properties=value] [, Keywords=value])

Return Value

This function returns a reference to an ENVIAnnotationSet object.

Arguments

None

Methods

AddArrow

AddCircle

AddPolygon

AddPolyline

AddRectangle

AddSymbol

AddText

Close

Dehydrate

Hydrate

Save

Properties

Properties marked as (Init) can be set during the initial creation of the object. Properties marked as (Get) can be retrieved. Properties marked as (Set) can be set after initial creation.

COORDSYS (Get)

The coordinate system (ENVICoordSys) of the annotation set.

HIDE_CHILDREN (Get, Set)

Set this property to 1 to hide individual annotation items as children in the Layer Manager when you display an annotation layer. This is recommended if you create a large annotation set with hundreds or thousands of annotation items; it will improve display performance.

Tip: If you set this property to 1, there is no reason to set the NAME property on individual annotation items. They will be hidden in the Layer Manager.

This property setting is retained if you save an annotation set to a file (.anz). It is also honored if you reopen the annotation file and display it in ENVI. If the annotation layer is already displayed with HIDE_CHILDREN set to 0, you should remove the layer from the display, set HIDE_CHILDREN to 1, then redisplay the layer for the property to take effect.

NITEMS (Get)

The number of items in the annotation set.

URI (Get)

A fully qualified path to an annotation file. This value will be !NULL if the current ENVIAnnotationSet has not yet been saved.

Keywords

Note: Invoking the ENVIAnnotationSet function with no keywords will create an annotation set with pixel coordinates.

COORDSYS (optional)

Set this keyword to a valid ENVICoordSys object to create an annotation set whose coordinates are based on a specific coordinate system.

ERROR (optional)

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.

GEOGRAPHIC (optional)

Set this keyword to create an annotation set whose coordinates are based on a Geographic WGS-84 latitude/longitude spatial reference.

SPATIALREF (optional)

Set this keyword to a spatial reference object, to create an annotation set whose coordinates are based on the spatial reference of an existing raster. Valid spatial references include:

Version History

ENVI 5.6.1

Introduced

API Version

4.2

See Also

ENVIAnnotationLayer, ENVI::OpenAnnotation