get_map not passing the api key











up vote
6
down vote

favorite
1












I have been facing this issue in the get_map function (ggmap library) in R. Actually my code was running without the need to specify an api key (for source google) for several months. However the code stopped working a couple of weeks back. I understood that google has made the api key mandatory (or maybe they allowed a certain no of calls without the api key which I exhausted). However, even after specifying the api key (obtained from google cloud platform) my code continued behaving the same way. I even contacted google cloud support but they said there was nothing wrong with the api key per se and they were able to invoke the map at their end. I suspect the get_map function is not passing the api_key while invoking the map from google. Any pointers towards resolution would be appreciated.



Below is the reproducible code (that is failing).



library(ggmap)

lat <- c(4,41) #India lat boundaries
lon <- c(68,99) #India long boundaries
center = c(mean(lat), mean(lon))

map <- get_map(location = c(lon = mean(lon),
lat = mean(lat)),
api_key=<my api key>,
zoom = 6,
maptype = "terrain",
source = "google",
messaging = TRUE
)


And below is the error message in R (note the api key is not getting passed)



trying URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false'
Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false'
In addition: Warning message:
In download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false': HTTP status was '403 Forbidden'










share|improve this question




















  • 1




    Thanks @SymbolixAU. I will check this out subsequently. For now, my problem got resolved by using get_googlemap instead of get_map. Seems get_map is not designed to accept the api_key when the source is google. get_map uses the api_key only when the source is cloudmade.
    – Venky
    Oct 1 at 8:19















up vote
6
down vote

favorite
1












I have been facing this issue in the get_map function (ggmap library) in R. Actually my code was running without the need to specify an api key (for source google) for several months. However the code stopped working a couple of weeks back. I understood that google has made the api key mandatory (or maybe they allowed a certain no of calls without the api key which I exhausted). However, even after specifying the api key (obtained from google cloud platform) my code continued behaving the same way. I even contacted google cloud support but they said there was nothing wrong with the api key per se and they were able to invoke the map at their end. I suspect the get_map function is not passing the api_key while invoking the map from google. Any pointers towards resolution would be appreciated.



Below is the reproducible code (that is failing).



library(ggmap)

lat <- c(4,41) #India lat boundaries
lon <- c(68,99) #India long boundaries
center = c(mean(lat), mean(lon))

map <- get_map(location = c(lon = mean(lon),
lat = mean(lat)),
api_key=<my api key>,
zoom = 6,
maptype = "terrain",
source = "google",
messaging = TRUE
)


And below is the error message in R (note the api key is not getting passed)



trying URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false'
Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false'
In addition: Warning message:
In download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false': HTTP status was '403 Forbidden'










share|improve this question




















  • 1




    Thanks @SymbolixAU. I will check this out subsequently. For now, my problem got resolved by using get_googlemap instead of get_map. Seems get_map is not designed to accept the api_key when the source is google. get_map uses the api_key only when the source is cloudmade.
    – Venky
    Oct 1 at 8:19













up vote
6
down vote

favorite
1









up vote
6
down vote

favorite
1






1





I have been facing this issue in the get_map function (ggmap library) in R. Actually my code was running without the need to specify an api key (for source google) for several months. However the code stopped working a couple of weeks back. I understood that google has made the api key mandatory (or maybe they allowed a certain no of calls without the api key which I exhausted). However, even after specifying the api key (obtained from google cloud platform) my code continued behaving the same way. I even contacted google cloud support but they said there was nothing wrong with the api key per se and they were able to invoke the map at their end. I suspect the get_map function is not passing the api_key while invoking the map from google. Any pointers towards resolution would be appreciated.



Below is the reproducible code (that is failing).



library(ggmap)

lat <- c(4,41) #India lat boundaries
lon <- c(68,99) #India long boundaries
center = c(mean(lat), mean(lon))

map <- get_map(location = c(lon = mean(lon),
lat = mean(lat)),
api_key=<my api key>,
zoom = 6,
maptype = "terrain",
source = "google",
messaging = TRUE
)


And below is the error message in R (note the api key is not getting passed)



trying URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false'
Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false'
In addition: Warning message:
In download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false': HTTP status was '403 Forbidden'










share|improve this question















