Skip to content

Instantly share code, notes, and snippets.

@StevenMMortimer
Created September 15, 2016 02:04
Show Gist options
  • Save StevenMMortimer/61ca2c184ebaf59015097d4d9107194a to your computer and use it in GitHub Desktop.
Save StevenMMortimer/61ca2c184ebaf59015097d4d9107194a to your computer and use it in GitHub Desktop.
options(stringsAsFactors = FALSE)
library(rjson)
library(RDSTK)
street2coordinates <- function (address, session = getCurlHandle())
{
api <- paste(getOption("RDSTK_api_base"), "/street2coordinates/",
sep = "")
get.addy <- getURL(paste(api, URLencode(address), sep = ""),
curl = session)
result <- ldply(rjson::fromJSON(get.addy), data.frame)
names(result)[1] <- "full.address"
return(result)
}
# this is the address of Slover Library
slover_address <- '235 E Plume St, Norfolk, VA 23510'
street2coordinates(slover_address)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment