ENVIPointCloud::WritePoints

The WritePoints method writes points to a new .las file. Each call to WritePoints appends the supplied points to those already written. Call ENVIPointCloud::Save to finish writing points to the file.

Example

; Create a headless instance

e = ENVI(/HEADLESS)

 

; Open existing data

file = FILEPATH('DataSample.las', ROOT_DIR=e.ROOT_DIR, $

SUBDIRECTORY = ['data','lidar'])

pointcloud = e.OpenPointCloud(file, $

  PROJECT_URI=Filepath('DataSample', /TMP))

 

; Query points within a specified rectangular region to be written to file

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)

 

; Write points and all attributes to the file

writer.WritePoints, points, ALL_ATTRIBUTES=allAttributes

writer.Save

print, 'Points within queried rectangle written to ', newFile

 

; Close the writer and point cloud objects.

writer.Close

pointcloud.Close

Syntax

ENVIPointCloud.WritePoints, Points [, ALL_ATTRIBUTES=variable] [, CLASSIFICATIONS=variable] [, CLASSIFICATION_FLAGS=variable] [, EDGE_OF_FLIGHT_LINE=variable] [, ERROR=variable] [, GPS_TIME=variable] [, INTENSITY=variable] [, NIR=variable] [, NUMBER_OF_RETURNS=variable] [, POINT_SOURCE_ID=variable] [, RETURN_NUMBER=variable] [, RGB=variable] [, SCAN_ANGLE=variable] [, SCAN_DIRECTION_FLAG=variable] [, SCANNER_CHANNEL=variable] [, USER_DATA=variable])

Arguments

Points

The 3-by-n array of points to be written to the file. These points are appended to any points written previously.

Keywords

ALL_ATTRIBUTES

Set this keyword to the structure that was returned from the ALL_ATTRIBUTES keyword on GetPointsInCircle, GetPointsInPolygon, GetPointsInRange, GetPointsInRect, or GetPointsInTile. This is useful if all of the per-point attributes read from the input file should be written to the new file.

If any of the per-point attribute keywords are specified as well as ALL_ATTRIBUTES (for example, RGB, INTENSITY, etc.), then the values passed by the keyword will override the corresponding attribute values in ALL_ATTRIBUTES.

CLASSIFICATIONS

An array of bytes containing the classification for each point.

CLASSIFICATION_FLAGS

An array of bytes containing the special characteristics associated with each point.

EDGE_OF_FLIGHT_LINE

An array of bytes containing the edge of flight line status.

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.

GPS_TIME

An array of double-precision floating points containing the time tag value at which each point was acquired.

INTENSITY

An array of unsigned integers containing the pulse return magnitude for each point.

NIR

An array of unsigned integers containing the near-infrared (NIR) value for each point.

NUMBER_OF_RETURNS

An array of bytes containing the total number of returns for each point.

POINT_SOURCE_ID

An array of unsigned integers containing the point source ID foe each point.

RETURN_NUMBER

An array of bytes containing the pulse return number for each point.

RGB

An array of unsigned integers of size [3,n] containing the RGB color values for each point.

SCAN_ANGLE

An array of integers containing the scan angle rank for each point.

SCAN_DIRECTION_FLAG

An array of bytes containing the scan direction flag for each point.

SCANNER_CHANNEL

An array of bytes containing the channel (scanner head) of each point.

USER_DATA

An array of bytes containing the user data for each point.

Version History

ENVI 5.3

Introduced

API Version

4.2

See Also

ENVIPointCloud, ENVIPointCloud::GetPointsInCircle, ENVIPointCloud::GetPointsInPolygon, ENVIPointCloud::GetPointsInRange, ENVIPointCloud::GetPointsInRect, ENVIPointCloud::GetPointsInTile