The ConvertLonLatToMap method converts a set of geographic latitude and longitude coordinates (using WGS84 datum) to a set of map coordinates (x-eastings, y-northings) in the target spatial reference.
Example
The following example uses a fictitious point cloud file to demonstrate how to convert a LAS file to a different spatial reference.
e = ENVI(/HEADLESS)
targetSpatialRef = ENVIPointCloudSpatialRef(COORD_SYS_CODE=32618)
Lon = -105.20870000D
Lat = 40.00320278D
targetSpatialRef.ConvertLonLatToMap, [Lon, Lat], reprojectedPoints
print, 'Reprojected points ='
print, reprojectedPoints
Syntax
ENVIPointCloudSpatialRef.ConvertLonLatToMap, inPointArray, outPointArray [, ERROR=variable]
ENVIPointCloudSpatialRef.ConvertLonLatToMap, inOutPointArray, /CONVERT_IN_PLACE [, ERROR=variable]
Arguments
inOutPointArray
On input, a 3-by-n array of double-precision values containing the x,y,z positions of the points in a geographic (Longitude, Latitude) coordinate system. On completion of ConvertLonLatToMap, inOutPointArray contains 3-by-n array of double-precision values containing the x,y,z positions of the points in the spatialref specified by ENVIPointCloudSpatialRef. The original points are overwritten.
or
On input, a 2-by-n array of double-precision values containing the x,y positions of the points in a geographic (Longitude, Latitude) coordinate system. On completion of ConvertLonLatToMap, inOutPointArray contains a 2-by-n array of double-precision values containing the x,y positions of the points in the spatialref specified by ENVIPointCloudSpatialRef. The original points are overwritten.
inPointArray
A 3-by-n array of double-precision values containing the x,y,z positions of the points in the lon/lat coordinate system.
or
A 2-by-n array of double-precision values containing the x,y positions of the points in the lon/lat coordinate system.
outPointArray
A 3-by-n array of double-precision values containing the x,y,z positions of the points in the spatial reference specified by ENVIPointCloudSpatialRef.
or
A 2-by-n array of double-precision values containing the x,y positions of the points in the spatial reference specified by ENVIPointCloudSpatialRef.
Keywords
CONVERT_IN_PLACE
Indicates to not make a copy of the input array. The input array is overwritten with the projection results. If only one array argument is specified without CONVERT_IN_PLACE, an error will be thrown.
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.
Version History
API Version
4.3
See Also
ENVIPointCloudSpatialRef