An E3DLidarSpatialRef object can be created directly, or it can be retrieved though the SPATIALREF property of E3DLidar. If you PRINT this object, all properties are listed, regardless of the spatial reference type.

This method has been deprecated. Use ENVIPointCloudSpatialRef instead.

Example 1


The following example prints spatial reference information from a LAS file:

; Create a headless instance
e = E3De(/HEADLESS)
 
; Open a las file with spatial reference
lidar = e.OpenLidar('georefed-lidar.las', /DIRECT_READ)
 
; Get and print the spatial reference information
spatialref = lidar.SPATIALREF
print, spatialref
 
; Close any open lidar objects
e.Close

Example 2


The following example takes a LAS file with no spatial reference information and copies the contents to a new LAS file, adding spatial reference information:

; Create a headless instance
e = E3De(/HEADLESS)
 
file = FILEPATH('DataSample.las', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['DataSample'])
lidar = e.OpenLidar(file, /DIRECT_READ)
 
; The EPSG code for the DataSample is 32633
sref = E3DLidarSpatialRef(COORD_SYS_CODE=32633)
File_Mkdir, 'C:\CreatedLasFiles'
 
; Create file to write
writer = E3DLidar('C:\CreatedLasFiles\DataSampleGeoRefed.las', SPATIALREF=sref)
 
nPoints = lidar.total_number_of_points
 
index = 0UL
blocksize = 100000 ; 100,000 points at a time
while (index lt nPoints) do begin
  points = lidar.GetPointsInRange(index, blocksize, ALL_ATTRIBS=allAttribs)
    ; Write block of points to file along with all point attributes
    writer.WritePoints, points, ALL_ATTRIBS=allAttribs
  index += blocksize
endwhile
 
; Save the file
writer.Save
 
; Close any open lidar objects
e.Close

Properties


COORD_SYS_CODE (Init,Get)

An unsigned long integer containing a geographic (GEOGCS) or projected (PROJCS) coordinate system code (EPSG code).

If this property and GEOCENTRIC are 0 and COORD_SYS_STR is an empty string, then the E3DLidarSpatialRef object represents an arbitrary coordinate system (the geographic location and projection is unknown).

If COORD_SYS_STR and COORD_SYS_CODE are both set in the call to E3DLidarSpatialRef, the COORD_SYS_STR takes precedence and the COORD_SYS_CODE value is set to 0.

COORD_SYS_STR (Set, Get)

A string containing a geographic (GEOGCS) or projected (PROJCS) coordinate system string (Well Known Text or WKT string)

If this string is empty and COORD_SYS_CODE is 0, then the E3DLidarSpatialRef represents an arbitrary coordinate system (the geographic location and projection is unknown).

GEOCENTRIC (Set, Get)

A boolean value that specifies if the coordinate system is Geocentric (ECEF).

UNITS (Set, Get)

An integer containing the units of the coordinate system. Valid values are as follows:

  • 0 - UNITS_METRIC
  • 1 - UNITS_FEET_INTERNATIONAL
  • 2 - UNITS_FEET_US_SURVEY

Units must be set if the coordinate system is arbitrary. If a COORD_SYS_CODE is set and UNITS are set, the units implied by the EPSG code are overridden. If COORD_SYS_STR is set then UNITS are ignored as the string already contains the units.

If the coordinate system is geographic then units must be set to specify the vertical units.

Version History


3.2

Introduced

ENVI 5.3 Obsolete

See Also


E3DLidar