The GetPointsInRange function method returns unsorted points from the dataset. It is useful for iterating over the entire dataset in chunks. For example, read points 0-9999, then points 10000-19999, and so forth. This method returns the points directly from the file.
The coordinate system of the returned points can be determined from the ENVIPointCloudQuery property SPATIALREF.
Example
e = ENVI(/HEADLESS)
file = FILEPATH('DataSample.las', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data','lidar'])
pointcloudQuery = e.QueryPointCloud(file)
points = pointcloudQuery.GetPointsInRange(0, 100, INTENSITY=intensity)
print, 'Points = '
print, points
pointcloudQuery.Close
Syntax
Result = ENVIPointCloudQuery.GetPointsInRange(StartIndex, NumPoints [, ALL_ATTRIBUTES=variable] [, CLASSIFICATIONS=variable] [, CLASSIFICATION_FLAGS=variable] [, COUNT=variable] [, EDGE_OF_FLIGHT_LINE=variable] [, ERROR=variable] [, FILTER=filter] [, 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])
Return Value
A 3-by-n array of double-precision containing the x,y,z positions of the unsorted points read from the database starting at StartIndex that match the filter criteria (if any). If no NumPoints are left to read after the StartIndex value, then all of the remaining points will be returned by GetPointsInRange.
Arguments
StartIndex
The index of the first point to read from the file.
NumPoints
The number of points to read from the file from StartIndex.
Keywords
ALL_ATTRIBUTES
The ALL_ATTRIBUTES keyword returns all of the available attributes for the points returned by this method. Set this keyword to a named variable that will contain a structure that holds all the attributes. This is mainly useful for reading all of the attributes from one file and passing them to the ENVIPointCloud::WritePoints ALL_ATTRIBUTES keyword to write them to a new .las file.
CLASSIFICATIONS
Sets a named variable that will return a byte array containing the classification for each point returned from the query. This attribute refers to the original LAS file Classification values. The values may vary depending on the LAS file version.
LAS 1.4
|
LAS 1.0 - 1.3
|
Classification Value
|
Description |
Classification Value
|
Description |
0 |
Created, never classified
|
0 |
Created, never classified
|
1 |
Unclassified |
1 |
Unclassified |
2 |
Ground |
2 |
Ground |
3 |
Low vegetation |
3 |
Low vegetation |
4 |
Medium vegetation
|
4 |
Medium vegetation
|
5 |
High vegetation |
5 |
High vegetation |
6 |
Building |
6 |
Building |
7 |
Low point (noise)
|
7 |
Low point (noise)
|
8 |
Reserved |
8 |
Model Key-point (mass point)
|
9 |
Water |
9 |
Water |
10 |
Rail |
10 |
Reserved for ASPRS Definition
|
11 |
Road surface |
11 |
Reserved for ASPRS Definition
|
12 |
Reserved |
12 |
Overlap Points |
13 |
Wire - guard (shield)
|
13-31 |
Reserved for ASPRS Definition
|
14 |
Wire - conductor (phase)
|
|
|
15 |
Transmission tower
|
|
|
16 |
Wire-structure connector (e.g., insulator)
|
|
|
17 |
Bridge deck |
|
|
18 |
High noise |
|
|
19-63 |
Reserved |
|
|
64-255 |
User definable |
|
|
CLASSIFICATION_FLAGS
A byte to represent multiple classification flags which are represented by a maximum of 4 bits for LAS 1.4 and 3 bits otherwise. The bit definitions are:
Bit |
Field Name |
Description |
0 |
Synthetic |
If set, this point was created by a technique other than LiDAR collection, such as digitized from a photogrammetric stereo model or by traversing a waveform.
|
1 |
Key-point |
If set, this point is considered to be a model key-point and thus generally should not be withheld in a thinning algorithm.
|
2 |
Withheld |
If set, this point should not be included in processing (synonymous with Deleted).
|
3 |
Overlap |
For LAS 1.4. If set, this point is within the overlap region of two or more swaths or takes. Setting this bit is not mandatory unless it is mandated by a particular delivery specification, but it allows classification of overlap points to be preserved.
|
These bits are treated as flags and can be set or cleared in any combination. For example, a point with bits 0 and 1 both set to 1 and the CLASSIFICATION_FLAGS keyword set to 2 would be a ground point that had been synthetically collected and marked as a model key-point.
COUNT
Sets a named variable that will contain the number of points returned from the query.
EDGE_OF_FLIGHT_LINE
Sets a named variable that will return a byte array containing the edge of flight line status for each point returned from the query. This is 1 when the point is at the end of a scan, otherwise it is 0.
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.
FILTER
Sets an object reference to an ENVIPointCloudFilter object. If set, only the points that meet the filter criteria will be returned. Points can be filtered vertically (in the z direction) by using the HEIGHT property on ENVIPointCloudFilter.
GPS_TIME
Sets a named variable that will return a double-precision floating point array containing the time tag value at which the point was acquired for each point returned from the query. It is GPS Week Time if the Global Encoding low bit is clear and Adjusted Standard GPS Time if the Global Encoding low bit is set (see Global Encoding in the Public Header Block description).
INTENSITY
Sets a named variable that will return an unsigned integer array containing the pulse return magnitude for each point returned from the query. If intensity was not collected by the sensor, all intensity values are 0.
NIR
Sets a named variable that will return an unsigned integer array containing the near-infrared (NIR) value for each point returned from the query. The NIR values should always be normalized to 16-bit values (i.e., min value = 0, max value = 65535).
NUMBER_OF_RETURNS
Sets a named variable that will return a byte array containing the total number of returns for each point returned from the query. For example, a laser data point may return two (RETURN_NUMBER) within a total number of five returns.
POINT_SOURCE_ID
Sets a named variable that will return an unsigned integer array containing the point source ID for each point returned from the query. This value indicates the file from which this point originated. Valid values for this field are 1 to 65,535 inclusive with zero being used for a special case discussed below. The numerical value corresponds to the File Source ID from which this point originated. Zero is reserved as a convenience to system implementers. A value of zero implies that this point originated in this file.
RETURN_NUMBER
Sets a named variable that will return a byte array containing the pulse return number for each point returned from the query. A given output laser pulse can have many returns, and they must be marked in sequence of return. The first return will have a return number of one, the second a return number of two, and so forth. Up to 15 returns for LAS file version 1.4. Up to five returns for LAS file versions 1.0 through 1.3.
RGB
Sets a named variable that will return an unsigned integer array of size [3,n] containing the RGB color values for each point returned from the query. For LAS file versions 1.3 and 1.4, the Red, Green, Blue values should always be normalized to 16-bit values, i.e., min value = 0, max value = 65535.
SCAN_ANGLE
Sets a named variable that will return an integer array containing the scan angle rank for each point returned from the query. The scan angle rank is a signed number with a valid range from -90 to +90; it is the angle (rounded to the nearest integer in the absolute value sense) at which the laser point was output from the laser system including the roll of the aircraft. The scan angle is within 1 degree of accuracy. The scan angle is an angle based on 0 degrees being nadir, and -90 degrees to the left side of the aircraft in the direction of flight.
SCAN_DIRECTION_FLAG
Sets a named variable that will return a byte array containing the scan direction flag for each point returned from the query. This denotes the direction in which the scanner mirror was traveling at the time of the output pulse. A value of 1 is a positive scan direction, and a value of 0 is a negative scan direction (where positive scan direction is a scan moving from the left side of the in-track direction to the right side and negative the opposite).
SCANNER_CHANNEL
Sets a named variable that will return a byte array containing the channel (scanner head) of each point returned from the query. Channel 0 is used for single scanner systems. Up to four channels are supported (0-3).
USER_DATA
Sets a named variable that will return a byte array containing the user data for each point returned from the query. This field may be filled with data at the discretion of the .las file's author.
Version History
API Version
4.3
See Also
ENVIPointCloud, ENVIPointCloudQuery, ENVIPointCloud::WritePoints, ENVIPointCloudFilter