I have been facing this issue in the get_map function (ggmap library) in R. Actually my code was running without the need to specify an api key (for source google) for several months. However the code stopped working a couple of weeks back. I understood that google has made the api key mandatory (or maybe they allowed a certain no of calls without the api key which I exhausted). However, even after specifying the api key (obtained from google cloud platform) my code continued behaving the same way. I even contacted google cloud support but they said there was nothing wrong with the api key per se and they were able to invoke the map at their end. I suspect the get_map function is not passing the api_key while invoking the map from google. Any pointers towards resolution would be appreciated.



Below is the reproducible code (that is failing).



library(ggmap)

lat <- c(4,41) #India lat boundaries
lon <- c(68,99) #India long boundaries
center = c(mean(lat), mean(lon))

map <- get_map(location = c(lon = mean(lon),
lat = mean(lat)),
api_key=<my api key>,
zoom = 6,
maptype = "terrain",
source = "google",
messaging = TRUE
)


And below is the error message in R (note the api key is not getting passed)



trying URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false'
Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false'
In addition: Warning message:
In download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") :
cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=22.5,83.5&zoom=6&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false': HTTP status was '403 Forbidden'







r google-maps google-maps-api-3 ggmap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 12:56









Jaap

54.6k20116129




54.6k20116129










asked Sep 29 at 5:40









Venky

3112




3112








  • 1




    Thanks @SymbolixAU. I will check this out subsequently. For now, my problem got resolved by using get_googlemap instead of get_map. Seems get_map is not designed to accept the api_key when the source is google. get_map uses the api_key only when the source is cloudmade.
    – Venky
    Oct 1 at 8:19














  • 1




    Thanks @SymbolixAU. I will check this out subsequently. For now, my problem got resolved by using get_googlemap instead of get_map. Seems get_map is not designed to accept the api_key when the source is google. get_map uses the api_key only when the source is cloudmade.
    – Venky
    Oct 1 at 8:19








1




1




Thanks @SymbolixAU. I will check this out subsequently. For now, my problem got resolved by using get_googlemap instead of get_map. Seems get_map is not designed to accept the api_key when the source is google. get_map uses the api_key only when the source is cloudmade.
– Venky
Oct 1 at 8:19




Thanks @SymbolixAU. I will check this out subsequently. For now, my problem got resolved by using get_googlemap instead of get_map. Seems get_map is not designed to accept the api_key when the source is google. get_map uses the api_key only when the source is cloudmade.
– Venky
Oct 1 at 8:19












4 Answers
4






active

oldest

votes

















up vote
5
down vote













Just to add to Roman Abashin's answer (I can't comment, unfortunately): As per '?get_map()', the 'api_key =' argument doesn't work for Google maps. You'll need to use the 'register_google()' function, but as of 03/10/18, it's only in the development version of ggmap, which you can get like so:



devtools::install_github("dkahle/ggmap", ref = "tidyup")


Then you'll also need to enable billing on your Google account, though the first 100,000 maps you use each month should be free, see here: https://cloud.google.com/maps-platform/pricing/sheet/ for details.



(tips drawn from here: https://github.com/dkahle/ggmap/issues/51)






share|improve this answer





















  • Absolutely right, thank you! Here is my attempt at a rough step-by-step tutorial.
    – Roman
    Oct 4 at 23:55


















up vote
4
down vote













You need to use register_google(key = "...") in every new session of R. Using api_key = inside the get_map() call does not work.






share|improve this answer




























    up vote
    2
    down vote













    I don't know the direct resolution to the ggmap issue, but if you're happy to work with an interactive map rather than a static one you can use my googelway library



    library(googleway)

    set_key("GOOGLE_MAP_KEY")

    lat <- c(4,41) #India lat boundaries
    lon <- c(68,99) #India long boundaries
    center = c(mean(lat), mean(lon))

    google_map(location = center, zoom = 6)


    enter image description here






    share|improve this answer





















    • I started to have the same issue as before. Nothing shows up in the R viewer and this time even opening it in a browser doesn't help. Just wanted to let you know. Cheers for all the help that I got from your packages throughout these years.
      – Masoud
      Nov 15 at 16:07










    • @Masoud - is there an error in the javascript console ( in the browser, right click (outside the map), select 'inspect', and go to the 'console' tab)
      – SymbolixAU
      Nov 16 at 2:49










    • Don't have my laptop with me, will check and report back.
      – Masoud
      Nov 16 at 3:13










    • I updated R, and it resolved the issue. FYI.
      – Masoud
      Nov 17 at 1:09






    • 1




      @Masoud odd that was required, but glad it's now working again
      – SymbolixAU
      Nov 17 at 1:51


















    up vote
    2
    down vote













    Just adding to @Roman's response, here's the code that worked for me:



    if(!requireNamespace("devtools")) install.packages("devtools")
    devtools::install_github("dkahle/ggmap", ref = "tidyup")
    library(ggmap)
    register_google(key = "your_API_key")
    usa<- get_googlemap(location='united states', zoom=4,maptype = "hybrid")


    For more information you could refer to the library page on github: here

    Hopefully it helps!






    share|improve this answer





















      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52565472%2fget-map-not-passing-the-api-key%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      5
      down vote













      Just to add to Roman Abashin's answer (I can't comment, unfortunately): As per '?get_map()', the 'api_key =' argument doesn't work for Google maps. You'll need to use the 'register_google()' function, but as of 03/10/18, it's only in the development version of ggmap, which you can get like so:



      devtools::install_github("dkahle/ggmap", ref = "tidyup")


      Then you'll also need to enable billing on your Google account, though the first 100,000 maps you use each month should be free, see here: https://cloud.google.com/maps-platform/pricing/sheet/ for details.



      (tips drawn from here: https://github.com/dkahle/ggmap/issues/51)






      share|improve this answer





















      • Absolutely right, thank you! Here is my attempt at a rough step-by-step tutorial.
        – Roman
        Oct 4 at 23:55















      up vote
      5
      down vote













      Just to add to Roman Abashin's answer (I can't comment, unfortunately): As per '?get_map()', the 'api_key =' argument doesn't work for Google maps. You'll need to use the 'register_google()' function, but as of 03/10/18, it's only in the development version of ggmap, which you can get like so:



      devtools::install_github("dkahle/ggmap", ref = "tidyup")


      Then you'll also need to enable billing on your Google account, though the first 100,000 maps you use each month should be free, see here: https://cloud.google.com/maps-platform/pricing/sheet/ for details.



      (tips drawn from here: https://github.com/dkahle/ggmap/issues/51)






      share|improve this answer





















      • Absolutely right, thank you! Here is my attempt at a rough step-by-step tutorial.
        – Roman
        Oct 4 at 23:55













      up vote
      5
      down vote










      up vote
      5
      down vote









      Just to add to Roman Abashin's answer (I can't comment, unfortunately): As per '?get_map()', the 'api_key =' argument doesn't work for Google maps. You'll need to use the 'register_google()' function, but as of 03/10/18, it's only in the development version of ggmap, which you can get like so:



      devtools::install_github("dkahle/ggmap", ref = "tidyup")


      Then you'll also need to enable billing on your Google account, though the first 100,000 maps you use each month should be free, see here: https://cloud.google.com/maps-platform/pricing/sheet/ for details.



      (tips drawn from here: https://github.com/dkahle/ggmap/issues/51)






      share|improve this answer












      Just to add to Roman Abashin's answer (I can't comment, unfortunately): As per '?get_map()', the 'api_key =' argument doesn't work for Google maps. You'll need to use the 'register_google()' function, but as of 03/10/18, it's only in the development version of ggmap, which you can get like so:



      devtools::install_github("dkahle/ggmap", ref = "tidyup")


      Then you'll also need to enable billing on your Google account, though the first 100,000 maps you use each month should be free, see here: https://cloud.google.com/maps-platform/pricing/sheet/ for details.



      (tips drawn from here: https://github.com/dkahle/ggmap/issues/51)







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Oct 3 at 9:21









      elskevdv

      815




      815












      • Absolutely right, thank you! Here is my attempt at a rough step-by-step tutorial.
        – Roman
        Oct 4 at 23:55


















      • Absolutely right, thank you! Here is my attempt at a rough step-by-step tutorial.
        – Roman
        Oct 4 at 23:55
















      Absolutely right, thank you! Here is my attempt at a rough step-by-step tutorial.
      – Roman
      Oct 4 at 23:55




      Absolutely right, thank you! Here is my attempt at a rough step-by-step tutorial.
      – Roman
      Oct 4 at 23:55












      up vote
      4
      down vote













      You need to use register_google(key = "...") in every new session of R. Using api_key = inside the get_map() call does not work.






      share|improve this answer

























        up vote
        4
        down vote













        You need to use register_google(key = "...") in every new session of R. Using api_key = inside the get_map() call does not work.






        share|improve this answer























          up vote
          4
          down vote










          up vote
          4
          down vote









          You need to use register_google(key = "...") in every new session of R. Using api_key = inside the get_map() call does not work.






          share|improve this answer












          You need to use register_google(key = "...") in every new session of R. Using api_key = inside the get_map() call does not work.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Oct 2 at 23:55









          Roman

          1,402217




          1,402217






















              up vote
              2
              down vote













              I don't know the direct resolution to the ggmap issue, but if you're happy to work with an interactive map rather than a static one you can use my googelway library



              library(googleway)

              set_key("GOOGLE_MAP_KEY")

              lat <- c(4,41) #India lat boundaries
              lon <- c(68,99) #India long boundaries
              center = c(mean(lat), mean(lon))

              google_map(location = center, zoom = 6)


              enter image description here






              share|improve this answer





















              • I started to have the same issue as before. Nothing shows up in the R viewer and this time even opening it in a browser doesn't help. Just wanted to let you know. Cheers for all the help that I got from your packages throughout these years.
                – Masoud
                Nov 15 at 16:07










              • @Masoud - is there an error in the javascript console ( in the browser, right click (outside the map), select 'inspect', and go to the 'console' tab)
                – SymbolixAU
                Nov 16 at 2:49










              • Don't have my laptop with me, will check and report back.
                – Masoud
                Nov 16 at 3:13










              • I updated R, and it resolved the issue. FYI.
                – Masoud
                Nov 17 at 1:09






              • 1




                @Masoud odd that was required, but glad it's now working again
                – SymbolixAU
                Nov 17 at 1:51















              up vote
              2
              down vote













              I don't know the direct resolution to the ggmap issue, but if you're happy to work with an interactive map rather than a static one you can use my googelway library



              library(googleway)

              set_key("GOOGLE_MAP_KEY")

              lat <- c(4,41) #India lat boundaries
              lon <- c(68,99) #India long boundaries
              center = c(mean(lat), mean(lon))

              google_map(location = center, zoom = 6)


              enter image description here






              share|improve this answer





















              • I started to have the same issue as before. Nothing shows up in the R viewer and this time even opening it in a browser doesn't help. Just wanted to let you know. Cheers for all the help that I got from your packages throughout these years.
                – Masoud
                Nov 15 at 16:07










              • @Masoud - is there an error in the javascript console ( in the browser, right click (outside the map), select 'inspect', and go to the 'console' tab)
                – SymbolixAU
                Nov 16 at 2:49










              • Don't have my laptop with me, will check and report back.
                – Masoud
                Nov 16 at 3:13










              • I updated R, and it resolved the issue. FYI.
                – Masoud
                Nov 17 at 1:09






              • 1




                @Masoud odd that was required, but glad it's now working again
                – SymbolixAU
                Nov 17 at 1:51













              up vote
              2
              down vote










              up vote
              2
              down vote









              I don't know the direct resolution to the ggmap issue, but if you're happy to work with an interactive map rather than a static one you can use my googelway library



              library(googleway)

              set_key("GOOGLE_MAP_KEY")

              lat <- c(4,41) #India lat boundaries
              lon <- c(68,99) #India long boundaries
              center = c(mean(lat), mean(lon))

              google_map(location = center, zoom = 6)


              enter image description here






              share|improve this answer












              I don't know the direct resolution to the ggmap issue, but if you're happy to work with an interactive map rather than a static one you can use my googelway library



              library(googleway)

              set_key("GOOGLE_MAP_KEY")

              lat <- c(4,41) #India lat boundaries
              lon <- c(68,99) #India long boundaries
              center = c(mean(lat), mean(lon))

              google_map(location = center, zoom = 6)


              enter image description here







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 29 at 5:52









              SymbolixAU

              16.1k32886




              16.1k32886












              • I started to have the same issue as before. Nothing shows up in the R viewer and this time even opening it in a browser doesn't help. Just wanted to let you know. Cheers for all the help that I got from your packages throughout these years.
                – Masoud
                Nov 15 at 16:07










              • @Masoud - is there an error in the javascript console ( in the browser, right click (outside the map), select 'inspect', and go to the 'console' tab)
                – SymbolixAU
                Nov 16 at 2:49










              • Don't have my laptop with me, will check and report back.
                – Masoud
                Nov 16 at 3:13










              • I updated R, and it resolved the issue. FYI.
                – Masoud
                Nov 17 at 1:09






              • 1




                @Masoud odd that was required, but glad it's now working again
                – SymbolixAU
                Nov 17 at 1:51


















              • I started to have the same issue as before. Nothing shows up in the R viewer and this time even opening it in a browser doesn't help. Just wanted to let you know. Cheers for all the help that I got from your packages throughout these years.
                – Masoud
                Nov 15 at 16:07










              • @Masoud - is there an error in the javascript console ( in the browser, right click (outside the map), select 'inspect', and go to the 'console' tab)
                – SymbolixAU
                Nov 16 at 2:49










              • Don't have my laptop with me, will check and report back.
                – Masoud
                Nov 16 at 3:13










              • I updated R, and it resolved the issue. FYI.
                – Masoud
                Nov 17 at 1:09






              • 1




                @Masoud odd that was required, but glad it's now working again
                – SymbolixAU
                Nov 17 at 1:51
















              I started to have the same issue as before. Nothing shows up in the R viewer and this time even opening it in a browser doesn't help. Just wanted to let you know. Cheers for all the help that I got from your packages throughout these years.
              – Masoud
              Nov 15 at 16:07




              I started to have the same issue as before. Nothing shows up in the R viewer and this time even opening it in a browser doesn't help. Just wanted to let you know. Cheers for all the help that I got from your packages throughout these years.
              – Masoud
              Nov 15 at 16:07












              @Masoud - is there an error in the javascript console ( in the browser, right click (outside the map), select 'inspect', and go to the 'console' tab)
              – SymbolixAU
              Nov 16 at 2:49




              @Masoud - is there an error in the javascript console ( in the browser, right click (outside the map), select 'inspect', and go to the 'console' tab)
              – SymbolixAU
              Nov 16 at 2:49












              Don't have my laptop with me, will check and report back.
              – Masoud
              Nov 16 at 3:13




              Don't have my laptop with me, will check and report back.
              – Masoud
              Nov 16 at 3:13












              I updated R, and it resolved the issue. FYI.
              – Masoud
              Nov 17 at 1:09




              I updated R, and it resolved the issue. FYI.
              – Masoud
              Nov 17 at 1:09




              1




              1




              @Masoud odd that was required, but glad it's now working again
              – SymbolixAU
              Nov 17 at 1:51




              @Masoud odd that was required, but glad it's now working again
              – SymbolixAU
              Nov 17 at 1:51










              up vote
              2
              down vote













              Just adding to @Roman's response, here's the code that worked for me:



              if(!requireNamespace("devtools")) install.packages("devtools")
              devtools::install_github("dkahle/ggmap", ref = "tidyup")
              library(ggmap)
              register_google(key = "your_API_key")
              usa<- get_googlemap(location='united states', zoom=4,maptype = "hybrid")


              For more information you could refer to the library page on github: here

              Hopefully it helps!






              share|improve this answer

























                up vote
                2
                down vote













                Just adding to @Roman's response, here's the code that worked for me:



                if(!requireNamespace("devtools")) install.packages("devtools")
                devtools::install_github("dkahle/ggmap", ref = "tidyup")
                library(ggmap)
                register_google(key = "your_API_key")
                usa<- get_googlemap(location='united states', zoom=4,maptype = "hybrid")


                For more information you could refer to the library page on github: here

                Hopefully it helps!






                share|improve this answer























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  Just adding to @Roman's response, here's the code that worked for me:



                  if(!requireNamespace("devtools")) install.packages("devtools")
                  devtools::install_github("dkahle/ggmap", ref = "tidyup")
                  library(ggmap)
                  register_google(key = "your_API_key")
                  usa<- get_googlemap(location='united states', zoom=4,maptype = "hybrid")


                  For more information you could refer to the library page on github: here

                  Hopefully it helps!






                  share|improve this answer












                  Just adding to @Roman's response, here's the code that worked for me:



                  if(!requireNamespace("devtools")) install.packages("devtools")
                  devtools::install_github("dkahle/ggmap", ref = "tidyup")
                  library(ggmap)
                  register_google(key = "your_API_key")
                  usa<- get_googlemap(location='united states', zoom=4,maptype = "hybrid")


                  For more information you could refer to the library page on github: here

                  Hopefully it helps!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 17 at 14:16









                  Rudr

                  759




                  759






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52565472%2fget-map-not-passing-the-api-key%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Bressuire

                      Vorschmack

                      Quarantine