Learn R Programming

googleway (version 2.7.8)

add_overlay: Add Overlay

Description

Adds a ground overlay to a map. The overlay can only be added from a URL

Usage

add_overlay(
  map,
  north,
  east,
  south,
  west,
  overlay_url,
  layer_id = NULL,
  digits = 4,
  update_map_view = TRUE
)

Arguments

map

a googleway map object created from google_map()

north

northern-most latitude coordinate

east

eastern-most longitude

south

southern-most latitude coordinate

west

western-most longitude

overlay_url

URL string specifying the location of the overlay layer

layer_id

single value specifying an id for the layer.

digits

integer. Use this parameter to specify how many digits (decimal places) should be used for the latitude / longitude coordinates.

update_map_view

logical. Use this parameter to specify if the map should re-centre according to the overlay extent.

Examples

Run this code
if (FALSE) {

map_key <- 'your_api_key'

google_map(key = map_key) %>%
  add_overlay(north = 40.773941, south = 40.712216, east = -74.12544, west = -74.22655,
               overlay_url = "https://www.lib.utexas.edu/maps/historical/newark_nj_1922.jpg")


url <- paste0("https://developers.google.com/maps/documentation/javascript",
  "/examples/full/images/talkeetna.png")

google_map(key = map_key) %>%
  add_overlay(north = 62.400471, south = 62.281819, east = -150.005608, west = -150.287132,
               overlay_url = url)


}

Run the code above in your browser using DataLab