diff --git a/apple-touch-icon-120x120.png b/apple-touch-icon-120x120.png index fb48b05..3c945d8 100644 Binary files a/apple-touch-icon-120x120.png and b/apple-touch-icon-120x120.png differ diff --git a/apple-touch-icon-152x152.png b/apple-touch-icon-152x152.png index 01fff8b..9e681d7 100644 Binary files a/apple-touch-icon-152x152.png and b/apple-touch-icon-152x152.png differ diff --git a/apple-touch-icon-180x180.png b/apple-touch-icon-180x180.png index e0d5383..43b3ea1 100644 Binary files a/apple-touch-icon-180x180.png and b/apple-touch-icon-180x180.png differ diff --git a/apple-touch-icon-60x60.png b/apple-touch-icon-60x60.png index 472a8d7..0a8ff82 100644 Binary files a/apple-touch-icon-60x60.png and b/apple-touch-icon-60x60.png differ diff --git a/apple-touch-icon-76x76.png b/apple-touch-icon-76x76.png index 4a04da0..6c0b74e 100644 Binary files a/apple-touch-icon-76x76.png and b/apple-touch-icon-76x76.png differ diff --git a/apple-touch-icon.png b/apple-touch-icon.png index 98ab5e4..7a16339 100644 Binary files a/apple-touch-icon.png and b/apple-touch-icon.png differ diff --git a/articles/grade-penalty.html b/articles/grade-penalty.html index 98715a2..b6140f5 100644 --- a/articles/grade-penalty.html +++ b/articles/grade-penalty.html @@ -89,13 +89,23 @@ +
In this tutorial we explore the gradePenaltyFn
by
+attempting to build roads to randomly selected locations in a
+mountainous region of British Columbia, Canada. While the elevation and
+landcover data used is real, the roads and landings are not and
+projected roads are not expected to match observed roads. In most real
+applications, an established existing road network will constrain the
+locations of new access roads. gradePenaltyFn
uses a
+simplified version of the grade penalty approach taken by Anderson and
+Nelson (2004) to penalize roads that go up steep slopes and encourage
+roads to follow the contours of the landscape.
To use the grade penalty function we need to supply a raster to the
weightRaster
argument that contains elevation and has other
-barriers (eg water bodies) included in the raster as negative or NA
-values. In this example we will use an elevation and proportion water
-data set downloaded with the geodata
package and cropped to
-an example area in British Columbia, Canada that is included in the
-package.
NA
values. In this example we will use an elevation and
+proportion water data set downloaded with the geodata
+package and cropped to an example area in British Columbia, Canada that
+is included in the package.
library(roads)
library(terra)
@@ -133,15 +143,16 @@
gradePenaltyFn
requires a single raster as input but
allows factors other than grade that will affect road construction to be
included in the raster as negative values and barriers where no road
-construction is possible to be included as NA values. In this example we
-will assume that road construction is impossible for cells where the
-proportion of water is > 50%. Then we set areas with less than 1%
-water to NA so that the grade penalty will still apply in this case. We
-also need to get the penalty for water crossing on to a similar scale as
-the grade penalty in this case we will assume the same base cost of
-$16178 and the same penalty of $504 for every percentage point increase
-in percent water. Note this is just an example and there are certainly
-better data sources for the locations and costs of stream crossings.
+construction is possible to be included as NA
values. In
+this example we will assume that road construction is impossible for
+cells where the proportion of water is > 50%. Then we set areas with
+less than 1% water to NA so that the grade penalty will still apply in
+this case. We also need to get the penalty for water crossing on to a
+similar scale as the grade penalty in this case we will assume the same
+base cost of $16178 and the same penalty of $504 for every percentage
+point increase in percent water. Note this is just an example and there
+are certainly better data sources for the locations and costs of stream
+crossings.
# set water to NA when a cell is > 50% water
wat_use <- classify(dem_example$ex_wat, matrix(c(0.5, 1, NA), nrow = 1))
@@ -252,7 +263,9 @@
the default value of limit
in
gradePenaltyFn()
. To avoid this we can increase
limit
or change limitWeight
to something other
-than NA
. Here we set limit = 30
.
+than NA
. Below we try both setting limit = 30
+and limitWeight = 40000^2
. Which have slightly different
+results.
rd_proj <- projectRoads(lnds, wt_rast, rd_in, weightFunction = gradePenaltyFn,
roadsInWeight = FALSE, roadMethod = "ilcp", limit = 30)
@@ -327,6 +340,13 @@
col = c(terra::map.pal("blues", 6) %>% rev(), terra::map.pal("oranges", 10)),
colNA = "grey50", mar = c(2, 2, 2, 8.5))
+
+References
+
+Anderson AE, Nelson J (2004) Projecting vector-based road networks
+with a shortest path algorithm. Canadian Journal of Forest Research
+34:1444–1457. https://doi.org/10.1139/x04-030
+
diff --git a/favicon-16x16.png b/favicon-16x16.png
index ee1be2c..f02f3d7 100644
Binary files a/favicon-16x16.png and b/favicon-16x16.png differ
diff --git a/favicon-32x32.png b/favicon-32x32.png
index ae29b54..3a5aea7 100644
Binary files a/favicon-32x32.png and b/favicon-32x32.png differ
diff --git a/news/index.html b/news/index.html
index 21598a3..daf0b9d 100644
--- a/news/index.html
+++ b/news/index.html
@@ -58,10 +58,11 @@ roads 1.2.0Change default roadMethod
to "ilcp"
in projectRoads
Add ability to use a custom weightFunction
and add a weightFunction
gradePenaltyFn
that determines the grade between two cells
+Add a vignette and a demo data set dem_example
to show how gradePenaltyFn
can be used.
Change argument name from cost
to weightRaster
since it no longer represents a cost surface and can now be inputs to the weightFunction
. Also change roadsInCost
to roadsInWeight
.
returned roads are no longer unioned together.
Deprecate getDistFromSource
and use terra::distance
instead.
-Fix bug in getLandingsFromTarget and change so that patches are used for 0,1 rasters and ids are used otherwise using terra::as.polygons to make it faster.
+Fix bug in getLandingsFromTarget
and change so that patches are used for 0,1 rasters and ids are used otherwise using terra::as.polygons to make it faster.
CRAN release: 2023-06-24
diff --git a/pkgdown.yml b/pkgdown.yml index 0627012..f17f591 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -5,7 +5,7 @@ articles: grade-penalty: grade-penalty.html ReconstructRoadHistory: ReconstructRoadHistory.html roads-vignette: roads-vignette.html -last_built: 2024-06-26T14:13Z +last_built: 2024-06-26T15:29Z urls: reference: https://landscitech.github.io/roads/reference article: https://landscitech.github.io/roads/articles diff --git a/reference/projectRoads.html b/reference/projectRoads.html index 847034e..752a360 100644 --- a/reference/projectRoads.html +++ b/reference/projectRoads.html @@ -284,9 +284,9 @@