Skip to main content
updated answer based on JRR's answer (author of lidR package); linked related answer for more software options about clipping LiDAR files with vector data
Source Link
Andre Silva
  • 10.3k
  • 12
  • 55
  • 109

Edit: The package is evolving. As stated in JRR's answer which is one of lidR's authors, newer versions (> 1.5) will support clipping with SpatialPolygonDataFrame. It is also planned to support clipping with multipart polygons.


The package ‘lidR’ (version 1.4.2*) pdf says on lasclip:

Usage:
lasclip(x, geometry, ofile = "")

Arguments
geometry: a geometric object. Currently* Polygon from sp is supported.

*apr/2018

Therefore, one needs to clip the .las/.laz data with an object of class Polygon and not SpatialPolygonsDataFrame.

This is a reproducible example which works:

library(lidR)
file.path <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar <- readLAS(file.path)

library(rgdal)
site_spdf <- readOGR(dsn = "...lidR\\extdata", layer = "lake_polygons_UTM17")
site_p <- site_spdf@polygons[[1]]@Polygons[[1]] #sp object of class Polygon

clipped_las = lasclip(lidar, site_p)

Other software options for clipping LiDAR files with vector data are available in Clipping LAS data using shapefile polygons and open source software?

The package ‘lidR’ pdf says on lasclip:

Usage:
lasclip(x, geometry, ofile = "")

Arguments
geometry: a geometric object. Currently* Polygon from sp is supported.

*apr/2018

Therefore, one needs to clip the .las/.laz data with an object of class Polygon and not SpatialPolygonsDataFrame.

This is a reproducible example which works:

library(lidR)
file.path <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar <- readLAS(file.path)

library(rgdal)
site_spdf <- readOGR(dsn = "...lidR\\extdata", layer = "lake_polygons_UTM17")
site_p <- site_spdf@polygons[[1]]@Polygons[[1]] #sp object of class Polygon

clipped_las = lasclip(lidar, site_p)

Edit: The package is evolving. As stated in JRR's answer which is one of lidR's authors, newer versions (> 1.5) will support clipping with SpatialPolygonDataFrame. It is also planned to support clipping with multipart polygons.


The package ‘lidR’ (version 1.4.2*) pdf says on lasclip:

Usage:
lasclip(x, geometry, ofile = "")

Arguments
geometry: a geometric object. Currently* Polygon from sp is supported.

*apr/2018

Therefore, one needs to clip the .las/.laz data with an object of class Polygon and not SpatialPolygonsDataFrame.

This is a reproducible example which works:

library(lidR)
file.path <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar <- readLAS(file.path)

library(rgdal)
site_spdf <- readOGR(dsn = "...lidR\\extdata", layer = "lake_polygons_UTM17")
site_p <- site_spdf@polygons[[1]]@Polygons[[1]] #sp object of class Polygon

clipped_las = lasclip(lidar, site_p)

Other software options for clipping LiDAR files with vector data are available in Clipping LAS data using shapefile polygons and open source software?

added 25 characters in body
Source Link
Andre Silva
  • 10.3k
  • 12
  • 55
  • 109

The package ‘lidR’ pdf says on lasclip:

Usage:
lasclip(x, geometry, ofile = "")

Arguments
geometry: a geometric object. CurrentlyCurrently* Polygon from sp is supported.

*apr/2018

Therefore, one needs to clip the .las/.laz data with an object of class Polygon and not SpatialPolygonsDataFrame.

This is a reproducible example which works:

library(lidR)
file.path <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar <- readLAS(file.path)

library(rgdal)
site_spdf <- readOGR(dsn = "...lidR\\extdata", layer = "lake_polygons_UTM17")
site_p <- site_spdf@polygons[[1]]@Polygons[[1]] #sp object of class Polygon

clipped_las = lasclip(lidar, site_p)

The package ‘lidR’ pdf says on lasclip:

Usage:
lasclip(x, geometry, ofile = "")

Arguments
geometry: a geometric object. Currently Polygon from sp is supported.

Therefore, one needs to clip the .las/.laz data with an object of class Polygon and not SpatialPolygonsDataFrame.

This is a reproducible example which works:

library(lidR)
file.path <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar <- readLAS(file.path)

library(rgdal)
site_spdf <- readOGR(dsn = "...lidR\\extdata", layer = "lake_polygons_UTM17")
site_p <- site_spdf@polygons[[1]]@Polygons[[1]] #sp object of class Polygon

clipped_las = lasclip(lidar, site_p)

The package ‘lidR’ pdf says on lasclip:

Usage:
lasclip(x, geometry, ofile = "")

Arguments
geometry: a geometric object. Currently* Polygon from sp is supported.

*apr/2018

Therefore, one needs to clip the .las/.laz data with an object of class Polygon and not SpatialPolygonsDataFrame.

This is a reproducible example which works:

library(lidR)
file.path <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar <- readLAS(file.path)

library(rgdal)
site_spdf <- readOGR(dsn = "...lidR\\extdata", layer = "lake_polygons_UTM17")
site_p <- site_spdf@polygons[[1]]@Polygons[[1]] #sp object of class Polygon

clipped_las = lasclip(lidar, site_p)
Source Link
Andre Silva
  • 10.3k
  • 12
  • 55
  • 109

The package ‘lidR’ pdf says on lasclip:

Usage:
lasclip(x, geometry, ofile = "")

Arguments
geometry: a geometric object. Currently Polygon from sp is supported.

Therefore, one needs to clip the .las/.laz data with an object of class Polygon and not SpatialPolygonsDataFrame.

This is a reproducible example which works:

library(lidR)
file.path <- system.file("extdata", "Megaplot.laz", package="lidR")
lidar <- readLAS(file.path)

library(rgdal)
site_spdf <- readOGR(dsn = "...lidR\\extdata", layer = "lake_polygons_UTM17")
site_p <- site_spdf@polygons[[1]]@Polygons[[1]] #sp object of class Polygon

clipped_las = lasclip(lidar, site_p)