Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

generate_point_overlay

Generate Point Overlay


Description

Calculates and returns an overlay of points for the current map.

Usage

generate_point_overlay(
  geometry,
  extent,
  heightmap = NULL,
  width = NA,
  height = NA,
  pch = 20,
  color = "black",
  size = 1,
  offset = c(0, 0),
  data_column_width = NULL
)

Arguments

geometry

An 'sf' object with POINT geometry.

extent

A 'raster::Extent' object with the bounding box for the height map used to generate the original map.

heightmap

Default 'NULL'. The original height map. Pass this in to extract the dimensions of the resulting overlay automatically.

width

Default 'NA'. Width of the resulting overlay. Default the same dimensions as height map.

height

Default 'NA'. Width of the resulting overlay. Default the same dimensions as height map.

pch

Default '20', solid. Point symbol. '0' = square, '1' = circle, '2' = triangle point up, '3' = plus, '4' = cross, '5' = diamond, '6' = triangle point down, '7' = square cross, '8' = star, '9' = diamond plus, '10' = circle plus, '11' = triangles up and down, '12' = square plus, '13' = circle cross, '14' = square and triangle down, '15' = filled square, '16' = filled circle, '17' = filled triangle point-up, '18' = filled diamond, '19' = solid circle, '20' = bullet (smaller circle), '21' = filled circle blue, '22' = filled square blue, '23' = filled diamond blue, '24' = filled triangle point-up blue, '25' = filled triangle point down blue

color

Default 'black'. Color of the points.

size

Default '1'. Point size.

offset

Default 'c(0,0)'. Horizontal and vertical offset to apply to the polygon, in units of 'geometry'.

data_column_width

Default 'NULL'. The numeric column to map the width to. The maximum width will be the value specified in 'linewidth'.

Value

Semi-transparent overlay with contours.

Examples

#Add the included `sf` object with roads to the montereybay dataset

if(all(c("sf","magick") %in% rownames(utils::installed.packages()))) {
 monterey_city = sf::st_sfc(sf::st_point(c(-121.893611, 36.603056)))
 montereybay %>% 
   height_shade() %>%
   add_overlay(generate_point_overlay(monterey_city, color="red", size=12, 
                                   attr(montereybay,"extent"), heightmap = montereybay))  %>%
   add_shadow(ray_shade(montereybay,zscale=50),0.3) %>%
   plot_map()
 
}

rayshader

Create Maps and Visualize Data in 2D and 3D

v0.24.10
GPL-3
Authors
Tyler Morgan-Wall
Initial release
2021-04-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.