-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
this example
l <- sf::st_cast(silicate::inlandwaters, "MULTILINESTRING")
library(vaster)
## define a raster (xmin, xmax, ymin, ymax), (ncol, nrow)
v <- silicate::sc_coord(l)
ext <- unlist(lapply(v, range)) #+ c(-1, 1, -1, 1) * .1
dm <- c(10000, 40000)
#ext <- c(0, dm[1], 0, dm[2])/dm
## less than a second
system.time({
r <- controlledburn:::burn_line(l, extent = ext,dimension = dm)
})
pp <- function(listindex, dimension, extent = NULL) {
if (is.null(extent)) extent <- c(0, dimension[1], 0, dimension[2])
idx <- do.call(rbind, listindex) + 1
vaster::xy_from_cell(dimension, extent, vaster::cell_from_row_col(dimension, idx[,2], idx[,1]))
}
plot(pp(r, dm, ext), pch = ".")
# tr <- terra::rast(terra::ext(ext), ncols = dm[1], nrows = dm[2])
# vct <- terra::vect(l)
# tr <- terra::rasterize(vct, tr)
now committed.
- not correct yet, it's got a hack for the initial y discretization (I've had enough getting confused for the moment)
- _polygon and _edge versions of functions are now established
- there is burn_polygon and burn_line unexported functions
- currently we only allow sf lines for burn_line, but that could accept polygons trivially
- consider, move to a model of storing cell numbers not yline,xcol ?
Metadata
Metadata
Assignees
Labels
No labels
