-
Notifications
You must be signed in to change notification settings - Fork 231
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
get_map ignores the source argument #51
Comments
I also have similar issues: base <- get_map(location = center, zoom= 10, source = "stamen", maptype = "watercolor") Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=49.22741,-122.8735&zoom=10&size=%20640x640&maptype=terrain&sensor=false |
the first problem looks like an internet error, sometimes the stamen servers are down/don't respond, and you get that 403 error. the second is actually due to the current cran version, just do the below and rerun: library(devtools)
install_github("dkahle/ggmap")
library(ggmap) |
oh, and for why ggmap queries google for osm: it needs to get the spatial coordinates of the query. |
Getting a similar error with get_map, Im unable to find any supporting info. This code worked well just a month ago:
Error:
|
Same problem here today. Is there any solution to this? I am using "google" as source. The code worked till yesterday! |
Have you tried installing the GitHub version of ggmap? The CRAN version is quite old... |
I experienced the same thing. My code worked two weeks ago but now I get the same error as above. I also installed the GitHub version of ggmap. |
Sorry about that. Try installing from the |
same problem here and I have a public presentation tomorrow :( |
My API is registered using register_google (key=.....) and it is showing fine with ggmap_credentials(). Here is my error message: Error in download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") : |
This works just fine for me: if(!requireNamespace("devtools")) install.packages("devtools")
devtools::install_github("dkahle/ggmap", ref = "tidyup")
ggmap(get_googlemap())
register_google(key = "my_google_key_here")
geocode("waco texas") |
It works!!!! THANK YOU so much dkahle I ran your code above and still got similar error message but once I restart R it works. A big sight of relieve here. Thank you. Appreciate your prompt help here |
Happy to help. With the accumulated changes in ggplot2 and elsewhere, ggmap (badly) needs to be updated on CRAN. I hope to do that soon. Until then, you can install from the GitHub repo (branch |
Hello dkahle, Can't get the map. Can you please help? Error in download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") : |
dharle, sorry to bother you again but I manage to get 8 hours of work today with ggmap after the fix this morning but by 4PM NZT it stops working. My API credential has to get registered again. I can call geocode but it won't allow me to use ggmap(get_googlemap()). I have tried to run it from another location (home) in case it's my workplace's firewall or proxy issue but I still get the same problem. Help please? The error message is as follows,
Source : https://maps.googleapis.com/maps/api/geocode/json?address=waco%20texas&key=AIzaSyAMV
Error in download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") : |
@HovhannesSahakyan – I don't know what code you entered to get the resulting error, but your message appears effectively identical to that of @statshermit below, so see the response there. Does a more basic call work? (That is, can you get a map from Google at all?) @statshermit – Unfortunately I don't think I can help on this one since the server is rejecting your HTTP request. Since you're giving your API key, changing your (WAN-side) IP address won't matter – they can still identify you. Waiting a while and trying again may be your only real option? |
Thank you very much for you kind response.
I think I know what is the problem. The problem actually is that the key is not the right key. And I need to enter some bank account number to get a real key.
I am not sure I need to get maps in that way. Will try to draw my maps with other options.
Best wishes,
Hovhannes
On Thursday, 20 September 2018, 16:17:01 EEST, david kahle <notifications@github.com> wrote:
@HovhannesSahakyan – I don't know what code you entered to get the resulting error, but your message appears effectively identical to that of @statshermit below, so see the response there. Does a more basic call work? (That is, can you get a map from Google at all?)
@statshermit – Unfortunately I don't think I can help on this one since the server is rejecting your HTTP request. Since you're giving your API key, changing your (WAN-side) IP address won't matter – they can still identify you. Waiting a while and trying again may be your only real option?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I had the same error code. Here's what worked for me. Go to your google cloud console, and enable Google Maps Static API. It looks like Google's changed stuff recently, and that function requires enabling the map API, separate from, and in addition to, enabling the geocoding API. That could explain why geocoding works for you, while grabbing the map doesnt. Good luck |
You are right! I can call googlemap again. Thanks so much for sharing. I so appreciate everyone's help - thumbs up to everyone! |
oohhhh @phd-project thank you very much for sharing the solution to this problem.
|
Hi everyone, I'm new to ggmap, so pardon me if I'm making ignorant beginner's mistakes. It seems I can't get anything from ggmap to work for me. Below, I show the errors I'm getting past using @dkahle 's code for installing from the tidyup GitHub branch. I've tried installing/re-installing both the CRAN and GitHub versions then restarting R several times already, and I get the same errors with the CRAN version.
Error in download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") :
Source : https://maps.googleapis.com/maps/api/geocode/json?address=waco%20texas&key=... Then I test that my API is registered with ggmap_credentials. Seems fine, I think.
Google - Then I try get_map().
Error in download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") : I checked whether I enabled the Google Maps Static & Geocoding APIs as @phd-project suggested, then tried the code above again. Yep they were enabled, but still no go. @HovhannesSahakyan mentioned needing a "real" key? What does that mean? Paying Google for a key and therefore paying to use ggmap? I've been stuck on this for 2 days now, so I'm not sure what else to try. Please help! |
Hi @emilydinh – I just pushed some changes to Note: be sure to clean your GitHub post of your private API key. |
Hi @emilydinh, please watch next link #51 (comment).
|
Hi @dkahle, Ah, looks like I was too quick copying and pasting in my first post. Thanks! And your solution somewhat worked...? I haven't had anything show up in the plot area before, so this is progress! Then I tried get_map again just to see what would happen. I got a different error than last time: error in data.frame vs. error in download.file
Thanks for your quick response! Let me know what the next step is. |
Hi @jhongajardo, I said in my first post that I already tried @phd-project's solution. I just checked again that the APIs are enabled, and they are. Thanks for your help! |
@emilydinh : Remember that the output contains your private API key. :) When you copy/paste the URL into the browser, what happens? |
@dkahle: Ah, you are right about the key in the output. Anyways, the URL sends me to a webpage version of the plot error. |
I just pushed minor things, try to get those, but I don't expect a change. I previously got what Google's giving you when I wasn't supplying an API key, but I can't reproduce the problem now. I can't reproduce yours, either. Obviously, something is wrong with the API part - is it the URL ggmap is making? (maybe), is it a mistyped API key? (probably not), is it some other environmental assumption? I don't know. The geocode error is obvious, but I don't think that's causing the problem. What seems pretty clear: if you can load the URL in the browser, the R side stuff should work just fine. To be clear, when, in a fresh R session, I load ggmap, register my Google API key with |
Hi @dkahle, I don't think I've mistyped my API key because I copied and pasted it straight from Google. I've tried your solution with a new R session several times, but still get the same issues. Is there anything else I can do? |
@arne1921KF, @kambanane – I'm sorry for the frustration. To be clear: this was not a change in ggmap, but Google's web API. ggmap simply facilitates the connection between R and various Google services; it has no control over either. |
There’s something I’m not clear on - does access to download maps from OSM or Bing from R using packages such as ggmap and Rgooglemaps also require using Google’s API?
…Sent from my iPhone
On 13 Oct 2018, at 12.53, david kahle ***@***.***> wrote:
@arne1921KF, @kambanane – I'm sorry for the frustration. To be clear: this was not a change in ggmap, but Google's web API. ggmap simply facilitates the connection between R and various Google services; it has no control over either.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@dkahle, no worries, it has been clear from the beginning that this decision isn't yours, and you have no say in this. I just commented for clarification, since I think many users of ggmap will hit the same paywall, eventually.
Pwrsonally, I only found out that a CC is needed after I created a project on the service to register the API. I wanted to spare others the same.
|
Hi! So, I have done all of the above: enabled billing, static map api, geocoding api, got key, installed ggmap from 'tidy' branch.
Now that is the kicker: whenever I try to register_google, I get following:
And of course, when trying to get_map: I get:
Any ideas? Many thanks! Rafal |
@grafau : If |
Hello
i still have no success fetching google maps from R. I even enabled several possibly relevant APIs (Geolocation, Maps Embed, Maps Static) in case I did not have the right one available.
In R I get :
Error in download.file
and
Cannot Open URL
when connected via WiFi
When I use an Ethernet LAN connection I get the ‘403 Forbidden’ error message
On the Google APIs console the only API shown with requests is Maps Static API
5 Requests
3 Errors
The # requests are not necessarily incrementing with calls from R...
And there are no data available under Details for the API
Dvoralai
…Sent from my iPhone
On 15 Oct 2018, at 18.02, david kahle ***@***.***> wrote:
If register_google() isn't found, sounds like the install from GitHub didn't work. Or, it could be that it did, but you didn't restart R and reload the newer ggmap. I would just run by that again and make sure things are going as you expect. (And maybe update ggplot2?)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hey all, This is a really cool tool, thanks to everyone who contributed! However, I'm having the same issue. I added my credit card info and register_google'ed. When I tried to get_map, I got the following error message: Source : https://maps.googleapis.com/maps/api/staticmap?center=Europe&zoom=4&size=640x640&scale=2&maptype=terrain&language=en-EN&key=xxx*
Then I enabled APIs through Google API's library (Places API, MAP Static API, and Roads API). It still doesn't work but I get a different message with no 403 (see below). Could the issue be that were missing some APIs? If so, which ones should be enabled? Source : https://maps.googleapis.com/maps/api/staticmap?center=42.14,-88.68&zoom=10&size=640x640&scale=2&maptype=terrain&language=en-EN&key=xxx* |
Hi all When I've tried to replicate this on my work computer, I can't get ggmaps to load. I get the following error when trying to run the dev::tools_install_github() Loading required package: ggplot2 |
Hi @petersoapes – looks like you need to update stringi: install.packages("stringi") Give that a shot and retry. |
Thanks, that worked. |
Super appreciative of all the help posted here (particularly @dkahle and @RomanAbashin)...THANKS!!! I was having similar problems with a recurring 403 problem when trying to use get_map with source="google". I had installed the dkahle/ggmap from the tidyup branch and got the API key/billing sorted out with google. However, despite having enable both the Geocoding and Maps Static APIs, only the former was working (i.e., I was getting the "Waco, Texas" coordinates, but couldn't get a map). I noticed on the Google dashboard that the Geocoding API was getting some traffic (every time I tried it), but that the Maps Static API wasn't showing anything. I eventually regenerated the API key and it all worked. Just thought this might help someone else. |
Hi @dkahle sfmap <- qmap("San Francisco", zoom = 12, type = "roadmap") cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=San+Francisco&zoom=12&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false': HTTP status was '403 Forbidden'Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") : Do you think you could help me figure out what I need to do for it to work? |
Hi @sarahkaunitz – After re-installing the dev version of ggmap (see above), and going on Google Cloud's manager and enabling the Maps Static and Geocoding APIs along with billing, try: sfmap <- get_googlemap("san francisco", zoom = 12, type = "roadmap")
ggmap(sfmap) |
Hi all, I first tried I then tried the suggested example Again and again and again the error keeps coming up as All I want to do is plot lat and lon points corresponding to my dataset to a map in R Very very many thanks in advance 🙏 |
Hello everyone. Google Cloud Console (before doing anything in R):
Onward to R!
@sabahzero have you had any luck over the last few days? Try following my steps listed above or visit @RomanAbashin's comment that I linked to. He has a link to Google's page with info about properly setting up your API with billing and all. After writing this, I dug through the comments more and I see much of this is also summarized here: Thanks much to @dkahle & @RomanAbashin! Plus many others who have been troubleshooting! You made this one easy for me to fix with manuscript reviews due in a couple of days! |
Dear all
Another good summary, thank you.
One little detail: I happen to be using RStudio as a front end. I was only able to get all working when I reinstalled ggmap using @dkahle code from the R console (Rgui) stand-alone, NOT from within RStudio.
This was the case for installations of R on Linux and on Windows.
Dvoralai
…Sent from my iPhone
On 5 Dec 2018, at 13.55, Ryan S. Fuller ***@***.***> wrote:
Hello everyone.
I just wanted to give the problem I had and what I did to solve it for any newcomers to this ever growing feed. For me, I was getting the 'Forbidden (HTTP 403) error that many were having in an old code I used for a manuscript. I followed the solutions found in this comment overflow but more closely to @RomanAbashin's (Sept 30th) (Link here: #51 (comment)) nicely detailed summary comment as follows:
Note: It's imperative to do these in the proper steps -- I think that is why some are having issues with individual steps despite doing all that has been suggested! For me, it worked the first time.
Google Cloud Console (before doing anything in R):
First I registered an API key within the Google Cloud console following the link provided from @RomanAbashin -- I did not restrict the API key as suggested by Google (does anyone have any advice on this moving forward? I'd like to make it as secure as possible -- but still have it usable). I also made sure billing was turned on as suggested in many other posts -- it's free unless you are using it to pull large quantities of maps, but they want a credit card to 'make sure you aren't a robot'.
While in the Google Cloud Console, search for and enable the 'Geocoding API' and the 'Maps Static API'
From your Google Cloud Page Click 'APIs and Services' >> Library >> (To Filter: look in the left hand column under Category and scroll down to 'Maps' -- Click it >> Geocoding API should be in the first row (Enable It). (Repeat for 'Maps Static API', which is in the 3rd row)
From the 'Credentials' menu you can Copy your API key to the clipboard.
Onward to R!
I reinstalled ggmap using @dkahle code here: (Link: #51 (comment)) :
devtools::install_github("dkahle/ggmap", ref = "tidyup")
I rebooted R
Loaded ggmap library (copy-paste API from Google Cloud Console):
library(ggmap)
register_google(key = 'copy-API-key-from-GoogleConsole')
Run my code again. It works!
@sabahzero have you had any luck over the last few days?
From your code linked above on your github:
# Create zoomed-in map (main figure) Zoom=get_map(location=c(-116.9685,32.22644,-116.9241,32.26755), maptype="roadmap")
Sidenote: I didn't change my command for 'get_map()' as suggested in some other posts and it still works for me. I think if you can do all that is required for the API steps and register it, reinstall ggmap with the above command, reboot R, load ggmap, register your API key, and rerun your code you should have success!
Try following my steps listed above or visit @RomanAbashin's comment that I linked to. He has a link to Google's page with info about properly setting up your API with billing and all.
After writing this, I dug through the comments more and I see much of this is also summarized here:
(#51 (comment)).
Thanks much to @dkahle & @RomanAbashin! Plus many others who have been troubleshooting! You made this one easy for me to fix with manuscript reviews due in a couple of days!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
For those who it might help, I updated my ggmap tutorial to include the google cloud platform steps with screenshots to create the service, get an api key and apply it. https://www.littlemissdata.com/blog/maps @dkahle thank you so much for your awesome package and all the support you've been giving. @full6186 great summary above. |
The little miss data tutorial, followed the code religiously and it worked very well until I got to 9a. (Thanks Little Miss. Really very well done.) At Map 9a, I started getting the "403" error and that has not stopped with many re-attempts. Now, none of the map code works. I've followed all the suggestions above, including re-installing, rebooting, using my API, etc. Still "403". Any help would be great. |
@RomanAbashin, @dkahle but i have problem again, I will really appreciate you if you can help me. |
Hi @atenaeslami – I've been working on ggmap quite a bit recently. Please re-install using: bbox <- c(left = -97.1268, bottom = 31.536245, right = -97.099334, top = 31.559652)
ggmap(get_stamenmap(bbox, zoom = 13)) That should work regardless of Google stuff. Does it? If not, please report your input and output. To test whether your Google setup is working properly, I suggest two things. First, use |
@dkahle
Please download and install Rtools 3.5 from http://cran.r-project.org/bin/windows/Rtools/. checking for file 'C:\Users\negin\AppData\Local\Temp\RtmpAxw6BI\remotesce4708ee17\dkahle-ggmap-e55c0b2/DESCRIPTION' ... checking for file 'C:\Users\negin\AppData\Local\Temp\RtmpAxw6BI\remotesce4708ee17\dkahle-ggmap-e55c0b2/DESCRIPTION' ... √ checking for file 'C:\Users\negin\AppData\Local\Temp\RtmpAxw6BI\remotesce4708ee17\dkahle-ggmap-e55c0b2/DESCRIPTION' (1.1s)
√ checking DESCRIPTION meta-information
I need the Iran and Turkey maps near together. How i must order it? Would you please tell me how? Kind Regards |
When I use it appears that How can I deal with this problem? Thanks |
Hi @atenaeslami – I'm not familiar with that warning on the install; I'd just suggest some Google searching. Looks like you're getting tiles from Stamen; you probably just need the proper bounding box, no? @jncai – Thanks for the post/email. That doesn't appear to be a ggmap problem: for some reason, you aren't able to get what you need from GitHub. Ordinarily I associate that error with you not being online, but I'm assuming you covered that base already (obviously you were online at the time of this post). Can you download any file off the internet from within R? |
Just wanted to update the additions to the read.me and comments here resolved all my troubles, thank you! |
Hi @dkahle |
Dear Dkahle
I tried a lot to find the longitude and latitude of both Iran and Turkey so many times but i was unsuccessful to do that. would you please help me?
All the best, Atena
On Monday, January 28, 2019, 5:35:52 AM GMT+3:30, david kahle <notifications@github.com> wrote:
Hi @atenaeslami –
I've been working on ggmap quite a bit recently. Please re-install using: devtools::install_github("dkahle/ggmap") (no tidyup). After that, re-start R and reload ggmap. Then, try something simple, like:
bbox <- c(left = -97.1268, bottom = 31.536245, right = -97.099334, top = 31.559652)
ggmap(get_stamenmap(bbox, zoom = 13))
That should work regardless of Google stuff. Does it? If not, please report your input and output.
To test whether your Google setup is working properly, I suggest two things. First, use google_key() to check if you have an API key. If you get NA, it won't work, and you'll need to use register_google() to register your key; see the main GitHub page for details. Once you've registered it, try something like geocode("the white house"). It should be clear if it's working properly or not from that point. If not, let me know with input/output. Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@atenaeslami ,
just use a free service like https://www.latlong.net/
… |
Dear Dkahle
So many thanks for the prompt answer.Iran: Latitude: 32.427910/ Longitude: 53.688046Turkey: Latitude: 38.963745/ Longitude: 35.243320
Then, how i must replace them in the following command?? and i think it is better to change the zoom to 5, is it good?
bbox <- c(left = -97.1268, bottom = 31.536245, right = -97.099334, top = 31.559652)
ggmap(get_stamenmap(bbox, zoom = 13))
All the best, Atena
On Wednesday, March 6, 2019, 4:47:54 PM GMT+3:30, Roman Abashin <notifications@github.com> wrote:
@atena,
just use a free service like https://www.latlong.net/
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@CaperKen - I think the issue is that while you might have added a credit card, your API key is associated with a project that does not have billing set up. I had the same thing happen and it was fixed when I added billing to the project. You can test if this is your issue by running the code up to 9a. The next day try to run from 9a on, it should work. You may have to reload the data and the libraries. From what I can tell they allow one api call daily for accounts without active billing set up. All the code up to 9a is using one base googlemap graph (p). It then has to update in 9a, 9b, 10a, 10b b/c we are modifying the graph displayed to have different visuals. Please let me know if this works. |
I am trying to grab a map like this:
get_map(location = c(6.815375, 51.217942), zoom = 11, source = "osm")
Following error occures:
Error in download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") :
can't open URL 'http://maps.googleapis.com/maps/api/staticmap?center=51.217942,6.815375&zoom=11&size=%20640x640&maptype=terrain&sensor=false'
And an additional warning:
W
In download.file(url, destfile = destfile, quiet = !messaging, mode = "wb") :
cannot open: HTTP status was '403 Forbidden'
Why does ggmap query google, although source is set to "osm" ? And why is the status 403 forbidden?
The text was updated successfully, but these errors were encountered: