Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Imports:
leafpop,
png,
raster (>= 3.6.3),
rlang,
satellite,
scales (>= 0.2.5),
servr,
Expand Down
3 changes: 1 addition & 2 deletions R/color.R
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,7 @@ mapViewPalette <- function(name) {
# setClassPalette <- function(simple.class) {
#
# pkgs <- c("viridis")
# avl <- sapply(pkgs, "requireNamespace",
# quietly = TRUE, USE.NAMES = FALSE)
# avl <- rlang::check_installed(pkgs)
#
# if (simple.class == "rst") {
#
Expand Down
4 changes: 2 additions & 2 deletions R/mapshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ mapshot = function(x,
"easyButton"),
...) {

stopifnot(requireNamespace("webshot", quietly = TRUE))
rlang::check_installed("webshot")

## if both 'url' and 'file' are missing, throw an error
avl_url = !is.null(url)
Expand Down Expand Up @@ -219,7 +219,7 @@ mapshot2 = function(x,
"control"),
...) {

stopifnot(requireNamespace("webshot2", quietly = TRUE))
rlang::check_installed("webshot2")

## if both 'url' and 'file' are missing, throw an error
avl_url = !is.null(url)
Expand Down
9 changes: 1 addition & 8 deletions R/ops.R
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,7 @@ setMethod("|",
function (e1, e2) {

if (mapviewGetOption("platform") %in% c("leaflet")) {

if (!requireNamespace("leaflet.extras2")) {
stop(
"\nPackage 'leaflet.extras2' is needed for the '|' operator to work.\n"
, "Install with install.packages('leaflet.extras2')"
, call. = FALSE
)
}
rlang::check_installed("leaflet.extras2")

e1_tile_idx = getCallEntryFromMap(e1@map, "addProviderTiles")
if (length(e1_tile_idx) > 1) {
Expand Down
2 changes: 1 addition & 1 deletion R/print.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ get_ide = function() {
}

is_rstudio = function() {
if (requireNamespace("rstudioapi", quietly = TRUE)) {
if (rlang::check_installed("rstudioapi")) {
rstudioapi::isAvailable() && rstudioapi::versionInfo()$mode != "vscode"
} else {
FALSE
Expand Down
22 changes: 5 additions & 17 deletions R/raster.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,10 @@ leafletRL = function(x,
if (is.null(layer.name)) layer.name = makeLayerName(x, zcol = NULL)

pkgs = c("leaflet", "raster", "magrittr")
tst = sapply(pkgs, "requireNamespace",
quietly = TRUE, USE.NAMES = FALSE)
rlang::check_installed(pkgs)

if (native.crs) {

if (!requireNamespace("plainview", quietly = TRUE)) {
stop(
paste("\nviewing rasters with native CRS requires package 'plainview'.\n",
"To install use install.packages('plainview')"),
call. = FALSE
)
}

rlang::check_installed("plainview")
plainview::plainView(x,
maxpixels = mapviewGetOption("plainview.maxpixels"),
col.regions = col.regions,
Expand Down Expand Up @@ -205,8 +196,7 @@ leafletRSB = function(x,
...) {

pkgs = c("leaflet", "raster", "magrittr")
tst = sapply(pkgs, "requireNamespace",
quietly = TRUE, USE.NAMES = FALSE)
rlang::check_installed(pkgs)

if (inherits(map, "mapview")) map = mapview2leaflet(map)
m = initMap(map, map.types, sp::proj4string(x), viewer.suppress = viewer.suppress)
Expand Down Expand Up @@ -334,8 +324,7 @@ leafletPixelsDF = function(x,
...) {

pkgs = c("leaflet", "sp", "magrittr")
tst = sapply(pkgs, "requireNamespace",
quietly = TRUE, USE.NAMES = FALSE)
rlang::check_installed(pkgs)

if (inherits(map, "mapview")) map = mapview2leaflet(map)
if(!is.null(zcol)) x = x[, zcol]
Expand Down Expand Up @@ -388,8 +377,7 @@ leafletPixelsDF = function(x,
leafletSatellite = function(x, ...) {

pkgs = c("leaflet", "satellite", "magrittr")
tst = sapply(pkgs, "requireNamespace",
quietly = TRUE, USE.NAMES = FALSE)
rlang::check_installed(pkgs)

m = mapView(stack(x), ...)

Expand Down
8 changes: 1 addition & 7 deletions R/watch.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,7 @@
#' @export
#' @rdname mapviewWatcher
mapviewWatcher = function(env = .GlobalEnv, ...) {

if (!requireNamespace("later", quietly = TRUE)) {
stop(
"Please install.packages('later') to allow mapview to watch your workspace"
, call. = FALSE
)
}
rlang::check_installed("later")

last_value = NULL

Expand Down