Skip to content

Instantly share code, notes, and snippets.

@rCarto
Last active December 12, 2023 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rCarto/c4bcbed525b5428bf01563548ba2d20f to your computer and use it in GitHub Desktop.
Save rCarto/c4bcbed525b5428bf01563548ba2d20f to your computer and use it in GitHub Desktop.
# Your Stadia API key:
apikey = "xxxxxxxxxxxxxxxxxxxxxxx"

# Define a bounding box
library(sf)
bb <- st_bbox(obj = c(xmin = 24.73592, xmax = 24.75185, 
                      ymin = 59.4340, ymax = 59.4393), 
              crs = "EPSG:4326")

# Download and compose Stadia/stamen tiles
library(maptiles)
stam <- get_tiles(x = bb, provider = "Stadia.Stamen.TonerLite", 
                  apikey = apikey, project = FALSE)

# Display the basemap
library(mapsf)
mf_raster(stam)
mf_credits(get_credit('Stadia.Stamen.TonerLite'), bg = "white")
mf_title("Stamen Toner Lite Basemap", tab = FALSE)

Created on 2023-12-12 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment