Learn R Programming

googleway (version 2.7.1)

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)

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.

Examples

Run this code
# NOT RUN {
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