|
80 | 80 | #' m <- m[nrow(m):1, ncol(m):1] |
81 | 81 | #' x <- seq(from = 2667405, length.out = ncol(m), by = 10) |
82 | 82 | #' y <- seq(from = 6478705, length.out = nrow(m), by = 10) |
83 | | -#' r1 <- raster::raster(m, xmn = min(x), xmx = max(x), ymn = min(y), ymx = max(y), |
84 | | -#' crs = "+init=epsg:27200") |
| 83 | +#' r1 <- raster::raster(m, xmn = min(x), xmx = max(x), ymn = min(y), |
| 84 | +#' ymx = max(y), crs = "+init=epsg:27200") |
85 | 85 | #' r2 <- min(r1[]) - r1 / 10 |
86 | 86 | #' r3 <- r1 - r2 |
87 | 87 | #' rs <- raster::stack(r1, r2, r3) |
88 | 88 | #' names(rs) <- c("r1", "r2", "r3") |
89 | | -#' xy <- rbind(c(2667508, 6479501), c(2667803, 6479214), c(2667508, 6478749)) |
90 | | -#' transect <- sp::SpatialLines(list(sp::Lines(list(sp::Line(xy)), ID = "Transect")), |
| 89 | +#' xy <- rbind(c(2667508, 6479501), |
| 90 | +#' c(2667803, 6479214), |
| 91 | +#' c(2667508, 6478749)) |
| 92 | +#' transect <- sp::Lines(list(sp::Line(xy)), ID = "Transect") |
| 93 | +#' transect <- sp::SpatialLines(list(transect), |
91 | 94 | #' proj4string = raster::crs(rs)) |
92 | | -#' xy <- rbind(c(2667705, 6478897), c(2667430, 6479178)) |
| 95 | +#' xy <- rbind(c(2667705, 6478897), |
| 96 | +#' c(2667430, 6479178)) |
93 | 97 | #' p <- sp::SpatialPoints(xy, proj4string = raster::crs(rs)) |
94 | 98 | #' d <- data.frame("label" = c("Peak", "Random")) |
95 | 99 | #' features <- sp::SpatialPointsDataFrame(p, d, match.ID = TRUE) |
|
98 | 102 | #' PlotMap(r1, bg.image = bg.image, |
99 | 103 | #' pal = GetColors(scheme = "DEM screen", alpha = 0.8), |
100 | 104 | #' scale.loc = "top", arrow.loc = "topright", |
101 | | -#' contour.lines = list("col" = "#1F1F1FA6"), "useRaster" = TRUE) |
| 105 | +#' contour.lines = list("col" = "#1F1F1FA6"), |
| 106 | +#' useRaster = TRUE) |
102 | 107 | #' lines(transect) |
103 | | -#' raster::text(as(transect, "SpatialPoints"), labels = c("A", "BEND", "A'"), |
104 | | -#' halo = TRUE, cex = 0.7, pos = c(3, 4, 1), offset = 0.1, font = 4) |
| 108 | +#' raster::text(as(transect, "SpatialPoints"), |
| 109 | +#' labels = c("A", "BEND", "A'"), |
| 110 | +#' halo = TRUE, cex = 0.7, pos = c(3, 4, 1), |
| 111 | +#' offset = 0.1, font = 4) |
105 | 112 | #' points(features, pch = 19) |
106 | 113 | #' raster::text(features, labels = features@data$label, halo = TRUE, |
107 | 114 | #' cex = 0.7, pos = 4, offset = 0.5, font = 4) |
|
110 | 117 | #' asp <- 5 |
111 | 118 | #' unit <- "METERS" |
112 | 119 | #' explanation <- "Vertical thickness between layers, in meters." |
113 | | -#' PlotCrossSection(transect, rs, geo.lays = c("r1", "r2"), val.lays = "r3", |
114 | | -#' ylab = "Elevation", asp = asp, unit = unit, |
115 | | -#' explanation = explanation, features = features, |
116 | | -#' max.feature.dist = 100, bg.col = "#E1E1E1", |
117 | | -#' bend.label = "BEND IN\nSECTION", scale.loc = NULL) |
| 120 | +#' PlotCrossSection(transect, rs, geo.lays = c("r1", "r2"), |
| 121 | +#' val.lays = "r3", ylab = "Elevation", asp = asp, |
| 122 | +#' unit = unit, explanation = explanation, |
| 123 | +#' features = features, max.feature.dist = 100, |
| 124 | +#' bg.col = "#E1E1E1", bend.label = "BEND IN\nSECTION", |
| 125 | +#' scale.loc = NULL) |
118 | 126 | #' AddScaleBar(unit = unit, vert.exag = asp, inset = 0.05) |
119 | 127 | #' |
120 | | -#' val <- PlotCrossSection(transect, rs, geo.lays = c("r1", "r2"), val.lays = "r3", |
121 | | -#' ylab = "Elevation", asp = 5, unit = "METERS", |
122 | | -#' explanation = explanation, file = "Rplots.png") |
| 128 | +#' val <- PlotCrossSection(transect, rs, geo.lays = c("r1", "r2"), |
| 129 | +#' val.lays = "r3", ylab = "Elevation", asp = 5, |
| 130 | +#' unit = "METERS", explanation = explanation, |
| 131 | +#' file = "Rplots.png") |
123 | 132 | #' print(val) |
124 | 133 | #' |
125 | 134 | #' graphics.off() |
|
0 commit comments