This method has been deprecated. Use the ENVIPseudoRasterSpatialRef, ENVIRPCRasterSpatialRef, or ENVIStandardRasterSpatialRef constructor functions to create new spatial reference objects.

The CreateRasterSpatialRef function method creates a new ENVIPseudoRasterSpatialRef, ENVIRPCRasterSpatialRef, or ENVIStandardRasterSpatialRef object that is not associated with an ENVIRaster object.

You typically create one of the ENVIRasterSpatialRef* objects with this method to override the spatial reference upon opening or creating a raster dataset.

Note: To achieve the highest level of accuracy, specify keyword values as double-precision floating-point numbers.

Example


The following example creates a custom ENVIRasterSpatialRefStandard object and uses that as a template when creating a new ENVIRaster.

; Launch the application
e = ENVI()
 
; The custom coordinate system code
css = 2231
 
; Create a custom spatial reference object
spatialRef1 = e.CreateRasterSpatialRef('standard', $
  COORD_SYS_CODE=css, /PROJCS, $
  PIXEL_SIZE=[9.186D,9.186D], TIE_POINT_PIXEL=[0.0D,0.0D], $
  TIE_POINT_MAP=[3075299.7946D,1246937.9905D])
 
; Open a file but override its spatial reference in formation
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file, SPATIALREF_OVERRIDE=spatialRef1)
 
; Show that the template spatial reference was used
PRINT, 'Override coordinate system code = ', css
PRINT, 'New raster coordinate system code = ', $
  raster.SPATIALREF.COORD_SYS_CODE

Syntax


Result = ENVI.CreateRasterSpatialRef(Type [, COORD_SYS_CODE=integer] [, COORD_SYS_STR=string] [, ERROR=variable] [, /GEOGCS] [, PIXEL_SIZE=array] [, /PROJCS] [, PSEUDO_GEO_POINT_1=array] [, PSEUDO_GEO_POINT_2=array] [, PSEUDO_GEO_POINT_3=array] [, PSEUDO_GEO_POINT_4=array] [, ROTATION=variable] [, RPC_LINE_DEN_COEFF=array] [, RPC_LINE_NUM_COEFF=array] [, RPC_OFFSETS=array] [, RPC_SAMP_DEN_COEFF=array] [, RPC_SAMP_NUM_COEFF=array] [, RPC_SCALES=array] [, TIE_POINT_MAP=array] [, TIE_POINT_PIXEL=array] )

Return Value


This method returns a reference to a new ENVIPseudoRasterSpatialRef, ENVIRPCRasterSpatialRef, or ENVIStandardRasterSpatialRef object.

Arguments


Type

A scalar string that specifies the type of spatial reference to be created. Possible values are:

Value

Required Keywords

Optional Keywords

'rpc'

All RPC_* keywords

 

'standard'

PIXEL_SIZE, TIE_POINT_MAP, TIE_POINT_PIXEL, and either COORD_SYS_CODE or COORD_SYS_STR

ROTATION, GEOGCS, and PROJCS

'pseudo'

All PSEUDO_GEO_POINT_* keywords

 

Note: When creating a spatial reference of type 'rpc' or 'pseudo', the coordinate system is automatically set to WGS-1984.

Keywords


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

COORD_SYS_CODE

Set this keyword to a valid geographic (GEOGCS) or projected (PROJCS) coordinate system code. In addition to this keyword, either the PROJCS or GEOGCS keywords should be specified. If neither the PROJCS nor GEOGCS keywords are specified, the coordinate system code is assumed to be projected (PROJCS).

This keyword only applies if the Type argument is set to 'standard'. If this keyword is set, COORD_SYS_STR is ignored.

COORD_SYS_STR

Set this keyword to a valid geographic (GEOGCS) or projected (PROJCS) coordinate system string.

This keyword only applies if the Type argument is set to 'standard'. If COORD_SYS_CODE is set, this keyword is ignored.

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.

GEOGCS

Set this keyword to declare that the value of the COORD_SYS_CODE is to be interpreted as a geographic (GEOGCS) coordinate system code.

If the COORD_SYS_CODE keyword is not set, this keyword is ignored.

PIXEL_SIZE

This is a two-element array [X_Pixel_Size, Y_Pixel_Size] specifying the pixel size of the data.

This keyword is required if the Type argument is set to 'standard'. For other values of Type, this keyword is ignored.

PROJCS

Set this keyword to declare that the value of the COORD_SYS_CODE is to be interpreted as a projected (PROJCS) coordinate system code.

If the COORD_SYS_CODE keyword is not set, this keyword is ignored.

PSEUDO_GEO_POINT_1, PSEUDO_GEO_POINT_2, PSEUDO_GEO_POINT_3, PSEUDO_GEO_POINT_4

Each keyword is a four-element array [X_pixel, Y_pixel, Longitude, Latitude] specifying a geographic corner for a non-georeferenced file.

These keywords are required if the Type argument is set to 'pseudo'. For other values of Type, this keyword is ignored.

ROTATION

Set this keyword to a floating-point value specifying the rotation of the image in the defined projection (degrees clockwise from North).

This keyword only applies if the Type argument is set to 'standard'. If this keyword is not set, a default value of 0.0 is used.

RPC_LINE_DEN_COEFF

Set this keyword to a 20-element, double-precision array of RPC line denominator coefficients.

This keyword is required if the Type argument is set to 'rpc'. For other values of Type, this keyword is ignored.

RPC_LINE_NUM_COEFF

Set this keyword to a 20-element, double-precision array of RPC line numerator coefficients.

This keyword is required if the Type argument is set to 'rpc'. For other values of Type, this keyword is ignored.

RPC_OFFSETS

Set this keyword to a five-element, double-precision array that specifies the RPC Line_Offset, Sample_Offset, Latitude_Offset, Longitude_Offset, and Height_Offset values.

This keyword is required if the Type argument is set to 'rpc'. For other values of Type, this keyword is ignored.

RPC_SAMP_DEN_COEFF

Set this keyword to a 20-element, double-precision array of RPC sample denominator coefficients.

This keyword is required if the Type argument is set to 'rpc'. For other values of Type, this keyword is ignored.

RPC_SAMP_NUM_COEFF

Set this keyword to a 20-element, double-precision array of RPC sample numerator coefficients.

This keyword is required if the Type argument is set to 'rpc'. For other values of Type, this keyword is ignored.

RPC_SCALES

Set this keyword to a five-element, double-precision array that specifies the RPC Line_Scale, Sample_Scale, Latitude_Scale, Longitude_Scale, and Height_Scale values.

This keyword is required if the Type argument is set to 'rpc'. For other values of Type, this keyword is ignored.

TIE_POINT_MAP

Set this keyword to a two-element array [X Tie Point, Y Tie Point] representing the map location that corresponds to the pixel location (TIE_POINT_PIXEL).

This keyword is required if the Type argument is set to 'standard'. For other values of Type, this keyword is ignored.

TIE_POINT_PIXEL

Set this keyword to a two-element array [X Pixel, Y Pixel] representing the pixel location that corresponds to the map location (TIE_POINT_MAP). The default location of the upper-left pixel for images displayed in ENVI is (0,0). The reference (tie point) pixel values in the map info field of an ENVI header file are one-based. If the TIE_POINT_PIXEL values come directly from an ENVI header file, you must subtract 1 from x and y.

This keyword is required if the Type argument is set to 'standard'. For other values of Type, this keyword is ignored.

Note: From the ENVI 5.0 release to the ENVI 5.0.2 release, the upper-left pixel for images was (1,1).

Version History


ENVI 5

Introduced

ENVI

Deprecated