2

I'm trying to build a map on R with ggmap library and an osm background however I get the bellow error.

library(ggmap) library(osmdata) library(devtools)

mad_map <- get_map(getbb("Limete, Kinshasa"), maptype = "terrain", source = "osm")

Erreur : 'get_openstreetmap' is defunct.Use 'OSM is at least temporarily not supported, see https://github.com/dkahle/ggmap/issues/117.' instead.

See help("Defunct")

Coralie
  • 187
  • 8

2 Answers2

0

For me your code is working. try update your librarys. You can update them through: install.packages, just copy my code. I think you don't need "source =", if you use "osm" but your code still works.

install.packages("ggmap")
library(ggmap)

install.packages("osmdata")
library(osmdata) 

install.packages("devtools")
library(devtools)

mad_map <- get_map(getbb("Limete, Kinshasa"), maptype = "terrain", source = "osm")
ggmap(mad_map)
pbraeutigm
  • 455
  • 4
  • 8
  • Thanks a lot for your answer ! but I still have the same error... It works when I delete "source = ", but it gives me a google background. – Coralie Aug 05 '21 at 08:49
  • This is strange, beacause it is working at my side. Im using windows 10 RStudio Version 1.4.1717. You should try to 1. clean your workspace, 2. open a new session. 3. update all packages needed, 4. restart R and maybe update your R Version if you haven't done it yet. – pbraeutigm Aug 05 '21 at 09:50
  • I did everything you said but well it still fails, but thanks !! – Coralie Aug 05 '21 at 20:39
  • I have read all the answers in this thread. Unfortunate it seems like the librarys aren't working properly on Mac. The last thing you can try is to install the librarys again, from source. In that way you will get the latest updates. Try install.packages("ggmap", type="source"), and try it with every package used. If that fails, i can point you to other mapping librarys, if you are interested in using another library. – pbraeutigm Aug 08 '21 at 12:27
  • It still doesn't work... And I'm very interested in using other librarys, many many thanks! – Coralie Aug 08 '21 at 18:47
  • I can suggest library leaflet: https://rstudio.github.io/leaflet/ and library mapdata https://eriqande.github.io/rep-res-web/lectures/making-maps-with-R.html or ggmap : http://lab.rady.ucsd.edu/sawtooth/RAnalytics/maps.html – pbraeutigm Aug 08 '21 at 21:37
  • I have a large bounding box but I can't seen to change the type of map – Herman Toothrot Dec 06 '21 at 12:20
0

The solution suggested by pbraeutigm works for me too, so the issue might be on a broader scale. Can you provide some information about your R version, package versions, and operating system?

  • Yes sure I'm using the operating system high Sierra 10.13.6, R version 4.1.0, R studio version 1.3.1093, ggmap version 3.0.0, devtools version 2.4.2, and osmdata version 0.1.6 – Coralie Aug 06 '21 at 14:14
  • 1
    You have the most current R version, but quite an old R studio version, it could be that this is where the bug originates from. And you are using a Mac, things are always a bit different and more complicated for Mac and R, so just make sure to always state that in your question. –  Aug 07 '21 at 18:08
  • Okay thank you for helping! I then updated R studio, and I still have the same error... – Coralie Aug 08 '21 at 05:56