Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readLAS crashes when reading ALS las files, after previously working #323

Closed
Joe-StPeter opened this issue Mar 2, 2020 · 10 comments
Closed
Assignees
Labels
Bug A bug in the package Not lidR Issue not actually related to lidR Segfault Damned R crashed!

Comments

@Joe-StPeter
Copy link

I have previously been using the lidR package and it was working great (great work!). However today I simply tried to open an airborne las file and the R sessions crashed. Here is the code, it ain't complicated.

library(lidR)
las = readLAS("Las_files/e1054n0839.las")

I have uploaded the example las file here.

This crashes the R session, either in R or R studio (grey bomb). I have tried to open multiple airborne LiDAR las files from this same dataset and they all crash R. However, when I open much larger las files (100 times larger) from a different project they load into R just fine. I have updated my R version to 3.6.2, updated to the latest version of lidR, checked my filepaths, had the las file on my C drive, and on an external hard drive, doesn't matter.

I have checked the las files in other programs such as PDQ viewer and ArcGIS and they look fine and perform fine in those software programs. And like I said everything was working fine yesterday. I would also note that I had similar experience on a different computer, when I tried to readLAS or put into a las catalog the session crashed. I would be happy to learn that this behavior is due to something I, the user, is doing.

@Jean-Romain Jean-Romain self-assigned this Mar 2, 2020
@Jean-Romain
Copy link
Collaborator

Jean-Romain commented Mar 2, 2020

This file is read on my computer GNU/linux, rlas v1.3.5. Please check your version of rlas. Check also your version of lidR. Current release is 2.2.2

@Joe-StPeter
Copy link
Author

Joe-StPeter commented Mar 2, 2020

Thanks for the quick reply. Both rlas and lidR are updated versions -
other attached packages:

[1] lidR_2.2.2 raster_3.0-12 sp_1.4-0 rlas_1.3.5 

I am sorry this is not reproducing.

@Jean-Romain
Copy link
Collaborator

So it is a Windows or Mac specific issue. Please report your sessionInfo()

@Joe-StPeter
Copy link
Author

Joe-StPeter commented Mar 2, 2020

R version 3.6.2 (2019-12-12)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 
 
locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lidR_2.2.2    raster_3.0-12 sp_1.4-0      rlas_1.3.5   

loaded via a namespace (and not attached):
[1] compiler_3.6.2    tools_3.6.2       Rcpp_1.0.3        codetools_0.2-16  grid_3.6.2        data.table_1.12.8
[7] lattice_0.20-38 

@Jean-Romain
Copy link
Collaborator

Jean-Romain commented Mar 2, 2020

I read your file on Windows 7, R 3.5.3 32 bits rlas 1.3.5, lidR 2.2.2

x = rlas::read.las("H://issue46/e1054n0839.las") # ok
x = lidR::readLAS("H:/Téléchargements/issue46/e1054n0839.las") # ok

Then on Windows 7, R 3.6.1 64 bits rlas 1.3.5, lidR 2.2.2

x = rlas::read.las("H://issue46/e1054n0839.las") # ok
x = lidR::readLAS("H:/Téléchargements/issue46/e1054n0839.las") # crash
x = rlas:::stream.las("H://Téléchargements/issue46/e1054n0839.las") # ok

I confirm the bug. However on Windows tools to debug such kind of trouble do not exist so I don't know how and when I will be able to fix it.

Other tests

x = rlas:::stream.las("H://Téléchargements/issue46/e1054n0839.las") # ok
x = rlas:::C_reader("H:/Téléchargements/issue46/e1054n0839.las", "", select = "*", filter = "", filter_wkt = ) # ok

I'm moving the question to lidR it seems it comes from it. Minimal reproducible example:

data =  rlas::read.las("H://Téléchargements/issue46/e1054n0839.las")                   
header= rlas::read.lasheader("H:/Téléchargements/issue46/e1054n0839.las")
las = lidR::LAS(data, header) # crash

@Jean-Romain Jean-Romain transferred this issue from r-lidar/rlas Mar 2, 2020
@Jean-Romain Jean-Romain added Bug A bug in the package Segfault Damned R crashed! labels Mar 2, 2020
@Jean-Romain
Copy link
Collaborator

I spotted the issue

header <- rlas::read.lasheader("H:/Téléchargements/issue46/e1054n0839.las")
header <- lidR::LASheader(header)
proj4string <- lidR::projection(header, asText = FALSE)  # crash

@Jean-Romain
Copy link
Collaborator

Minimal reproducible example

wkt = "PROJCS[\"NAD83 (2011) / Conus Albers\",GEOGCS[\"GCS_NAD_1983_2011\",DATUM[\"D_NAD_1983_2011\",SPHEROID[\"GRS_1980\",6378137.0,298.257222101,AUTHORITY[\"EPSG\",7019]],AUTHORITY[\"EPSG\",1116]],PRIMEM[\"Greenwich\",0.0,AUTHORITY[\"EPSG\",8901]],UNIT[\"Degree\",0.0174532925199433,AUTHORITY[\"EPSG\",9102]],AUTHORITY[\"EPSG\",6318]],PROJECTION[\"Albers\",AUTHORITY[\"Esri\",43007]],PARAMETER[\"False_Easting\",0.0,AUTHORITY[\"Esri\",100001]],PARAMETER[\"False_Northing\",0.0,AUTHORITY[\"Esri\",100002]],PARAMETER[\"Central_Meridian\",-96.0,AUTHORITY[\"Esri\",100010]],PARAMETER[\"Standard_Parallel_1\",29.5,AUTHORITY[\"Esri\",100025]],PARAMETER[\"Standard_Parallel_2\",45.5,AUTHORITY[\"Esri\",100026]],PARAMETER[\"Latitude_Of_Origin\",23.0,AUTHORITY[\"Esri\",100021]],UNIT[\"Meter\",1.0,AUTHORITY[\"EPSG\",9001]]],VERTCS[\"NAVD_1988\",VDATUM[\"North_American_Vertical_Datum_1988\",AUTHORITY[\"EPSG\",5103]],PARAMETER[\"Vertical_Shift\",0.0,AUTHORITY[\"Esri\",100006]],PARAMETER[\"Direction\",1.0,AUTHORITY[\"Esri\",100007]],UNIT[\"Meter\",1.0,AUTHORITY[\"EPSG\",9001]],AUTHORITY[\"EPSG\",5703]]"
proj4 = rgdal::showP4(wkt)
crs = sp::CRS(proj4)  # crash

I'm closing the issue because it is not related to lidR

@Jean-Romain Jean-Romain added the Not lidR Issue not actually related to lidR label Mar 3, 2020
Jean-Romain added a commit that referenced this issue Mar 4, 2020
@Jean-Romain
Copy link
Collaborator

Fixed in v2.2.4

@Joe-StPeter
Copy link
Author

Thank you!

@Jean-Romain
Copy link
Collaborator

For your information the conclusion is that the coordinate reference in your file is invalid. The issue went upstream to sp edzer/sp#75 then upstream again to libproj OSGeo/PROJ#2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in the package Not lidR Issue not actually related to lidR Segfault Damned R crashed!
Projects
None yet
Development

No branches or pull requests

2 participants