Skip to main content
10 events
when toggle format what by license comment
May 4, 2018 at 16:52 history edited Andre Silva CC BY-SA 4.0
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
Apr 24, 2018 at 13:30 vote accept Hans Jürgen
Apr 23, 2018 at 18:22 comment added Jeffrey Evans Sorry, in looking at the source for lasclip it is forcing an object class of "Polygon". This is just lazy coding as what is really being called, and passed to lasclipPolygon, is just the coordinates of the polygon. As long as it represents a single object geometry, this could be done with any polygon object class. You can pass the object using lasclip(lidar, Polygon(coordinates(site_spdf[1,]) The reason I do not care for calling the polygons slot directly is that, because the list object will be nested, it will fail if using a multipart sp object.
Apr 23, 2018 at 18:08 comment added Andre Silva @JeffreyEvans, like lasclip(lidar, as(site_spdf, "Polygons"))? I got the following message "Error in as(site_spdf, "Polygons") : no method or default for coercing “SpatialPolygonsDataFrame” to “Polygons”" Or something else?
Apr 23, 2018 at 17:54 comment added Jeffrey Evans @HansJürgen, calling the slot object is not necessary, you can coerce on the fly. As pointed out in a comment to your original post you can simple use: as(site_spdf, "Polygons") as the object you pass to the function.
Apr 23, 2018 at 17:41 comment added Hans Jürgen I will accept it as soon as I tried it out, which I cannot do at the moment because the data is not on my private computer. Tomorrow morning I will see if it really solved my problem.
Apr 23, 2018 at 17:39 comment added Andre Silva @HansJürgen, no problem. You are welcome.
Apr 23, 2018 at 17:17 comment added Hans Jürgen Thanks for the answer. I also read the documentation but I could not get the Polygon. site_spdf@polygons[[1]]@Polygons[[1]] is exactly what I was looking for.
Apr 23, 2018 at 17:09 history edited Andre Silva CC BY-SA 3.0
added 25 characters in body
Apr 23, 2018 at 17:04 history answered Andre Silva CC BY-SA 3.0