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

calc_zoom returns Inf if coordinates in a straight line #318

Open
benscarlson opened this issue Feb 10, 2021 · 0 comments
Open

calc_zoom returns Inf if coordinates in a straight line #318

benscarlson opened this issue Feb 10, 2021 · 0 comments

Comments

@benscarlson
Copy link

It seems that calc_zoom will return Inf if all the coordinates are in a straight line, both in the longitude or latitude direction. Please see below for a reproducible example.

These all fail

list(
  a=data.frame(rbind(c(0,0),c(0,1))),
  b=data.frame(rbind(c(0,0),c(1,0))),
  c=data.frame(rbind(c(0,0),c(0,5))),
  d=data.frame(rbind(c(0,0),c(0,1),c(0,2))),
  e=data.frame(rbind(c(5,5),c(5,6)))
) %>%
  map(~{make_bbox(X1,X2,data=.)  %>% calc_zoom}) %>% unlist

These are successful

list(
  x=data.frame(rbind(c(0,0),c(1,1))),
  b=data.frame(rbind(c(0,0),c(1,0.1))),
  c=data.frame(rbind(c(0,0),c(0.1,0.1)))
) %>%
  map(~{make_bbox(X1,X2,data=.)  %>% calc_zoom}) %>% unlist

I'm using ggmap 3.0.0

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

1 participant