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
map: use OpenStreetMap instead of google #90
Comments
there are bugs when using ggmap and openstreetmap
cf leaflet ? https://rstudio.github.io/leaflet/ if no way to debug osm with ggmap, maybe update the following n = unique(d[, c("lat", "long", "location")])
n$lat = as.numeric(as.character(n$lat))
n$long = as.numeric(as.character(n$long))
n = na.omit(n)
center_location = c(mean(n$long), mean(n$lat))
map = ggmap::get_map(location = center_location, source = "google", zoom = zoom)
m = ggmap::ggmap(map, extent = "device")
ggsave("tmp_map.png", m, width = 1, height = 1) # get a perfect square
p = ggplot() # support for the map background
p = p + coord_cartesian(xlim = range(m$data$lon), ylim = range(m$data$lat), expand = FALSE)
img = png::readPNG("tmp_map.png")
pmap = p + annotation_custom(grid::rasterGrob(img, width = unit(1,"npc"), height = unit(1,"npc")),
-Inf, Inf, -Inf, Inf) # change in the look of the map because of coordinates changes
pmap = pmap + xlab("long") + ylab("lat")
file.remove("tmp_map.png")
|
With Instead of osm, use stamen : http://maps.stamen.com/#watercolor/12/37.7706/-122.3782 see To settle attributions: |
done in v0.25 |
No description provided.
The text was updated successfully, but these errors were encountered: