Is the "Modify the LAScatalog drivers" page still valid with locate_trees #616
-
Hello, As I'm having problems exporting to shapefiles due to the bitmerge value overflow, I'm trying to export So I've rewritten the functions : # Create a function that writes a sf into
# a SQLite database.
dbWrite_sf = function(x, path, name)
{
x <- as.data.frame(x)
con <- RSQLite::dbConnect(RSQLite::SQLite(), path)
RSQLite::dbWriteTable(con, name, x, append = TRUE)
RSQLite::dbDisconnect(con)
}
# Change the driver used to write sf objects
# User-defined drivers have the precedence
ctg_filter@output_options$drivers$sf = list(
write = dbWrite_sf,
extension = ".sqlite",
object = "x",
path = "path",
param = list(name = "trees"))
opt_output_files(ctg_filter) <- paste0("tops/", "trees") But I'm not sure about the Is it the correct way to handle this ? Thank you... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The wiki page is outdated but the general idea did not change. For
|
Beta Was this translation helpful? Give feedback.
The wiki page is outdated but the general idea did not change. For
sf
st_write
already provide the internals to write in databases. I don't think you need to use bare bonesRSQLite
functions.as.data.frame
onSpatial*DataFrame
returns the coordinates + the attributes. This is not the case forsf
where it returns adata.frame
with asfc
column that won't be writable.