Solved

RCaller write terrain models

  • 9 October 2018
  • 2 replies
  • 21 views

I need to do some interpolations to create nice terrain models for the architects at my office. The TINGenerator isn´t enough in this case. I tested a script in R that makes an idw interpolation. My input data is pointcloud lidar data and my output/end result in FME should be a vector surface to use in cad or sketchup. I am using the lidR library in R.

Should I make a raster output from RCaller first and then create a terrain model? Do I need more librarys in R? My R script is :

library(lidR)

las = readLAS("C:/R/win-library/3.5/lidR/extdata/Topography.laz") dtm1 = grid_terrain(las, method = "knnidw", k = 6, p = 2 )

plot3d(dtm1) The plot in the end wouldn´t be useful in this case

How should I apply the code in RCaller with pointcloud as input and vector terrain model as wanted output? Other transformers after the RCaller could be useful?

Tobias

icon

Best answer by samatsafe 15 October 2018, 22:29

View original

2 replies

Badge +3

there are better terrain modellers/generators out there.

I have fond memories of sourceforge free and all. Don't know if it still exists though.

Badge

Hi Tobias,

I've attached a workspace template that creates a surface from the RCaller script. I set it up to read a static path to the file like your example script; you will need to go into the RCaller and change it for it to work. You could also probably set that up to read the source dataset user parameter, but you have to be careful because R requires Unix paths.

I also added a few of our existing transformers that can use to generate surfaces from point clouds. You could try using those if you don't want the workspace to require R. You can check out this tutorial for some advice on how to use them, or search the forum Q&A; for point cloud surface discussions.

Here is the code in my RCaller:

# Load lidR library; must be installed on local machinelibrary(lidR)# Generate terrain# Replace with correct path:las = readLAS("path/to/21884-topography.laz")dtm1 = grid_terrain(las, method = "knnidw", k = 6, p = 2 )topo.png <- plot3d(dtm1)# Output terrain rows with as X, Y, and Z attributes (note they had to be entered in under Attributes to Expose below)fmeOutput<-data.frame(dtm1)

Hopefully that helps.

r-surface.fmwt

Reply