Skip to content

Commit

Permalink
updated manual, corrected errors in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
16EAGLE committed Nov 4, 2024
1 parent 7861831 commit e4f990a
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 37 deletions.
30 changes: 16 additions & 14 deletions R/basemap.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,47 +39,49 @@
#'
#' # set defaults for the basemap
#' set_defaults(map_service = "osm", map_type = "terrain_bg")
#' # for "osm_stamen", "osm_stadia", osm "thunderforest", "maptiler" and "mapbox" maps, you need a API token.
#' # Register for free at stadiamaps.com, thunderforest.com, maptiler.com and mapbox.com to get tokens.
#' # for "osm_stamen", "osm_stadia", osm "thunderforest", "maptiler" and "mapbox" maps,
#' # you need a API token. Register for free at stadiamaps.com, thunderforest.com,
#' # maptiler.com and mapbox.com to get tokens.
#'
#' \dontrun{
#' # load and return basemap map as raster (default)
#' # load and plot basemap (default)
#' map <- basemap(ext)
#'
#' # or explicitely as different classes such as:
#' basemap_magick(ext)
#' basemap_raster()
#' basemap_stars()
#' basemap_raster(ext)
#' basemap_stars(ext)
#'
#' # or as files:
#' basemap_geotif()
#' basemap_png()
#' basemap_geotif(ext)
#' basemap_png(ext)
#'
#' # or as plots:
#' basemap_plot(ext)
#' basemap_mapview()
#' basemap_mapview(ext)
#'
#' # including ggplot2:
#' basemap_ggplot(ext)
#'
#' # or as ggplot2 layer:
#' library(ggplot2)
#' ggplot() +
#' basemap_gglayer(ext) +
#' scale_fill_identity() +
#' ggplot() +
#' basemap_gglayer(ext) +
#' scale_fill_identity() +
#' coord_sf()
#'
#' # or, when combined with an sf vector object,
#' # make sure to use Web/Pseudo Mercator (EPSG 3857), as this is
#' # the CRS in which all basemaps are returned (see "Value"):
#' library(sf)
#' ext <- st_transform(ext, crs = st_crs(3857))
#' ggplot() +
#' basemap_gglayer(ext) +
#' ggplot() +
#' basemap_gglayer(ext) +
#' geom_sf(data = ext, color = "red", fill = "transparent") +
#' coord_sf() +
#' scale_fill_identity()
#' }
#' }
#'
#' @importFrom sf st_bbox
#' @importFrom terra rast plotRGB plot as.array nlyr
#' @importFrom graphics plot
Expand Down
9 changes: 6 additions & 3 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
#' data(ext)
#'
#' \dontrun{
#' # raster object: Brick
#' map <- basemap_raster(ext)
#' # terra raster object
#' map <- basemap_terra(ext)
#'
#' # plotting RasterBrick
#' # plotting raster as ggplot using the with fill aesthetic
#' gg_raster(map, r_type = "RGB")
#'
#' # or as gg layer using the with fill aesthetic
#' ggplot() + gg_raster(map, r_type = "RGB", gglayer = T) + scale_fill_identity()
#' }
#'
#' @importFrom terra rast ncell aggregate aggregate
Expand Down
32 changes: 17 additions & 15 deletions man/basemap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/defaults.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/get_maptypes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions man/plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e4f990a

Please sign in to comment.