r-tmap / tmaptools

Tools for thematic maps
GNU Lesser General Public License v3.0
42 stars 9 forks source link

No internet connection #31

Open andrewmaclachlan opened 3 years ago

andrewmaclachlan commented 3 years ago

Some of my students get a strange issue when using read_osm() of no internet connection, despite there being an internet connection. I'm not sure why this is happening. Code sample below, where BoroughDataMap is an sf of London Boroughs.

BoroughDataMap %>% st_bbox(.) %>% tmaptools::read_osm(., type = "osm", zoom = NULL)

Cam-in commented 2 years ago

Same when here: CBS_osm1 <- tmaptools::read_osm(CBS_bb, type="bing") for plotting a map with a satellite image as background.

I found how to test internet: out<-RCurl::url.exists("https://www.google.com") out

And even when out = TRUE if interrnet is available, I am not able to run tmaptools. Did you found a solution?? Thanks

silverbullet1472 commented 1 year ago

this issue still exist! connection has been checked using curl, but still reports no connection!

Licky939 commented 1 year ago

I solved this problem by setting up a proxy. Please refer to the following website https://support.posit.co/hc/en-us/articles/200488488-Configuring-R-to-Use-an-HTTP-or-HTTPS-Proxy In short, ①file.edit('~/.Renviron') ②Enter the following code to access this file, then save and exit http_proxy="http://127.0.0.1:7890" https_proxy="http://127.0.0.1:7890"

I am using clash, so the port is 7890(default)

③restart your rstudio then the function(tmaptools::read_osm) could work

mtennekes commented 1 year ago

This is the function that I wrote to check the internet connection for tmaptools:

tmaptools:::working_internet()

Please check if it works, and otherwise, suggestions for improvement most welcome!