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

map: use OpenStreetMap instead of google #90

Closed
priviere opened this issue Apr 4, 2018 · 3 comments
Closed

map: use OpenStreetMap instead of google #90

priviere opened this issue Apr 4, 2018 · 3 comments
Labels
Agro Related to agro functions Network Related to network functions
Milestone

Comments

@priviere
Copy link
Owner

priviere commented Apr 4, 2018

No description provided.

@priviere priviere added Agro Related to agro functions Network Related to network functions labels Apr 4, 2018
@priviere priviere added this to the v2 milestone Apr 4, 2018
@priviere
Copy link
Owner Author

priviere commented Feb 4, 2019

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 pmap function code in common_fonctions.R:

  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")

@priviere priviere modified the milestones: v2, v1 Feb 4, 2019
@priviere
Copy link
Owner Author

priviere commented Feb 13, 2019

With ggmap osm is deprecaed. See dkahle/ggmap#172

Instead of osm, use stamen : http://maps.stamen.com/#watercolor/12/37.7706/-122.3782

see ?get_stamenmap for more details

To settle attributions:
Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL.

@priviere
Copy link
Owner Author

done in v0.25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Agro Related to agro functions Network Related to network functions
Projects
None yet
Development

No branches or pull requests

1 participant