An ENVIPointCloudSpatialRef object can be created directly, or it can be retrieved though the SPATIALREF property of ENVIPointCloud. If you PRINT this object, all properties are listed, regardless of the spatial reference type.
Example 1
The following example prints spatial reference information from a LAS file:
e = ENVI(/HEADLESS)
file = FILEPATH('DataSample.las', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data','lidar'])
pointcloudQuery = e.QueryPointCloud(file)
pointcloudSpatialRef = pointcloudQuery.SpatialRef
print, pointcloudSpatialRef
pointcloudQuery.Close
Example 2
The following example opens a LAS file with spatial reference information. It converts the contents to a new coordinate system and writes the converted contents to a LAS file with the new spatial reference information. This example may take several minutes to complete.
e = ENVI(/HEADLESS)
originalFile = FILEPATH('DataSample.las', ROOT_DIR=e.ROOT_DIR, $
SUBDIRECTORY = ['data','lidar'])
pointcloudQuery = e.QueryPointCloud(originalFile)
sourceSpatialRef = pointcloudQuery.SPATIALREF
targetSpatialRef = ENVIPointCloudSpatialRef(COORD_SYS_CODE = 4326)
File_Mkdir, 'C:\lidar\CreatedLasFiles'
reprojectedFile = 'C:\lidar\CreatedLasFiles\DataSampleLatLong.las'
writer = ENVIPointCloud(reprojectedFile, SPATIALREF=targetSpatialRef)
nPoints = pointcloudQuery.NPOINTS
index = 0UL
blocksize = 100000
while (index lt nPoints) do begin
originalPoints = pointcloudQuery.GetPointsInRange(index, blocksize, ALL_ATTRIBUTES=allAttributes)
sourceSpatialRef.ConvertMapToLonLat, originalPoints, reprojectedPoints
writer.WritePoints, reprojectedPoints, ALL_ATTRIBUTES=allAttributes
index += blocksize
endwhile
writer.Save
print, 'Reprojected file written to ', reprojectedFile
pointcloudQuery.Close
Methods
ConvertLonLatToMap
ConvertMapToLonLat
ConvertMapToMap
Dehydrate
Hydrate
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 ENVIPointCloudSpatialRef 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 ENVIPointCloudSpatialRef, the COORD_SYS_STR takes precedence and the COORD_SYS_CODE value is set to 0.
COORD_SYS_STR (Init, 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 ENVIPointCloudSpatialRef represents an arbitrary coordinate system (the geographic location and projection is unknown).
GEOCENTRIC (Init, Get)
A boolean value that specifies if the coordinate system is Geocentric.
UNITS (Init, Get)
A scalar string that specifies the units of the coordinate system. Valid values are:
- METERS
- FEET_INTERNATIONAL
- FEET_US_SURVEY
Units must be set if the coordinate system is arbitrary. 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
ENVI 5.3 |
Introduced |
ENVI 5.3.2 |
Added Dehydrate method |
ENVI 5.4 |
Added Hydrate method
|
API Version
4.2
See Also
ENVIPointCloud