create_colored_bm: Create colored base map

View source: R/create_colored_bm.R

create_colored_bmR Documentation

Create colored base map

Description

Use open street map data to create a basemap with the extent of the data

Usage

create_colored_bm(
  DT,
  lat = "lat",
  lon = "lon",
  buffer = 1000,
  aspect = "16:9",
  sc_dist,
  sc_location = "br",
  sc_cex = 0.7,
  sc_height = unit(0.25, "cm"),
  sc_pad_x = unit(0.25, "cm"),
  sc_pad_y = unit(0.5, "cm"),
  projection = paste0("+proj=laea +lat_0=90 +lon_0=-156.653428 +x_0=0 +y_0=0",
    " +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 ")
)

Arguments

DT

Name of the data.table

lat

Name of the column with latitude (as.character)

lon

Name of the column with longitude (as.character)

buffer

Buffer around the data

aspect

Set aspect ratio of the base map

sc_dist

Distance of the scale

sc_location

Where to put the scale bar ("tl" for top left, etc.)

sc_cex

Label size as numeric character expansion factor

sc_height

Thickness of the scale bar

sc_pad_x

Distance from edge of the scale bar (annotation_scale

sc_pad_y

Distance from edge of the scale bar (annotation_scale

projection

Projection of the data (default is equal area with centre Barrow)

Value

bm, a ggplot2 base map

Examples

# create table with two points
DT = data.table(name = c('NARL', 'Utqiagvik'),
                lat  = c(71.320854, 71.290246),
                lon  = c(-156.648210, -156.788622))

# change projection
st_transform_DT(DT)

# create base map
bm = create_colored_bm(DT)
bm

krietsch/auksRuak documentation built on Feb. 15, 2023, 2:44 p.m.