Skip to content

Instantly share code, notes, and snippets.

@vnijs
Forked from expersso/google_maps_with_rvest
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vnijs/217ce1ae223022b113a0 to your computer and use it in GitHub Desktop.
Save vnijs/217ce1ae223022b113a0 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"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment