R/tmap_CreateBasemap.R

Defines functions tmap_CreateBasemap

Documented in tmap_CreateBasemap

#'
#'@title Create a \pkg{tmap}-style basemap
#'
#' @description Function to create a \pkg{tmap}-style basemap.
#'
#' @param bbox - sf-style bounding box for map (default is for CGOA)
#' @param colors.background - background color
#' @param colors.land - color for land
#' @param colors.bathym - color for bathymetry
#' @param aes.palette - list with color palettes (or vectors) for cat, div, and seq "by" variables
#'
#' @return \pkg{tmap}-style basemap
#'
#' @details Requires packages \pkg{wtsGIS}, \pkg{tmap}, and possibly \pkg{tmaptools}.
#' See \code{wtsGIS::getStandardBoundingBox} for alternative, predefined bounding boxes.
#'
#' @import tmap
#' @import tmaptools
#' @import wtsGIS
#'
#' @export
#'
tmap_CreateBasemap<-function(bbox=tmaptools::bb(xlim=c(-162,-134),ylim=c(54,62)),
                            colors.background="grey85",
                            colors.land="grey45",
                            colors.bathym="grey65",
                            aes.palette=list(cat=c("blue","red"),
                                             div=c("blue","red"),
                                             seq=c("blue","red"))){

    basemap <- wtsGIS::tmap_CreateBasemap(bbox=bbox,
                                          colors.bg=colors.background,
                                          colors.land=colors.land,
                                          colors.bathym=colors.bathym) +
                  tmap::tm_layout(aes.palette=aes.palette);
    return(basemap);
}

# basemap<-createBasemap();
# print(basemap);
wStockhausen/wtsROMS documentation built on Feb. 2, 2025, 9:16 p.m.