elevation_transparency: Turns overlay images transparent based on altitude. Can be...

Description Usage Arguments Value Examples

View source: R/elevation_transparency.R

Description

Turns overlay images transparent based on altitude. Can be used to create an image overlay that will only apply to valleys, or only to hills.

Usage

1
2
3
4
5
6
7
8
elevation_transparency(
  overlay_image,
  raster_dem,
  alpha_max = 0.4,
  alpha_min = 0,
  pct_alt_low = 0.05,
  pct_alt_high = 0.25
)

Arguments

overlay_image

the image on which to alter transparency

raster_dem

elevation model raster file that will be used to adjust transparency

alpha_max

Transparency required at higher altitudes

alpha_min

Transparency required at lower altitudes

pct_alt_low

The percent of maximum altitude contained in raster_dem at which alpha_max will apply

pct_alt_high

The percent of maximum altitude contained in raster_dem at which alpha_min will apply

Value

An image with transparency defined by altitude

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# elevation_transparency defaults to making hills transparent.  Flip alpha_max
# and alpha_min values to reverse it.
#
# Transparency in the range between pct_alt_low and pct_alt_high will
# smoothly transition between alpha_max and alpha_min.

 overlay_image <- elevation_shade(example_raster(), elevation_palette = c("#000000", "#FF0000"))

 #Making hills transparent

 ggmap_overlay_transparent_hills <- elevation_transparency(overlay_image,
   example_raster(), alpha_max = 0.8, alpha_min = 0, pct_alt_low = 0.05,
   pct_alt_high = 0.25)

 # To make valleys transparent, flip alpha_max and alpha_min
 ggmap_overlay_transparent_valleys <- elevation_transparency(overlay_image,
   example_raster(), alpha_max = 0, alpha_min = 0.8, pct_alt_low = 0.05,
   pct_alt_high = 0.25)

neilcharles/geoviz documentation built on May 6, 2020, 9:06 p.m.