Skip to content

Commit

Permalink
fix: use the same provider names as leaflet
Browse files Browse the repository at this point in the history
fix #31
  • Loading branch information
rCarto committed Jan 15, 2024
1 parent d216b6e commit 5b29be3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 33 deletions.
14 changes: 7 additions & 7 deletions R/get_tiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
#' Providers: \cr
#' "OpenStreetMap", "OpenStreetMap.DE", "OpenStreetMap.France",
#' "OpenStreetMap.HOT", "OpenTopoMap", \cr
#' "Stadia.Stamen.Toner", "Stadia.Stamen.TonerBackground",
#' "Stadia.Stamen.TonerLines", "Stadia.Stamen.TonerLabels",
#' "Stadia.Stamen.TonerLite",
#' "Stadia.Stamen.Watercolor", "Stadia.Stamen.Terrain",
#' "Stadia.Stamen.TerrainBackground",
#' "Stadia.Stamen.TerrainLabels", \cr
#' "Stadia.StamenToner", "Stadia.StamenTonerBackground",
#' "Stadia.StamenTonerLines", "Stadia.StamenTonerLabels",
#' "Stadia.StamenTonerLite",
#' "Stadia.StamenWatercolor", "Stadia.StamenTerrain",
#' "Stadia.StamenTerrainBackground",
#' "Stadia.StamenTerrainLabels", \cr
#' "Esri.WorldStreetMap",
#' "Esri.WorldTopoMap", "Esri.WorldImagery", "Esri.WorldTerrain",
#' "Esri.WorldShadedRelief", "Esri.OceanBasemap", "Esri.NatGeoWorldMap",
Expand All @@ -49,7 +49,7 @@
#' "Thunderforest.Neighbourhood"
#' @export
#' @return A SpatRaster is returned.
#' @importFrom terra ext project rast as.polygons 'RGB<-' gdal writeRaster
#' @importFrom terra ext project rast as.polygons gdal writeRaster
#' @importFrom sf st_is st_transform st_geometry<- st_buffer st_geometry
#' st_bbox st_as_sfc st_crs
#' @importFrom tools file_path_sans_ext
Expand Down
36 changes: 18 additions & 18 deletions R/providers.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,56 +34,56 @@ globalVariables(".global_maptiles", package = "maptiles", add = FALSE)
sub = c("a", "b", "c"),
cit = "Map data: \ua9 OpenStreetMap contributors | Map style: \ua9 OpenTopoMap (CC-BY-SA)"
),
Stadia.Stamen.Toner = list(
src = "Stadia.Stamen.Toner",
Stadia.StamenToner = list(
src = "Stadia.StamenToner",
q = "https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}.png?api_key={apikey}",
sub = NA,
cit = "\ua9 Stadia Maps \ua9 Stamen Design \ua9 OpenMapTiles \ua9 OpenStreetMap contributors"
),
Stadia.Stamen.TonerBackground = list(
src = "Stadia.Stamen.TonerBackground",
Stadia.StamenTonerBackground = list(
src = "Stadia.StamenTonerBackground",
q = "https://tiles.stadiamaps.com/tiles/stamen_toner_background/{z}/{x}/{y}.png?api_key={apikey}",
sub = NA,
cit = "\ua9 Stadia Maps \ua9 Stamen Design \ua9 OpenMapTiles \ua9 OpenStreetMap contributors"
),
Stadia.Stamen.TonerLines = list(
src = "Stadia.Stamen.TonerLines",
Stadia.StamenTonerLines = list(
src = "Stadia.StamenTonerLines",
q = "https://tiles.stadiamaps.com/tiles/stamen_toner_lines/{z}/{x}/{y}.png?api_key={apikey}",
sub = NA,
cit = "\ua9 Stadia Maps \ua9 Stamen Design \ua9 OpenMapTiles \ua9 OpenStreetMap contributors"
),
Stadia.Stamen.TonerLabels = list(
src = "Stadia.Stamen.TonerLabels",
Stadia.StamenTonerLabels = list(
src = "Stadia.StamenTonerLabels",
q = "https://tiles.stadiamaps.com/tiles/stamen_toner_labels/{z}/{x}/{y}.png?api_key={apikey}",
sub = NA,
cit = "\ua9 Stadia Maps \ua9 Stamen Design \ua9 OpenMapTiles \ua9 OpenStreetMap contributors"
),
Stadia.Stamen.TonerLite = list(
src = "Stadia.Stamen.TonerLite",
Stadia.StamenTonerLite = list(
src = "Stadia.StamenTonerLite",
q = "https://tiles.stadiamaps.com/tiles/stamen_toner_lite/{z}/{x}/{y}.png?api_key={apikey}",
sub = NA,
cit = "\ua9 Stadia Maps \ua9 Stamen Design \ua9 OpenMapTiles \ua9 OpenStreetMap contributors"
),
Stadia.Stamen.Watercolor = list(
src = "Stadia.Stamen.Watercolor",
Stadia.StamenWatercolor = list(
src = "Stadia.StamenWatercolor",
q = "https://tiles.stadiamaps.com/tiles/stamen_watercolor/{z}/{x}/{y}.jpg?api_key={apikey}",
sub = NA,
cit = "\ua9 Stadia Maps \ua9 Stamen Design \ua9 OpenStreetMap contributors"
),
Stadia.Stamen.Terrain = list(
src = "Stadia.Stamen.Terrain",
Stadia.StamenTerrain = list(
src = "Stadia.StamenTerrain",
q = "https://tiles.stadiamaps.com/tiles/stamen_terrain/{z}/{x}/{y}.png?api_key={apikey}",
sub = NA,
cit = "\ua9 Stadia Maps \ua9 Stamen Design \ua9 OpenMapTiles \ua9 OpenStreetMap contributors"
),
Stadia.Stamen.TerrainBackground = list(
src = "Stadia.Stamen.TerrainBackground",
Stadia.StamenTerrainBackground = list(
src = "Stadia.StamenTerrainBackground",
q = "https://tiles.stadiamaps.com/tiles/stamen_terrain_background/{z}/{x}/{y}.png?api_key={apikey}",
sub = NA,
cit = "\ua9 Stadia Maps \ua9 Stamen Design \ua9 OpenMapTiles \ua9 OpenStreetMap contributors"
),
Stadia.Stamen.TerrainLabels = list(
src = "Stadia.Stamen.TerrainLabels",
Stadia.StamenTerrainLabels = list(
src = "Stadia.StamenTerrainLabels",
q = "https://tiles.stadiamaps.com/tiles/stamen_terrain_labels/{z}/{x}/{y}.png?api_key={apikey}",
sub = NA,
cit = "\ua9 Stadia Maps \ua9 Stamen Design \ua9 OpenMapTiles \ua9 OpenStreetMap contributors"
Expand Down
3 changes: 2 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ get_param <- function(provider) {
stop(paste0("'",provider,"' is not a builtin provider."), call. = FALSE)
}
if (provider %in% stamen_provider) {
provider <- gsub("\\.", "", provider)
provider <- paste0("Stadia.", provider)
warning(
paste0(
Expand Down Expand Up @@ -296,6 +297,6 @@ project_and_crop_raster <- function(ras, project, res, crop) {
ras <- terra::crop(x = ras, y = bbox_output[c(1, 3, 2, 4)], snap = "out")
}
# set R, G, B channels, such that plot(ras) will go to plotRGB
RGB(ras) <- 1:3
terra::RGB(ras) <- 1:3
return(ras)
}
12 changes: 6 additions & 6 deletions man/get_tiles.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/maptiles.Rd

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

0 comments on commit 5b29be3

Please sign in to comment.