anthonynorth / snapbox

Static mapbox basemap for ggplot2.
MIT License
41 stars 4 forks source link

Error 401 when running the example #10

Open SimonCoulombe opened 4 years ago

SimonCoulombe commented 4 years ago
library(sf)
library(ggplot2)
library(snapbox)

area <- st_bbox(
  c(xmin = 147, ymin = -43, xmax = 147.7, ymax = -42.65),
  crs = 4326
)

ggplot() +
  layer_mapbox(area, scale_ratio = 0.5)

Error in get_map_image(bbox = mercator_bbox, map_style = map_style, width = width,  : 
  The remote server returned status code 401 in response to the image request

All packages are up to date. Running on kubuntu 20.04

edit: guess it's an issue of setting up a mapbox token, just not sure where to do it.

anthonynorth commented 4 years ago

Yes it's likely that it can't find your mapbox access token. layer_mapbox() takes a mapbox_api_access_token parameter which defaults to Sys.getenv("MAPBOX_ACCESS_TOKEN").

SimonCoulombe commented 4 years ago

that was it, thanks