tnt
tnt

Reputation: 1459

new error when getting basemap from stamenmaps

I've previously used the below code for getting a basemap from stamenmaps, but I tried running it today and I'm getting an error message. If I change the zoom to a value <= 5, then it runs, but not for anything higher.

library(ggmap)
base <- get_stamenmap(bbox = c(left   = -70.2, 
                               bottom = 43.0,
                               right  = -49.8,
                               top    = 54.5), 
                        zoom = 8, maptype = "terrain-background", color = "color")
ℹ Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL.
Error in f(init, x[[i]]) : 
  number of rows of matrices must match (see arg 2)

Upvotes: 1

Views: 2096

Answers (1)

tnt
tnt

Reputation: 1459

Here's what I found for getting Stamen map tiles from Stadia Maps.

1) You'll need to get an API key

2) Then install a dev version of ggmap and update R code with new function:

remove.packages("ggmap")
install.packages("devtools")
devtools::install_github("stadiamaps/ggmap")
library("ggmap")
register_stadiamaps(key = "INSERT YOUR KEY HERE")
atlCan <- get_stadiamap(bbox = c(left   = -70.2, 
                                 bottom = 43.0,
                                 right  = -49.8,
                                 top    = 54.5), 
                        zoom = 8, maptype = "stamen_terrain_background")

More details here.

Upvotes: 4

Related Questions