tmaptools
tmaptools copied to clipboard
No internet connection
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)
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
this issue still exist! connection has been checked using curl, but still reports no connection!
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
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!