Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message on creating simple maps which worked yesterday. #353

Closed
SwultCode opened this issue Oct 4, 2023 · 7 comments
Closed

Error message on creating simple maps which worked yesterday. #353

SwultCode opened this issue Oct 4, 2023 · 7 comments

Comments

@SwultCode
Copy link

number of rows of matrices must match

Hey, ggmap was working just fine yesterday, when I used it today I couldn't make any large maps, by large I mean a big bounding box, the zoom isn't the issue. Whenever I make a map, i.e. one of europe, I get an error of Error in f(init, x[[i]]) : number of rows of matrices must match (see arg 2). When I change the bounding box for ggmap to be smaller it works, so I assume it's an issue somewhere there.

Below is a reproduce-able example of the error, it continues to happen after I restart r and my computer.

library(ggmap)
lonlatTest = data.frame(lon=c(-40,15), lat=c(30,0))
qmplot(lon,lat,data=lonlatTest,zoom=5)

Error in f(init, x[[i]]) : number of rows of matrices must match (see arg 2)

@xp-song
Copy link

xp-song commented Oct 4, 2023

I've also experienced this in the function get_map(). I input a bounding box and set source = "stamen". The error traceback seems to suggest that it happens within the stitch() function in get_stamenmap()
Screenshot 2023-10-04 at 15 36 43

@aradzikbys
Copy link

Hello, same issue here - ggmaps were working perfectly yesterday, today I'm facing same error - I've even tried code from some web tutorial to make sure it's not caused by spelling:
Source: https://jtr13.github.io/cc19/stamen-maps-with-ggmap.html

library(ggmap) bbox <- c(bottom = 25.75, top = 49 , right = -67, left = -125) usmap <- get_stamenmap(bbox = bbox, zoom = 6, maptype = 'toner-lite') ggmap(usmap)
After running there is an error:
image

@ryurko
Copy link

ryurko commented Oct 7, 2023

I'm experiencing the exact same error for code that used to work:
library(ggmap)
US <- c(left = -125, bottom = 10, right = -67, top = 49)
map <- get_stamenmap(US, zoom = 5, maptype = "toner-lite")

@ZacWarham
Copy link

I had the same issue but after some digging it turns out that Stamen Maps no longer hosts tiles - manually creating a URL and visiting shows service unavailable. This would require a lot of reworking to use a third-party cache of the Stamen Maps or trying to link to the API for the new host similar to how Google Maps requires an API key

@ZacWarham
Copy link

ZacWarham commented Oct 8, 2023

I had the same issue but after some digging it turns out that Stamen Maps no longer hosts tiles - manually creating a URL and visiting shows service unavailable. This would require a lot of reworking to use a third-party cache of the Stamen Maps or trying to link to the API for the new host similar to how Google Maps requires an API key

Turns out the team at StadiaMaps created a PR for this a while ago #351 which adds a register_stadiamaps() function and replaces get_stamenmap with get_stadiamap

Current workaround until @dkahle merges the PR (skip step 3 if reading this after merge and just update your install instead)

  1. Create account for Stadia Maps (they have a free option but depends on your use case)
  2. Create a 'Property' on your account and get an API key
  3. Install this fork https://github.com/stadiamaps/ggmap
  1. register your API key using register_stadimaps()
  2. Replace all instances of get_stamenmap with get_stadiamap
  3. Make sure to change the tile type to the new format (there will be an error if incorrect type)

Official instructions found in #350 (comment)

@aradzikbys
Copy link

Regarding point 3 >> details on re-instalation of ggmap can be found here: https://docs.stadiamaps.com/guides/migrating-from-stamen-map-tiles/#ggmap

@dkahle
Copy link
Owner

dkahle commented Nov 1, 2023

I believe this is fixed by 191159d; please reopen if that isn't the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants