Message-ID: <CAKmUXV_KwG72oZYZsztHtYUjFFKtKGtLziUoN+neQddq5jRzww@mail.gmail.com>
Date: 2016-06-17T18:15:42Z
From: Tom
Subject: Excluding coordinates that fall within a circle
In-Reply-To: <1628514766.23197020.1466184392035.JavaMail.zimbra@sfu.ca>
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:
> Hi List,
>
> I'm working with some bird tracking data, and to filter the data set, I need to exclude points taken at the colony.
> I would like to exclude coordinates from within a 500 meter radius of a point centered on the colony.
> However, as an R novice, I'm not sure how to accomplish this.
>
> My df looks like this:
>
> AnimalID Latitude Longitude Datetime
>
> Any suggestions would be greatly appreciated.
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.