ENVIGCPSet::Hydrate

Use the Hydrate static function method to create the object from its dehydrated form. The dehydrated form consists of a hash containing the object’s properties and values. The Hydrate and Dehydrate methods let you store the object state in memory and restore it later.

Representing an object as a hash is necessary for running ENVI analytics with the ENVI Task Engine.

See the ENVIHydrate function if you are creating a general IDL routine that will restore multiple object types.

For additional information, see What are Hydrate and Dehydrate routines used for?

Example

; Start the application

e = ENVI(/HEADLESS)

 

; Create an ENVIGCPSet object

GCPFile = Dialog_Pickfile(TITLE='Select an ENVI .pts file')

GCPs = ENVIGCPSet(GCPFile)

 

; Retrieve the dehydrated hash

dehydratedForm = GCPs.Dehydrate()

GCPs.close

 

; Restore the object

newGCPs = ENVIGCPSet.Hydrate(dehydratedForm)

Print, newGCPs, /IMPLIED_PRINT

Syntax

Result = ENVIGCPSet.Hydrate(DehydratedForm, ERROR=value)

Return Value

The result is a reference to a new object instance of this virtual raster class.

Arguments

DehydratedForm

The form of the hash depends on if you have created or updated the GCPSet from raw data or if the GCPSet has been loaded from a file.

GCPSet loaded from a file:

Key

Description

factory

Required. A string value of URLGCPSet indicating what object type the hash represents.

url

Required. A uniform resource locator (URL) identifying a GCP file for use in ENVI processing. Example:

"url" : "/usr/local/INSTALL_DIR/envi/mydata/mygcp.pts"

apply_offset

A two-element array with the x (column) and y (row) offsets subtracted from all of the GCPs defined by the url key. You typically only use this key when applying GCPs from a full input image to a spatially subsetted image with tasks such as RPC orthorectification.

coord_sys

Overrides the coordinate system of the GCP file. Example:

"coord_sys" : {
   "factory" : "CoordSys",
   "coord_sys_code" : 20354

   }

See ENVICoordSys::Dehydrate for more information.

GCPSet created or updated from an array:

Key

Description

factory

Required. A string value of GCPSet indicating what object type the hash represents.

gcp

A list containing GCP points. See below table. Example:

"gcp": [

{

"factory": "GCP",

"x": -106.30000000000000,

"y": 31.800000000000001,

"z": 1185.0000000000000,

"column": 3369.5799999999999,

"row": 7025.4799999999996,

"name": "RoadIntersection",

"id": 0

}

]

coord_sys

Required. An ENVICoordSys that indicates the coordinate system of the GCPset. Example:

"coord_sys" : {
   "factory" : "CoordSys",
   "coord_sys_code" : 20354

   }

See ENVICoordSys::Dehydrate for more information.

A list of GCP points:

Key

Description

factory

Required. A string value of GCP indicating what object type the hash represents.

x

Required. A double-precision floating-point value representing the longitude or easting value of the GCP.

y

Required. A double-precision floating-point value representing the latitude or northing value of the GCP.

z A double-precision floating-point value representing the elevation (in meters) of the GCP.
column Required. The pixel x-coordinate value of the GCP.
row Required. The pixel y-coordinate value of the GCP
name A string with a unique name for the GCP.
id An integer with a unique IDfor the GCP.

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.

Version History

ENVI 5.4

Introduced

API Version

4.2

See Also

ENVIGCPSet, ENVIGCPSet::Dehydrate, ENVIHydratable, ENVIHydrate