You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/basemap.R
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
#' @param ext extent to be covered by the basemap as any spatial class supported by \code{st_bbox}.
6
6
#' @param map_service character, a map service, either \code{"osm"}, \code{"carto"} or \code{"mapbox"}. Default is \code{"osm"}.
7
7
#' @param map_type character, a map type, e.g. \code{"streets"}. For a full list of available map types, see \code{\link{get_maptypes}}.
8
-
#' @param map_token character, authentication token for services that require registration, which are \code{"osm_stamen"}, \code{"osm_thunderforest"} and \code{"mapbox"}. Register at \url{https://stadiamaps.com/} for stamen, \url{https://www.thunderforest.com/} and/or \url{https://www.mapbox.com/} to get tokens. Ignored for all other map services.
8
+
#' @param map_token character, authentication token for services that require registration, which are \code{"osm_stamen"}, \code{"osm_stadia"}, \code{"osm_thunderforest"} and \code{"mapbox"}. Register at \url{https://stadiamaps.com/} (for stamen and stadia), \url{https://www.thunderforest.com/} and/or \url{https://www.mapbox.com/} to get tokens. Ignored for all other map services.
9
9
#' @param map_res numeric, resolution of base map in range from 0 to 1.
10
10
#' @param map_dir character, cache directory where downloaded basemap tiles will be stored. By default, a temporary directory is used, which is destroyed when the session is terminated.
11
11
#' @param class character, output class, either either \code{plot} (default), \code{magick}, \code{png}, \code{geotif} or if suggested packages are installed, \code{terra}, \code{raster}, \code{stars}, \code{ggplot}, \code{gglayer} or \code{mapview}.
if(map_service=="mapbox"& is.na(map_token)) out("You need to define 'map_token' to use map_service 'mapbox'. Register at https://www.mapbox.com/ to obtain a token.", type=3)
107
107
if(map_service=="osm_thunderforest"& is.na(map_token)) out("You need to define 'map_token' to use map_service 'osm_thunderforest'. Register at https://thunderforest.com to obtain a token.", type=3)
108
108
if(map_service=="osm_stamen"& is.na(map_token)) out("You need to define 'map_token' to use map_service 'osm_stamen'. Register at https://stadiamaps.com to obtain a token.", type=3)
109
+
if(map_service=="osm_stadia"& is.na(map_token)) out("You need to define 'map_token' to use map_service 'osm_stadia'. Register at https://stadiamaps.com to obtain a token.", type=3)
Copy file name to clipboardExpand all lines: R/get_maptypes.R
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
#'
3
3
#' This function returns every supported map type that can be used as input to the \code{map_type} argument of \code{\link{set_defaults}}, \code{\link{basemap}} or associated functions.
4
4
#'
5
-
#' @param map_service character, optional, either \code{"osm"}, \code{"osm_stamen"}, \code{"osm_thunderforest"}, \code{"carto"}, \code{"mapbox"} or \code{"esri"}. Otherwise, a list of map types for both services is returned.
5
+
#' @param map_service character, optional, either \code{"osm"}, \code{"osm_stamen"}, \code{"osm_stadia"}, \code{"osm_thunderforest"}, \code{"carto"}, \code{"mapbox"} or \code{"esri"}. Otherwise, a list of map types for both services is returned.
6
6
#' @return A character vector of supported map types
7
7
#'
8
8
#'
@@ -12,6 +12,8 @@
12
12
#'
13
13
#' \code{"osm_stamen"}: Stamen (\url{https://maps.stamen.com/}) via Stadia Maps (\url{https://stadiamaps.com/}), Open Street Map contributors (\url{https://www.openstreetmap.org/copyright})
14
14
#'
15
+
#' \code{"osm_stadia"}: Stadia Maps (\url{https://stadiamaps.com/}), Open Street Map contributors (\url{https://www.openstreetmap.org/copyright})
16
+
#'
15
17
#' \code{"osm_thunderforest"}: Thunderforest (\url{https://www.thunderforest.com/}), Open Street Map contributors (\url{https://www.openstreetmap.org/copyright})
Copy file name to clipboardExpand all lines: R/internal.R
+19-4Lines changed: 19 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -175,13 +175,14 @@ out <- function(input, type = 1, ll = NULL, msg = FALSE, sign = "", verbose = ge
175
175
if(any(map_service!="mapbox", all(map_service=="mapbox", map_type=="terrain"))) ".png", # file suffix or not
176
176
if(map_service=="mapbox") paste0("?access_token=", map_token), # token or not
177
177
if(map_service=="osm_thunderforest") paste0("?apikey=", map_token), # token or not
178
-
if(map_service=="osm_stamen") paste0("?api_key=", map_token) # token or not
178
+
if(map_service=="osm_stamen") paste0("?api_key=", map_token), # token or not
179
+
if(map_service=="osm_stadia") paste0("?api_key=", map_token) # token or not
179
180
)
180
181
181
182
if(isTRUE(http_error(url))){
182
183
resp<- GET(url)
183
184
status<-resp$status_code
184
-
if(any(status==401&map_service=="mapbox", status==401&map_service=="osm_stamen")) out("Authentification failed. Is your map_token correct?", type=3)
185
+
if(any(status==401&map_service=="mapbox", status==401&map_service=="osm_stamen", status==401&map_service=="osm_stadia")) out("Authentification failed. Is your map_token correct?", type=3)
185
186
if(status==403&map_service=="osm_thunderforest") out("Authentification failed. Is your map_token correct?", type=3)
186
187
}
187
188
if(!file.exists(file)){
@@ -399,7 +400,14 @@ out <- function(input, type = 1, ll = NULL, msg = FALSE, sign = "", verbose = ge
`basemaps` is a lightweight `R` package to download and cache spatial basemaps from open sources such as *OpenStreetMap*, *Stamen/Stadia Maps*, *Thunderforest*, *Carto*, *Mapbox*and others. Retrieved basemaps are translated into and returned as classes of choice, such as `raster`, `stars`, `terra`, `ggplot`, `mapview`, `magick`, or as files, such as `png` or `geotif`. The package aims to ease the use of basemaps in different contexts by providing a function interface as minimalist as possible.
11
+
`basemaps` is a lightweight `R` package to download and cache spatial basemaps from open sources such as *OpenStreetMap*, *Stamen*, *Stadia*, *Thunderforest*, *Carto*, *Mapbox*, *Esri*and others. Retrieved basemaps are translated into and returned as classes of choice, such as `terra`, `stars`, `raster`, `ggplot`, `mapview`, `magick`, or as files, such as `png` or `geotif`. The package aims to ease the use of basemaps in different contexts by providing a function interface as minimalist as possible.
12
12
13
13
14
14
## Installation
@@ -203,21 +203,25 @@ This table lists all currently implemented map services and map types and indica
0 commit comments