Learn R Programming

inlabru (version 2.3.1)

gmap: Plot a map using extend of a spatial object

Description

Uses get_map() to query map services like Google Maps for a region centered around the spatial object provided. Then calls ggmap() to plot the map.

Usage

gmap(data, ...)

Arguments

data

A Spatial* object.

...

Arguments passed on to get_map().

Value

a ggplot object

Details

This function requires the ggmap package.

Examples

Run this code
# NOT RUN {
# Load the Gorilla data
data(gorillas, package = "inlabru")

# Create a base map centered around the nests and plot the boundary as well
# as the nests
ggplot() +
  gg(gorillas$boundary) +
  gg(gorillas$nests, color = "white", size = 0.5)
if (requireNamespace("ggmap", quietly = TRUE)) {
  gmap(gorillas$nests, maptype = "satellite") +
  gm(gorillas$boundary) +
  gm(gorillas$nests, color = "white", size = 0.5)
}
# }

Run the code above in your browser using DataLab