Trouble reading LAZ lidar files in R download from NOAA DAV

59 views Asked by At

I am attempting to download the raw point cloud of a lidar acquisition from NOAA's Office of Coastal Management's Lidar database using R. The data download without error, but when I read in the laz files as a LASCatalog, I get the following error:

WARNING: only 148 bytes until point block when trying to read 12423 bytes into header.vlrs[1].data
WARNING: only 0 bytes until point block after reading 2 of 3 vlrs. skipping remaining vlrs ...
ERROR: this file was compressed with an experimental version of laszip
ERROR: please contact '[email protected]' for assistance.
ERROR: cannot open lasreaderlas with file name 'C:\Users\SCMCKENZIE\Downloads\Test.laz'
Error: LASlib internal error. See message above.
Error in !x@PHB[["Global Encoding"]][["WKT"]] : invalid argument type

Doing some Googling, I believe it is related to this this error, which suggests that it is not in fact an issue with LASzip, but rather an issue with downloading from NOAA's AWS server. I found this blog, whose comments suggest that it may be possible to download via FTP instead, but I have not been able to figure out how to do that. Any advice on other ways to download these data would be greatly appreciated. Below is a reproducible example of my workflow in R.

##install and/or necessary package##
if(!require(lidR)){
  install.packages("lidR")
}

##Download Text File of URLs with point cloud files##
download.file("https://noaa-nos-coastal-lidar-pds.s3.amazonaws.com/laz/geoid18/9305/urllist9305.txt", "lidarlist.txt")
lazlist<-read.table("lidarlist.txt")
download.file(lazlist$V1[9], "Test.laz")

test<-readLAScatalog("Test.laz") #Throws Error
test<-readLAS("Test.laz") #Crashes R

Apologies in advance for cross-posting

1

There are 1 answers

0
JRR On

lidR uses LASlib/LASzip from LAStools to read and write LAS and LAZ files. Your files are corrupted. Story ends here. You must find non-corrupted files, or you must try to reproduce with LAStools (using e.g. lasinfo) and report to LAStools to see if they have solutions to offer. Here in lidR I can't help you.