Hi there,
I have seabird tracking data and I have used both the packages 'trip' and 'move' to calculate the max distance travelled (using the function 'homedist' in 'trip', and 'distanceSummary' in 'move'). I would also like to describe the bearing of each animal when it is at its maximum displacement from the colony. I am wondering if anyone knows any packages that can calculate this. Alternatively, if someone knows how I can extract the coordinates of the location of maximum displacement. thanks so much! [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
You can convert a "trip" object to a SpatialPointsDataFrame with
as("SpatialPointsDataFrame",my_trip). Then you can use functions like "spDistsN1" from sp to compute the distance from "home" to each point, find the maximum, and then use "bearing" from the "geosphere" package to get the bearing for that row. A complication I see is that this will only return the maximum distance to a vertex point on the trip. For a trip in two flat dimensions the maximum distance will always be a vertex point on the trip but I think on a sphere its possible for great circles between two points to have a location on the circle that is further from a given point than either of the end points. But I can't get my head quite round the 3d triangular geometry this early in the morning. For small steps in a trip where you can approximate the geometry as flat this is not a problem. In contrast, the minimum distance from a trip to a "home" point is rarely a vertex point on the trip because its possible for the trip path to go very close to the home point in question. e.g a trip from (10,0) to (-10,0) goes right through (0,0) but its points are both 10 units away. Barry On Wed, Aug 2, 2017 at 7:25 PM, Alice Domalik <[hidden email]> wrote: > Hi there, > > I have seabird tracking data and I have used both the packages 'trip' and 'move' to calculate the max distance travelled (using the function 'homedist' in 'trip', and 'distanceSummary' in 'move'). > I would also like to describe the bearing of each animal when it is at its maximum displacement from the colony. I am wondering if anyone knows any packages that can calculate this. Alternatively, if someone knows how I can extract the coordinates of the location of maximum displacement. > > thanks so much! > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > [hidden email] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
Also, trip is really outdated and dopey and homedist is likely not working
properly, very happy to help find he answers here there are many options. Cheers, [hidden email] On Thu, 3 Aug 2017, 17:27 Barry Rowlingson, <[hidden email]> wrote: > You can convert a "trip" object to a SpatialPointsDataFrame with > as("SpatialPointsDataFrame",my_trip). Then you can use functions like > "spDistsN1" from sp to compute the distance from "home" to each point, > find the maximum, and then use "bearing" from the "geosphere" package > to get the bearing for that row. > > A complication I see is that this will only return the maximum > distance to a vertex point on the trip. For a trip in two flat > dimensions the maximum distance will always be a vertex point on the > trip but I think on a sphere its possible for great circles between > two points to have a location on the circle that is further from a > given point than either of the end points. But I can't get my head > quite round the 3d triangular geometry this early in the morning. For > small steps in a trip where you can approximate the geometry as flat > this is not a problem. > > > > In contrast, the minimum distance from a trip to a "home" point is > rarely a vertex point on the trip because its possible for the trip > path to go very close to the home point in question. e.g a trip from > (10,0) to (-10,0) goes right through (0,0) but its points are both 10 > units away. > > Barry > > > > > On Wed, Aug 2, 2017 at 7:25 PM, Alice Domalik <[hidden email]> wrote: > > Hi there, > > > > I have seabird tracking data and I have used both the packages 'trip' > and 'move' to calculate the max distance travelled (using the function > 'homedist' in 'trip', and 'distanceSummary' in 'move'). > > I would also like to describe the bearing of each animal when it is at > its maximum displacement from the colony. I am wondering if anyone knows > any packages that can calculate this. Alternatively, if someone knows how I > can extract the coordinates of the location of maximum displacement. > > > > thanks so much! > > > > [[alternative HTML version deleted]] > > > > _______________________________________________ > > R-sig-Geo mailing list > > [hidden email] > > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > _______________________________________________ > R-sig-Geo mailing list > [hidden email] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > Dr. Michael Sumner Software and Database Engineer Australian Antarctic Division 203 Channel Highway Kingston Tasmania 7050 Australia [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
Dear Alice,
Since Move inherits a SpatialPointsDataFrame the finding the location furthers away can be done as follows (under the assumption the data are longlat and the caveat pointed out by Barry): > require(move) > data(leroy) > which.max(spDistsN1(leroy, c(-40,40), longlat=T)) [1] 600 Best Bart On 03.08.2017 10:00, Michael Sumner wrote: > Also, trip is really outdated and dopey and homedist is likely not working > properly, very happy to help find he answers here there are many options. > > Cheers, [hidden email] > > > On Thu, 3 Aug 2017, 17:27 Barry Rowlingson, <[hidden email]> > wrote: > >> You can convert a "trip" object to a SpatialPointsDataFrame with >> as("SpatialPointsDataFrame",my_trip). Then you can use functions like >> "spDistsN1" from sp to compute the distance from "home" to each point, >> find the maximum, and then use "bearing" from the "geosphere" package >> to get the bearing for that row. >> >> A complication I see is that this will only return the maximum >> distance to a vertex point on the trip. For a trip in two flat >> dimensions the maximum distance will always be a vertex point on the >> trip but I think on a sphere its possible for great circles between >> two points to have a location on the circle that is further from a >> given point than either of the end points. But I can't get my head >> quite round the 3d triangular geometry this early in the morning. For >> small steps in a trip where you can approximate the geometry as flat >> this is not a problem. >> >> >> >> In contrast, the minimum distance from a trip to a "home" point is >> rarely a vertex point on the trip because its possible for the trip >> path to go very close to the home point in question. e.g a trip from >> (10,0) to (-10,0) goes right through (0,0) but its points are both 10 >> units away. >> >> Barry >> >> >> >> >> On Wed, Aug 2, 2017 at 7:25 PM, Alice Domalik <[hidden email]> wrote: >>> Hi there, >>> >>> I have seabird tracking data and I have used both the packages 'trip' >> and 'move' to calculate the max distance travelled (using the function >> 'homedist' in 'trip', and 'distanceSummary' in 'move'). >>> I would also like to describe the bearing of each animal when it is at >> its maximum displacement from the colony. I am wondering if anyone knows >> any packages that can calculate this. Alternatively, if someone knows how I >> can extract the coordinates of the location of maximum displacement. >>> thanks so much! >>> >>> [[alternative HTML version deleted]] >>> >>> _______________________________________________ >>> R-sig-Geo mailing list >>> [hidden email] >>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo >> _______________________________________________ >> R-sig-Geo mailing list >> [hidden email] >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo >> _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
In reply to this post by Alice Domalik
An alternative solution would be to use adehabitatLT to prepare your
trajectories. If you set them to start at the colony (i.e. the first location is at the colony), then you have nothing to do: - ltraj objects provide the squared net displacement (R2n), which you can use to find the furthest point from the colony (max R2n); - ltraj objects provide absolute and relative bearings for each point, and you already have the coordinates associated to it. Hope this helps, Mathieu. On 08/02/2017 02:25 PM, Alice Domalik wrote: > Hi there, > > I have seabird tracking data and I have used both the packages 'trip' and 'move' to calculate the max distance travelled (using the function 'homedist' in 'trip', and 'distanceSummary' in 'move'). > I would also like to describe the bearing of each animal when it is at its maximum displacement from the colony. I am wondering if anyone knows any packages that can calculate this. Alternatively, if someone knows how I can extract the coordinates of the location of maximum displacement. > > thanks so much! > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > [hidden email] > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > -- Mathieu Basille [hidden email] | http://ase-research.org/basille +1 954-577-6314 | University of Florida FLREC « Le tout est de tout dire, et je manque de mots Et je manque de temps, et je manque d'audace. » — Paul Éluard -- Mathieu Basille [hidden email] | http://ase-research.org/basille +1 954-577-6314 | University of Florida FLREC « Le tout est de tout dire, et je manque de mots Et je manque de temps, et je manque d'audace. » — Paul Éluard _______________________________________________ R-sig-Geo mailing list [hidden email] https://stat.ethz.ch/mailman/listinfo/r-sig-geo |
Free forum by Nabble | Edit this page |