r-lidar / lidR

Airborne LiDAR data manipulation and visualisation for forestry application
https://CRAN.R-project.org/package=lidR
GNU General Public License v3.0
601 stars 131 forks source link

terra interface #667

Closed rhijmans closed 1 year ago

rhijmans commented 1 year ago

lidR::raster_bbox uses

bbox <- terra::ext(raster)
bbox <- bbox@ptr$vector
names(bbox) <- c("xmin", "xmax", "ymin", "ymax")

That breaks with the development version of terra. The @ptr$ methods are not really safe for use in other packages. Can you use the "official" interface instead? In this case

bbox <- terra::ext(raster)
bbox <- terra::as.vector(bbox)

Thanks!

Jean-Romain commented 1 year ago

sf::st_bbox() with latest version of sf seems to works properly on SpatRaster so I'm now using st_bbox(). Thanks.