add_bitmap: Add bitmap

Description Usage Arguments Examples

View source: R/map_layer_bitmap.R

Description

Adds an image to a map

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
add_bitmap(
  map,
  image,
  bounds,
  desaturate = 0,
  transparent_colour = "#000000",
  tint_colour = "#FFFFFF",
  layer_id = NULL,
  update_view = TRUE,
  focus_layer = FALSE
)

Arguments

map

a mapdeck map object

image

url to an image to use on the map

bounds

coordinates of the bounding box of the image [left, bottom, right, top]

desaturate

the desatruation of the bitmap, in range [0,1], 0 being the original colour and 1 being greyscale

transparent_colour

the colour to use for transparent pixels as a hex string

tint_colour

the colour to tint the bipmap by, as a hex string

layer_id

single value specifying an id for the layer. Use this value to distinguish between shape layers of the same type. Layers with the same id are likely to conflict and not plot correctly

update_view

logical indicating if the map should update the bounds to include this layer

focus_layer

logical indicating if the map should update the bounds to only include this layer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
set_token( "MAPBOX_TOKEN" )

mapdeck(location = c(-122.3, 37.8), zoom = 10) %>%
 add_bitmap(
   image = paste0(
   'https://raw.githubusercontent.com/uber-common/deck.gl-data/master/',
   'website/sf-districts.png')
   , bounds = c(-122.519, 37.7045, -122.355, 37.829)
 )

mapdeck(location = c(-75.9, 40.9), zoom = 4) %>%
  add_bitmap(
    image = 'https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif'
    , bounds = c(-80.425, 37.936, -71.516, 46.437)
  )

mapdeck(location = c(-75.9, 40.9), zoom = 4) %>%
  add_bitmap(
    image = 'https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif'
    , bounds = c(-80.425, 37.936, -71.516, 46.437)
    , tint_colour = "#FF0000"
  )

mapdeck(location = c(-75.9, 40.9), zoom = 4) %>%
  add_bitmap(
    image = 'https://docs.mapbox.com/mapbox-gl-js/assets/radar.gif'
    , bounds = c(-80.425, 37.936, -71.516, 46.437)
    , desaturate = 1
  )

mapdeck documentation built on Sept. 4, 2020, 9:07 a.m.