tmaptools icon indicating copy to clipboard operation
tmaptools copied to clipboard

No internet connection

Open andrewmaclachlan opened this issue 3 years ago • 4 comments

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)

andrewmaclachlan avatar Oct 15 '21 11:10 andrewmaclachlan

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

Cam-in avatar Jun 14 '22 00:06 Cam-in

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

silverbullet1472 avatar Dec 06 '22 08:12 silverbullet1472

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

Licky939 avatar Jan 19 '23 15:01 Licky939

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!

mtennekes avatar Jan 20 '23 13:01 mtennekes