Last active
September 21, 2016 02:07
-
-
Save ellisvalentiner/3abd6563c7edf4e03fc562629df76a40 to your computer and use it in GitHub Desktop.
Basic format for Google Maps geocoder API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
baseurl = "https://maps.googleapis.com/maps/api/geocode/json" | |
res <- GET(baseurl, query=list(address = "1600 Amphitheatre Parkway, Mountain View, CA", key = Sys.getenv("GOOGLE_MAPS_KEY"))) | |
content(res)$results[[1]]$address_components[[7]]$short_name | |
lat = content(res)$results[[1]]$geometry$location$lat | |
lng = content(res)$results[[1]]$geometry$location$lng |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment