Package 'snapbox'

Title: GGPlot Mapbox Basemap
Description: Static mapbox basemap for ggplot2.
Authors: Anthony North [aut, cre], Miles McBain [aut]
Maintainer: Anthony North <[email protected]>
License: MIT + file LICENSE
Version: 0.2.2
Built: 2024-10-16 03:16:29 UTC
Source: https://github.com/anthonynorth/snapbox

Help Index


Get static map

Description

Get static Mapbox map as a georeferenced raster

Usage

get_static_map(
  area,
  map_style = mapbox_dark(),
  mapbox_api_access_token = Sys.getenv("MAPBOX_ACCESS_TOKEN"),
  retina = TRUE,
  scale_ratio = 1,
  area_buffer = 0,
  mapbox_logo = TRUE,
  attribution = TRUE,
  purge_cache = FALSE
)

Arguments

area

the map area

map_style

mapbox style, see stylebox::mapbox_styles

mapbox_api_access_token

mapbox api access token

retina

render the map at 2x scale if TRUE

scale_ratio

ratio to scale the output image; scale_ratio = 1 will give the largest image and smallest zoom.

area_buffer

a buffer to appear around the area geometry in meters (web mercator projection, EPSG 3857). Use this to create space around your data in the map visual.

include mapbox logo on the image if TRUE

attribution

include attribution on the image if TRUE. You still have a legal responsibility to attribute maps that use OpenStreetMap data, which includes most maps from Mapbox. If you specify attribution=FALSE, you are legally required to include proper attribution elsewhere on the webpage or document. https://docs.mapbox.com/api/maps/#static-images and https://docs.mapbox.com/help/how-mapbox-works/attribution/#static–print

purge_cache

forget cached api calls and responses before making api call if TRUE.


Layer mapbox

Description

Create a mapbox map ggplot layer

Usage

layer_mapbox(
  area,
  map_style = mapbox_dark(),
  mapbox_api_access_token = Sys.getenv("MAPBOX_ACCESS_TOKEN"),
  retina = TRUE,
  scale_ratio = 1,
  area_buffer = 0,
  mapbox_logo = TRUE,
  attribution = TRUE,
  purge_cache = FALSE
)

Arguments

area

the map area

map_style

mapbox style, see stylebox::mapbox_styles

mapbox_api_access_token

mapbox api access token

retina

render the map at 2x scale if TRUE

scale_ratio

ratio to scale the output image; scale_ratio = 1 will give the largest image and smallest zoom.

area_buffer

a buffer to appear around the area geometry in meters (web mercator projection, EPSG 3857). Use this to create space around your data in the map visual.

include mapbox logo on the image if TRUE

attribution

include attribution on the image if TRUE. You still have a legal responsibility to attribute maps that use OpenStreetMap data, which includes most maps from Mapbox. If you specify attribution=FALSE, you are legally required to include proper attribution elsewhere on the webpage or document. https://docs.mapbox.com/api/maps/#static-images and https://docs.mapbox.com/help/how-mapbox-works/attribution/#static–print

purge_cache

forget cached api calls and responses before making api call if TRUE.