1

easy way to register for googleAuthR such that I could make bubble plots on maps in R? Here is what I have been trying:

library(ggmap)
library(googleAuthR)
install.packages("googleAuthR")
# get the map info
remotes::install_github("abc@gmail.com/googleAuthR")
gar_auth(email = "abc@gmail.com")
map <- get_googlemap("Montpellier, France", zoom = 8, maptype = "terrain")
Z.Lin
  • 28,055
  • 6
  • 54
  • 94
SamV
  • 118
  • 1
  • 7

2 Answers2

1

It looks as if the method for registering the Google API key has changed a time or two from the time when the API was completely free.

I registered with Google for the Google mapping API key a couple of months ago. Then I only needed to set the API Key on the PC once. After registering the API key on the PC, all the Google Map API requests happen without any issues.

While registering at Google for the API Key, Google recommends several options to safeguard your API key. I choose to limit the daily activity for each of the various Google Map API Apps. Sometimes while coding I reach those daily limits. The daily limits can be changed, but Google doesn't update those changes until mid-night.

I inserted the following line of registration code into some random Jupyter Notebook project I was working on a few months ago. I don't remember what the project was or what it is named. I set the API Key once on the PC and then all was good. I was coding in R and I set the API key using R. There will likely be different code when registering using python. And to permanently set the API Key in R, use the, write - TRUE, option.

Here's that code. The quotes are required around the API Key.

register_google(key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", write = TRUE)
Gray
  • 1,164
  • 1
  • 9
  • 23
  • Thanks, will try this. I could still make something using getmap with Lat and Long and plot some points. But could not use ggplot with it; Had to use points() function to plot on the Map. Appreciate any suggestions! - or should I just buy the API ($2 static maps) ...I'll skip a coffee ;) – SamV Jul 26 '20 at 13:47
  • 1
    I want to appreciate the help provided by all above users in this thread and the stackoverflow community for your assistance in visualization of data in one of my upcoming publications. Kindly contact me if you do not consent to using your user ID in the acknowledgements. Thank you and all the best! Stay safe and healthy!! – SamV Oct 21 '20 at 13:27
  • Thanks for the note of appreciation. I noticed the response I provided to this question never received credit for being useful. If this answer was helpful, kindly click on the up-arrow next to my response to this question. Doing so assists my reputation at this site. Regards, – Gray Oct 21 '20 at 19:29
0

Here is the update after managing to plot this: ggmap with geompoint on map

What I have learned: You need to update quite some google APIs to get to different areas of the world else it locked me out of certain countries. "OSM" now shows as defunct in R and I could not play with the color of the sea in the toner map; Further I did try and install Java etc in R to get it running for different types; Later realized that it was now defunct after inquiry in R; What I have used here is free using get_stamenmap, bbox, geompoint and geomlabel as a simple 4 line code. cheers and hope this info helps someone in the future.

SamV
  • 118
  • 1
  • 7