This method closes the ENVIPointCloud object for writing. After calling Save, the ENVIPointCloud object is no longer available for data access; attempting to call any methods on the invalidated ENVIPointCloud object will result in an error. To access the data, re-open the point cloud file by calling OpenPointCloud (to build a project) or QueryPointCloud (to open the point cloud file, but not build a project).

Note: You must call Save when you are finished writing data to the new point cloud file, or the resulting ENVIPointCloud object will be left in an incomplete state (you cannot retrieve data from it).


; Start the application
; Open existing data
file = FILEPATH('DataSample.las', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data','lidar'])
pointcloudQuery = e.QueryPointCloud(file)
; Get the first 1000 points to be written to file along with all point attributes
points = pointcloudQuery.GetPointsInRange(0, 1000, ALL_ATTRIBUTES=allAttributes)
; Create the writer object
File_Mkdir, 'C:\lidar\CreatedLasFiles'
newFile = 'C:\lidar\CreatedLasFiles\DataSampleSubset.las'
writer = ENVIPointCloud(newFile, /OVERWRITE)
; write points to the file
writer.WritePoints, points, ALL_ATTRIBUTES=allAttributes
; Save the file
print, 'Points within queried range written to ', newFile
; Close the point cloud object


ENVIPointCloud.Save [ERROR=variable]



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.3


API Version


See Also

ENVIPointCloud, ENVI::OpenPointCloud