diff --git a/R/projectRoads.R b/R/projectRoads.R index 9b5fee8..19097c8 100644 --- a/R/projectRoads.R +++ b/R/projectRoads.R @@ -34,15 +34,15 @@ #' * "snap": Connects each landing to the closest (by Euclidean distance) road without, #' reference to the weights or other landings. #' -<<<<<<< HEAD #' @param landings sf polygons or points, RasterLayer, SpatialPolygons*, #' SpatialPoints*, or matrix, containing features to be connected #' to the road network. Matrix should contain columns x, y with coordinates, -#' all other columns will be ignored. +#' all other columns will be ignored. Polygon and raster inputs will be +#' processed by `getLandingsFromTarget` to get the centroid of harvest blocks. #' @param weightRaster SpatRaster or RasterLayer. A `weightRaster` and `weightFunction` #' together determine the cost to build a road between two adjacent raster cells. #' For the default `weightFunction = simpleCostFn`, the `weightRaster` should specify the cost of -#' construction across each raster cell. The value of existing roads should be set to 0; if not +#' construction across each raster cell. The value of cells that contain existing roads should be set to 0; if not #' set `roadsInWeight = FALSE` to adjust the cost of existing roads. To use the alternative grade penalty method, #' set `weightFunction = gradePenaltyFn`, and provide a `weightRaster` in which: #' * NA indicates a road cannot be built @@ -54,18 +54,6 @@ #' interpreted as 100% grade). #' @param roads sf lines, SpatialLines*, RasterLayer, SpatRaster. The existing road network. #' @param roadMethod Character. Options are "ilcp", "mst", "lcp", and "snap". -======= -#' @param landings sf polygons or points, SpatRaster, RasterLayer, SpatialPolygons*, -#' SpatialPoints*, matrix, containing features to be connected -#' to the road network. Matrix should contain columns x, y with coordinates, -#' all other columns will be ignored. Polygon and raster inputs will be -#' processed by `getLandingsFromTarget` to get the centroid of harvest blocks. -#' @param weightRaster SpatRaster or RasterLayer. weights Raster where existing -#' roads must be the only cells with a weight of 0. If existing roads do not -#' have 0 weight set `roadsInWeight = FALSE` and they will be burned in. -#' @param roads sf lines, SpatialLines*, RasterLayer, SpatRaster. Existing road network. -#' @param roadMethod Character. Options are "ilcp", "mst", "lcp", "snap". ->>>>>>> b96540ec721aa63598cf23506b7ccfc903e0b443 #' @param plotRoads Boolean. Should the resulting road network be plotted. #' Default FALSE. #' @param mainTitle Character. A title for the plot @@ -224,18 +212,18 @@ setMethod( roadMethod = roadMethod, landings = landings, roadsInWeight = roadsInWeight) - + # Check memeory requirements rast_cells <- terra::ncell(weightRaster) ram_needed_Mb <- 10^(-1.6+0.769*log10(rast_cells)) ram_avail_Mb <- terra::free_RAM()/1000 - + if(ram_needed_Mb > ram_avail_Mb){ - warning("This road projection is expected to require ", ram_needed_Mb, + warning("This road projection is expected to require ", ram_needed_Mb, " Mb of RAM but only ", ram_avail_Mb, "Mb is available. ", "Consider closing other applications and/or running on a larger machine") } - + # browser() sim$landingsIn <- sim$landings diff --git a/man/getLandingsFromTarget.Rd b/man/getLandingsFromTarget.Rd index 0024562..47812a0 100644 --- a/man/getLandingsFromTarget.Rd +++ b/man/getLandingsFromTarget.Rd @@ -7,18 +7,11 @@ getLandingsFromTarget(harvest, landingDens = NULL, sampleType = "centroid") } \arguments{ -<<<<<<< HEAD -\item{harvest}{sf, SpatialPolygons or RasterLayer object with harvested -areas. If it is a RasterLayer with more than one unique value other than 0 -each value will be run separately which will produce different results from -a 0/1 raster and will be much slower.} -======= \item{harvest}{sf, SpatialPolygons, SpatRaster or RasterLayer object with harvested areas. If it is a raster with values outside 0,1, values are assumed to be harvest block IDs. If raster values are in 0,1 they are assumed to be a binary raster and \code{terra::patches} is used to identify harvest blocks.} ->>>>>>> b96540ec721aa63598cf23506b7ccfc903e0b443 \item{landingDens}{number of landings per unit area. This should be in the same units as the CRS of the harvest. Note that 0.001 points per m2 is > 1000 diff --git a/man/projectRoads.Rd b/man/projectRoads.Rd index 5ce663e..10543a8 100644 --- a/man/projectRoads.Rd +++ b/man/projectRoads.Rd @@ -58,13 +58,8 @@ projectRoads( ) } \arguments{ -<<<<<<< HEAD \item{landings}{sf polygons or points, RasterLayer, SpatialPolygons*, SpatialPoints*, or matrix, containing features to be connected -======= -\item{landings}{sf polygons or points, SpatRaster, RasterLayer, SpatialPolygons*, -SpatialPoints*, matrix, containing features to be connected ->>>>>>> b96540ec721aa63598cf23506b7ccfc903e0b443 to the road network. Matrix should contain columns x, y with coordinates, all other columns will be ignored. Polygon and raster inputs will be processed by \code{getLandingsFromTarget} to get the centroid of harvest blocks.} @@ -72,7 +67,7 @@ processed by \code{getLandingsFromTarget} to get the centroid of harvest blocks. \item{weightRaster}{SpatRaster or RasterLayer. A \code{weightRaster} and \code{weightFunction} together determine the cost to build a road between two adjacent raster cells. For the default \code{weightFunction = simpleCostFn}, the \code{weightRaster} should specify the cost of -construction across each raster cell. The value of existing roads should be set to 0; if not +construction across each raster cell. The value of cells that contain existing roads should be set to 0; if not set \code{roadsInWeight = FALSE} to adjust the cost of existing roads. To use the alternative grade penalty method, set \code{weightFunction = gradePenaltyFn}, and provide a \code{weightRaster} in which: \itemize{