# NOT RUN {
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las <- readLAS(LASfile)
# Get the EPSG code stored in the header (returns 0 if not recorded)
epsg(las)
# Get the WKT string stored in the header (LAS >= 1.4)
wkt(las)
if (rgdal::new_proj_and_gdal())
{
# Get the WKT of the CRS
sp::wkt(crs(las))
# Recorded CRS is "NAD83 / UTM zone 17N"
sf::st_crs(las)$input
}
# Overwrite the CRS (but does not reproject)
crs <- sp::CRS("+init=epsg:26918")
projection(las) <- crs
sf::st_crs(las)$input
# Uses the EPSG code
projection(las) <- 26919
sf::st_crs(las)$input
# Uses a crs from sf
crs <- sf::st_crs(3035)
projection(las) <- crs
# }
Run the code above in your browser using DataLab