-
-
Save nqbao/b5c5a5f99b5c0e135b40b9c3667b774d to your computer and use it in GitHub Desktop.
Latitude/Longitude to FIPS Codes via the FCC's API
This file contains 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
# FCC's Census Block Conversions API | |
# http://www.fcc.gov/developers/census-block-conversions-api | |
latlong2fips <- function(latitude, longitude) { | |
url <- "http://data.fcc.gov/api/block/find?format=json&latitude=%f&longitude=%f" | |
url <- sprintf(url, latitude, longitude) | |
json <- RCurl::getURL(url) | |
json <- RJSONIO::fromJSON(json) | |
as.character(json$County['FIPS']) | |
} | |
# Orange County | |
latlong2fips(latitude=28.35975, longitude=-81.421988) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment