Skip to content

Instantly share code, notes, and snippets.

@walkerke
Created September 6, 2016 00:19
Show Gist options
  • Save walkerke/65b7bdbf03764f08eb9c451f39c97f01 to your computer and use it in GitHub Desktop.
Save walkerke/65b7bdbf03764f08eb9c451f39c97f01 to your computer and use it in GitHub Desktop.
library(tigris)
library(sp)
library(geosphere)
library(mapview)
pdx_city_hall <- c(-122.6800162, 45.5149686)
mult <- tracts("OR", "Multnomah")
multxy <- coordinates(mult)
mult$dist <- distVincentyEllipsoid(multxy, pdx_city_hall)
# Check for accuracy
mapview(mult, zcol = "dist", legend = TRUE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment