The AddPolyline method adds a polyline to an annotation set.

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 a street
annotation.AddPolyline, $
  [-105.23130449, -105.22535408, -105.21281121], $ ; X coordinates
  [40.00010375, 40.00012076, 40.00010187], $ ; Y coordinates
  LINE_COLOR='red', $
  LINE_THICKNESS='4', $
  NAME='Street polyline'
 
annotation.AddText, $
  -105.22226374, 40.00064522, $ ; X and Y coordinates
  '55th Street', $
  GLYPH_COLOR='tomato', $
  NAME='Street label'
 
; Save the annotation set
outFile = e.GetTemporaryFilename()
annotation.Save, outFile
 
; Display the annotation layer
AnnLayer = View.CreateLayer(annotation)

Syntax


ENVIAnnotationSet.AddPolyline, X, Y [, Keywords=value]

Arguments


A polyline should have at least two unique vertices.

X

Specify a floating-point array with the X coordinates of vertices along the polyline.

Y

Specify a floating-point array with the Y coordinates of vertices along the polyline. The number of elements must match that of X, and they must be in the same corresponding order as X.

Keywords


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.

LINE_COLOR (optional)

Specify a three-element byte array or string with the color of the polyline. The default color is based on the current ENVI preference setting.

LINE_STYLE (optional)

Specify an integer value from 0 to 6, indicating the style of the polyline. The choices are as follows:

Value

Line Style

0

1

2

3

4

5

6

No line

The default is 0 (solid line).

LINE_THICK (optional)

Specify a floating-point value from 1 to 10, indicating the line thickness of the polyline. The default value is 2. ENVI will round the value to the nearest integer.

NAME (optional)

Set this keyword to a string with a custom name for the annotation item. This name will appear in the Layer Manager. The default value is "Polyline."

Version History


ENVI 5.6.1

Introduced

API Version


4.2

See Also


ENVIAnnotationSet