【问题标题】:R Read and Edit LAS FilesR 读取和编辑 LAS 文件
【发布时间】:2018-10-12 04:22:04
【问题描述】:

我在使用 rlas 和 rLiDAR 软件包读取和编辑 LAS 文件时遇到问题。我浏览了他们 PDF 文档上的示例,但我不断收到错误消息。下面是 rlas 包。

> lasfile <- system.file("LAS", "42389364730000.las", package = "rlas")
> lasdata <- rlas::readlasdata(lasfile)
ERROR: wrong file signature '~Version Information
 VERS.                 2.0: 
 WRAP.                 YES: 
 END.                PE'
ERROR: cannot open lasreaderlas with file name 'C:\Users\Paul.Victor\Documents\R\R-3.4.3\library\rlas\LAS\42389364730000.las'
Error: LASlib internal error. See message above.

以下是 rLiDAR 错误...

> lasfile <- system.file("LAS", "42389364730000.LAS", package = "rLiDAR")
> 
> lasdata <- readLAS(lasfile, short = TRUE)
Error in readLAS(lasfile, short = TRUE) : 
  The LASfile input is not a valid LAS file

我已将我的 LAS 文件保存在我的 system.file() 中每个包的文件夹中,类似于他们 PDF 上的示例。任何帮助解决这些问题或将我引导到不同的图书馆将不胜感激!

【问题讨论】:

    标签: r


    【解决方案1】:

    问题是您使用的库是为激光雷达 LAS 文件设计的,而您尝试读取的文件是测井 LAS 文件格式...具有相同文件扩展名的两种不同学科/数据类型。

    【讨论】:

      【解决方案2】:

      您没有正确调用文件路径。如果你想访问示例文件,你可以使用system.file 函数,但是像这样:

      > library(rlas)
      > lasfile <- system.file("extdata", "example.laz", package = "rlas")
      > lasdata <- rlas::readlasdata(lasfile)
      > str(lasdata)
      Classes ‘data.table’ and 'data.frame':  30 obs. of  13 variables:
       $ X                : num  339003 339003 339003 339003 339004 ...
       $ Y                : num  5248001 5248000 5248000 5248000 5248000 ...
       $ Z                : num  976 975 974 974 974 ...
       $ gpstime          : num  269347 269347 269347 269347 269347 ...
       $ Intensity        : int  82 54 27 55 117 81 84 104 91 99 ...
       $ ReturnNumber     : int  1 1 2 2 1 1 1 1 1 1 ...
       $ NumberOfReturns  : int  1 1 2 2 1 1 1 1 1 1 ...
       $ ScanDirectionFlag: int  1 1 1 1 0 0 1 1 1 1 ...
       $ EdgeOfFlightline : int  1 0 0 0 0 0 1 0 0 0 ...
       $ Classification   : int  1 1 1 1 1 1 1 1 1 1 ...
       $ ScanAngle        : int  -21 -21 -21 -21 -21 -21 -21 -21 -21 -21 ...
       $ UserData         : int  32 32 32 32 32 32 32 32 32 32 ...
       $ PointSourceID    : int  17 17 17 17 17 17 17 17 17 17 ...
       - attr(*, ".internal.selfref")=<externalptr> 
      

      查看here 以查看文件所在的位置。

      要导入您自己的文件,只需指定正确的路径,例如

      lasfile <- C:/Users/Paul.Victor/Documents/myproject/myfile.laz
      

      【讨论】:

      • 我尝试了您的建议,将 lasfile 设置为我的 las 的路径,但我的代码末尾仍然出现错误...
      • > library(rlas) > lasfile lasdata
      猜你喜欢
      • 2021-05-08
      • 2021-02-10
      • 2011-09-16
      • 1970-01-01
      • 1970-01-01
      • 2023-01-03
      • 2018-10-24
      • 1970-01-01
      • 2019-08-27
      相关资源
      最近更新 更多