Skip to content
Prev 361825 / 398506 Next

Excluding coordinates that fall within a circle

Tom
I'm no expert here but I have recently been playing with the package
'geosphere' it contains plenty of options to calculate distance
between two coordinates specified as lat and long.

install.packages('geosphere') # only needed once

library(geosphere)
coord1 <- c(43.60923,-79.322799)
coord2 <- c(43.683266,-79.323703)

distHaversine(coord1,coord2)

Once you have a vector of distances you can then filter your df

df <- df[df$distance < radius,]
On Fri, Jun 17, 2016 at 1:26 PM, Alice Domalik <adomalik at sfu.ca> wrote: