Retrieving geographical location information in R using OpenStreetMap Nominatim API
# http://louhos.github.com/sorvi/asennus.html library(sorvi) geocode <- GetGeocodeOpenStreetMap("Eduskuntatalo") geocode
xy2lonlat <- function (x, y) project(with(d, cbind(x, y)), "+proj=utm +zone=35 ellps=WGS84", inv=T) wgs84.coordinates <- xy2lonlat()
# Define your IP # Use this to check on your own computer # x <- system("ifconfig", intern=TRUE) # use ipconfig in Windows # ip <- gsub(".*? ([[:digit:]])", "\\1", x[grep("IPv4", x)]) #curl icanhazip.com #curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.]*\).*/\1/g' #host -t a dartsclink.com | sed 's/.*has address //' #curl curlmyip.com #curl ifconfig.me # this has a lot of different alternatives too, such as ifconfig.me/host #ip <- "137.224.252.10" # Check your IP (requires curl) system("curl icanhazip.com") ip <- system("curl icanhazip.com", intern = TRUE) # Check IP location iploc <- ip_location(ip) # OpenStreetMap Leaflet # require(devtools); install_github('rCharts', 'ramnathv') library(rCharts) map <- Leaflet$new() map$setView(iploc, zoom = 17) map$marker(iploc, bindPopup = "<p> rOpenGov was here! </p>") #map$print("nvd3Hist") print(map)
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.