Skip to content

Instantly share code, notes, and snippets.

@sckott
Forked from expersso/google_maps_with_rvest
Last active August 29, 2015 14:21
Show Gist options
  • Save sckott/a65ac7e56b7b3f746913 to your computer and use it in GitHub Desktop.
Save sckott/a65ac7e56b7b3f746913 to your computer and use it in GitHub Desktop.
library(dplyr); library(httr); library(rvest)
addr <- "Big Ben"
GET("http://maps.google.com/maps/api/geocode/xml",
query = list(address = addr)) %>%
content() %>%
html_nodes(xpath = "//location//lat | //location//lng") %>%
html_text() %>%
setNames(c("lng", "lat"))
head(mtcars)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment