The Init function method initializes the ENVIPointCloud object.
Note: Init methods are special lifecycle methods, and as such cannot be called outside the context of object creation. This means that in most cases, you cannot call the Init method directly. There is one exception to this rule: if you write your own subclass of this class, you can call the Init method from within the Init method of the subclass.
An ENVIPointCloud object should only be created directly if creating a new .las file to write points to. To open an existing point cloud file, call ENVI::OpenPointCloud to return an ENVIPointCloud object.
Example
e = ENVI(/HEADLESS)
file = FILEPATH('DataSample.las', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data','lidar'])
pointcloud = e.OpenPointCloud(file, $
PROJECT_URI=Filepath('DataSample', /TMP))
points = pointcloud.GetPointsInRect(593742.0d, 5289519.0d, 593800.0d, 5289650.0d, $
ALL_ATTRIBUTES=allAttributes)
File_Mkdir, 'C:\lidar\CreatedLasFiles'
newFile = 'C:\lidar\CreatedLasFiles\DataSampleSubset.las'
writer = ENVIPointCloud(newFile, /OVERWRITE)
writer.WritePoints, points, ALL_ATTRIBUTES=allAttributes, ERROR=error
writer.Save
print, 'Points within queried rectangle written to ', newFile
writer.Close
pointcloud.Close
Syntax
Obj = ENVIPointCloud(filename [, ERROR=variable] [, LAS_SCALE_FACTOR=variable] [, LAS_OFFSET=variable] [, /OVERWRITE] [, SPATIALREF=ENVIPointCloudSpatialRef])
Return Value
If successful, a reference to the ENVIPointCloud object is returned. Otherwise, a NULL object reference is returned.
Arguments
Filename
The fully qualified filename to be written, including the .las extension.
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.
LAS_OFFSET (Init)
Set this keyword to a three-element array of doubles that specify the x, y, and z offsets used in the new LAS file being written. The offsets can effect the precision of the point positions stored in the LAS file. See the LAS specification on the ASPRS web site for more details. If this keyword is not set the default value for LAS_OFFSET is [0.0, 0.0, 0.0].
LAS_SCALE_FACTOR (Init)
Set this keyword to a three-element array of doubles that specify the x, y, and z scale factors used in the new LAS file being written. The scale factors can effect the precision of the point positions stored in the LAS file. See the LAS specification for more details.
If this keyword is not set the default value for LAS_SCALE_FACTOR is [0.0000001, 0.0000001, 0.0000001] for LAS files using lat/lon coordinate system and [0.01, 0.01, 0.01] for all other coordinate systems.
OVERWRITE (Init)
By default, if the LAS file specified by the filename parameter already exists, an error will be thrown. Set this keyword to enable overwriting an existing LAS file.
SPATIALREF (Init)
Set this property to an ENVIPointCloudSpatialRef object to have the coordinate system information contained in the ENVIPointCloudSpatialRef written to the .las file.
Note: If the coordinate system information is specified using the COORD_SYS_STR it must have a corresponding COORD_SYS_CODE for it to be written to the .las file.
Version History
API Version
4.2
See Also
ENVIPointCloud, ENVI::OpenPointCloud