gg_CreateBasemapLayers: Create basemap layers for maps based on the 'ggplot2' package

View source: R/gg_CreateBasemapLayers.R

gg_CreateBasemapLayersR Documentation

Create basemap layers for maps based on the ggplot2 package

Description

This function creates a basemap layer for maps based on the ggplot2 package.

Usage

gg_CreateBasemapLayers(
  layer.land = getPackagedLayer("Alaska"),
  layer.bathym = getPackagedLayer("ShelfBathymetry"),
  final.crs = get_crs("WGS84"),
  bbox = getStandardBBox("EBS"),
  colors.bg = "white",
  colors.land = "grey85",
  colors.bathym = "darkblue",
  alpha.bathym = 1
)

Arguments

layer.land
  • a sf::sf object representing land

layer.bathym
  • a sf::sf object representing bathymetry

final.crs
  • object representing the final (display) coordinate reference system (see details)

bbox
  • a bounding box (see details; default is for the EBS)

colors.bg
  • background color (default is "white")

colors.land
  • color for land (default is "grey85")

colors.bathym
  • color for the bathymetry (default is "darkblue")

alpha.bathym
  • transparency for the bathymetry (default is 1)

Details

The basemap contains a land layer (polygons) and a bathymetry layer (lines). Uses getPackagedLayer or wtsUtilities::readShapefile to create the land and bathymetric layers. If bbox is NULL, then the bounding box for the land layer is used as the bounding box for the basemap.

The final coordinate reference system (final.crs) can be any object that can be converted to a sf::crs object using get_crs.

The bounding box (bbox) can be any object that can be converted to a sf::bbox using getBBox.

layer.land and layer.bathym will first be transformed to the bounding box coordinates and cropped to the bounding box. All three will then be converted to the final.crs coordinate system.

If the bounding box is NULL, it will be created from the bounding box for layer.land (if not NULL) or layer.bathym (if layer.land is NULL.

If final.crs is NULL, it will be set to the CRS for the bounding box.

Value

  • basemap layer based on the ggplot2 package


wStockhausen/wtsGIS documentation built on Aug. 23, 2023, 2:31 a.m.