[R-sig-Geo] LiDAR LAS file import into R via RSAGA

Clay S clayms at gmail.com
Sat Feb 13 08:17:43 CET 2016


Another option would be to create a SAGA tool chain XML file following the
tutorials by Michael Bock, Olaf Conrad, Volker Wichmann, and drag that XML
file into the SAGA module library.  Does anyone know if you can access your
own SAGA tool chains with the RSAGA::rsaga.geoprocessor command?  I suppose
the parameters for each module in the chain would be set according to the
XML file.  If that is the case, then I also suppose you could edit the XML
file with R before you run the tool chain.  But I am getting ahead of
myself.

Unfortunately, the most recent version of SAGA that the OSGeo4W is 2.1.2-1,
which does not have the tool chains feature. That was added in SAGA 2.1.3.
Does anyone know when OSGeo4W will get updated?





On Fri, Feb 12, 2016 at 7:51 PM, Clay S <clayms at gmail.com> wrote:

> Thanks Michael Sumner
>
> rLidar works well.  But how do I pass the lidar data to another SAGA
> module within R without saving the output of each step as a file in a whole
> series of SAGA module calls from R?
>
> I would like something like the dplyr %>% pipe command.
>
> Thanks
> Clay
>
> On Fri, Feb 12, 2016 at 7:44 PM, Michael Sumner <mdsumner at gmail.com>
> wrote:
>
>> Try rLidar::readLAS as a straightforward alternative, it's not bullet
>> proof but works fine for a lot of examples. Happy to help extend it if your
>> format is not supported.
>>
>> Cheers, Mike
>>
>> On Fri, 12 Feb 2016 7:41 am Clay S <clayms at gmail.com> wrote:
>>
>>> Hi
>>>
>>> Is it possible to import a Lidar LAS file into R with the
>>> rsaga.geoprocessor function of the RSAGA package.  The following code
>>> runs
>>> without an error, but all I get in R is the SAGA console output.
>>>
>>> The R code below does save a SAGA point cloud file called "test" in my
>>> working directory.  If I delete the `POINTS = "test"` parameter, then
>>> nothing happens as expected.  However, I want to work with the data in R,
>>> and pass the point cloud to other SAGA modules. This can be done in SAGA
>>> without having to save the point cloud.  Can the same be done from R?
>>>
>>> How can I get the point cloud imported into the R environment?  Do I need
>>> to coerce it into a matrix, data frame, or Spatial Points object?
>>>
>>>
>>> R code:
>>> ###############
>>> library(RSAGA)
>>> # Set RSAGA environment.
>>> env <- rsaga.env()
>>>
>>> # SET WORKING DIRECTORY FIRST!!
>>> dir <- getwd()
>>>
>>> # Get module parameters
>>> lasfilelist <- list.files(dir, pattern =".las$", full.names=TRUE,
>>> recursive=FALSE)
>>>
>>> # send command to RSAGA
>>> test <- rsaga.geoprocessor(lib = "io_shapes_las", module = "Import LAS
>>> Files",
>>>                    param = list(FILES = lasfilelist[1], POINTS = "test",
>>>                                 T=TRUE, i=TRUE, a=FALSE, r=TRUE, c=FALSE,
>>> u=FALSE,
>>>                                 n=TRUE, R=FALSE, G=FALSE, B=FALSE,
>>> e=FALSE,
>>> d=FALSE,
>>>                                 p=FALSE, C=FALSE, VALID=FALSE,
>>> RGB_RANGE=FALSE),
>>>                    env = env)
>>> ###################
>>> Here is the console output (the test variable stores the same thing):
>>> ###########
>>> library path: C:\OSGEO4~1\apps\saga\modules\io_shapes_las.dll
>>> library name: Import/Export - LAS
>>> tool name   : Import LAS Files
>>> author      : O. Conrad, V. Wichmann (c) 2009
>>>
>>> Parameters
>>>
>>> Input Files: "C:/Users/whcms0/'.CPT/Tarewa/Lidar/AX300711.las"
>>> Point Clouds: No objects
>>> gps-time: yes
>>> intensity: yes
>>> scan angle: no
>>> number of the return: yes
>>> classification: no
>>> user data: no
>>> number of returns of given pulse: yes
>>> red channel color: no
>>> green channel color: no
>>> blue channel color: no
>>> edge of flight line flag: no
>>> direction of scan flag: no
>>> point source ID: no
>>> rgb color: no
>>> Check Point Validity: no
>>> R,G,B value range: 16 bit
>>>
>>> Parsing AX300711.las ...
>>> Save point cloud: test...
>>>
>>> ################
>>> Here is my env:
>>> ################
>>> > env
>>> $workspace
>>> [1] "."
>>> $cmd
>>> [1] "saga_cmd.exe"
>>> $path
>>> [1] "C:\\OSGeo4W64\\apps\\saga"
>>> $modules
>>> [1] "C:\\OSGeo4W64\\apps\\saga/modules"
>>> $version
>>> [1] "2.1.2"
>>> $cores
>>> [1] NA
>>> $parallel
>>> [1] FALSE
>>> $lib.prefix
>>> [1] ""
>>> #################
>>>
>>>         [[alternative HTML version deleted]]
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>> --
>> Dr. Michael Sumner
>> Software and Database Engineer
>> Australian Antarctic Division
>> 203 Channel Highway
>> Kingston Tasmania 7050 Australia
>>
>>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list