<div dir="ltr"><div>Hi guys,</div><div><br></div><div>I'm still trying to solve my deal. How I can join the survey boat points using the shortestpath function, to avoid the land. It's important because I need an output "spatialLines"(boat surveys) to intersect with points( species points). </div><div>I add several files : script and other layers of information.</div><div><br></div><div>Thanks in advance,</div><div><br></div><div>Marta</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-01-16 9:45 GMT-01:00 marta azores <span dir="ltr"><<a href="mailto:martazores@gmail.com" target="_blank">martazores@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Jerome,</div><div><br></div><div>There are several R packages to join points. However, I have two relevant issues with them.</div><div> -The first, I need to get the "Lines" from these tracks in "spatial Lines". For example, in the adehabitatLT package you can get easily the trajectories of the animal but with the class " ltraj". I don't know </div><div> how transform this object class into spatial lines.</div><div>-The second, when I made the tracks I need to avoid the coast, and I don't know how do that in adehabitatLT.</div><div><br></div><div>Any idea?</div><div><br></div><div>Thanks for your suggestions,</div><div><br></div><div>Marta</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-01-14 15:21 GMT-01:00 Roland Harhoff <span dir="ltr"><<a href="mailto:roland.harhoff@uni-muenster.de" target="_blank">roland.harhoff@uni-muenster.<wbr>de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Marta,<br>
<br>
and did you check the trajectories package ...?<br>
<br>
<a href="https://cran.r-project.org/web/packages/trajectories/index.html" target="_blank" rel="noreferrer">https://cran.r-project.org/web<wbr>/packages/trajectories/index.<wbr>html</a><br>
<br>
Cheers!<br>
Roland<br>
<div><div class="m_-6771118843860165817h5"><br>
<br>
Jérome Mathieu schrieb am 2017-01-14:<br>
> Hi,<br>
<br>
> Did you have a look at the package adehabitatLT?<br>
<br>
> <a href="https://cran.r-project.org/web/packages/adehabitatLT/vignettes/adehabitatLT.pdf" target="_blank" rel="noreferrer">https://cran.r-project.org/web<wbr>/packages/adehabitatLT/vignett<wbr>es/adehabitatLT.pdf</a><br>
<br>
> It deals with trajectories based on points ordered by date.<br>
<br>
> Jerome<br>
<br>
<br>
> 2017-01-13 11:41 GMT+01:00 marta azores <<a href="mailto:martazores@gmail.com" target="_blank">martazores@gmail.com</a>>:<br>
<br>
> > Thanks for your quick reply to my question,<br>
> ><br>
> > This ten points are ordered by time (date + time), and I know ,the points<br>
> > are all connected. I didn't include the column with the time in this<br>
> > example, to make it simple.<br>
> ><br>
> > After read your messages, I was looking the minimum spanning tree for the<br>
> > vertices.<br>
> > The advantage with the function "shortestPath" is that you have as result a<br>
> > spatial line output, which I need it.<br>
> > However, the minimum spanning tree give as output an ordiplot.<br>
> ><br>
> > Is it possible to transform the ordiplot into spatialLines?<br>
> ><br>
> > Thanks for your answers<br>
> ><br>
> > Marta<br>
> ><br>
> ><br>
> ><br>
> > 2017-01-12 20:03 GMT-01:00 Eric Carr <<a href="mailto:carr@nimbios.org" target="_blank">carr@nimbios.org</a>>:<br>
> ><br>
> > > Generically independent of R, A graph and the connectivity between points<br>
> > > needs defined before a shortest path algorithm can be applied. If it<br>
> > > assumes all points are connected, than the shortest path will be a<br>
> > straight<br>
> > > line. What you are looking for is some sort of minimum spanning tree<br>
> > for<br>
> > > the vertices.<br>
> > > Eric<br>
> > ><br>
> > > On Thu, Jan 12, 2017 at 11:17 AM, marta azores <<a href="mailto:martazores@gmail.com" target="_blank">martazores@gmail.com</a>><br>
> > > wrote:<br>
> > ><br>
> > >> Dear forum members,<br>
> > >><br>
> > >> I would like to know how join several points with the aim to track a<br>
> > ship.<br>
> > >><br>
> > >> After reading the documentation of some packages, I decided to use the<br>
> > >> function shortestPath, but I only got the line between the first and the<br>
> > >> last location of my points list. I need the complete survey, including<br>
> > also<br>
> > >> the middle points. I try a loop to build the survey of the boats using<br>
> > >> their locations, but It didn't work to me.<br>
> > >><br>
> > >><br>
> > >> Any idea?<br>
> > >><br>
> > >> Thanks in advance,<br>
> > >><br>
> > >> Marta<br>
> > >><br>
> > >> #script# it's also attached in a R.file: question loop2.R<br>
> > >> ##############################<wbr>############################<br>
> > >> #<br>
> > >> #raster# it's attached<br>
> > >> azoTS1<- raster("C:/Users/Documents/azo<wbr>TS1.tif")#wgs84<br>
> > >> #<br>
> > >> #10 points# it's attached<br>
> > >> boat <- read.table("C:/Users/Documents<wbr>/10pontos.csv", header=TRUE,<br>
> > >> sep=",", na.strings="NA", dec=".", strip.white=TRUE)#<br>
> > >> head(boat)<br>
> > >><br>
> > >> #raster to transitionlayer<br>
> > >> trCostS4<- transition(1/azoTS1, mean, directions=4)<br>
> > >><br>
> > >> # points to spatialpointsdataframe<br>
> > >> x=boat$Long1<br>
> > >> y=boat$Lat1<br>
> > >> coords = cbind(x, y)<br>
> > >> plot(coords)<br>
> > >> sp = SpatialPoints(coords, proj4string=CRS("+proj=longlat +ellps=WGS84<br>
> > >> +datum=WGS84"), bbox = NULL)<br>
> > >> sp<br>
> > >> spdf=SpatialPointsDataFrame(sp<wbr>,boat)<br>
> > >> spdf<br>
> > >> nrow(spdf)<br>
> > >> plot(sp,axes=TRUE)<br>
> > >> plot(spdf,add=TRUE, axes=TRUE)<br>
> > >><br>
> > >> #shortestpath<br>
> > >><br>
> > >> ## 1) this script only join the first point of the list and the last<br>
> > one,<br>
> > >> and the points in the middle are not used.<br>
> > >> CostpathSPdf <- shortestPath(trCostS4, spdf[1,], spdf[10,],<br>
> > >> output="SpatialLines")<br>
> > >> plot(CostpathSPdf,add=TRUE,axe<wbr>s=TRUE,col=2)#R_plot1.png (it's attached)<br>
> > >><br>
> > >> ## 2) this script didn't work to me<br>
> > >><br>
> > >> #first way from website: <a href="http://stackoverflow.com/quest" target="_blank" rel="noreferrer">http://stackoverflow.com/quest</a><br>
> > >> ions/8127066/loop-or-sapply-fu<wbr>nction-for-multiple-least-<br>
> > >> cost-analysis-in-r?answertab=a<wbr>ctive#tab-top<br>
> > >> for(i in 1:nrow(spdf)) {<br>
> > >> # Computation<br>
> > >> Costpath <- shortestPath(trCostS4, spdf[i,], spdf[10,],<br>
> > >> output="SpatialLines")<br>
> > >> plot(Costpath)<br>
> > >><br>
> > >> }<br>
> > >><br>
> > >> #Error in validObject(.Object) :<br>
> > >> #invalid class “SpatialLines” object: bbox should never contain infinite<br>
> > >> values<br>
> > >><br>
> > >> ______________________________<wbr>_________________<br>
> > >> R-sig-Geo mailing list<br>
> > >> <a href="mailto:R-sig-Geo@r-project.org" target="_blank">R-sig-Geo@r-project.org</a><br>
> > >> <a href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo" target="_blank" rel="noreferrer">https://stat.ethz.ch/mailman/l<wbr>istinfo/r-sig-geo</a><br>
> > >><br>
> > ><br>
> > ><br>
> ><br>
> > [[alternative HTML version deleted]]<br>
> ><br>
> > ______________________________<wbr>_________________<br>
> > R-sig-Geo mailing list<br>
> > <a href="mailto:R-sig-Geo@r-project.org" target="_blank">R-sig-Geo@r-project.org</a><br>
> > <a href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo" target="_blank" rel="noreferrer">https://stat.ethz.ch/mailman/l<wbr>istinfo/r-sig-geo</a><br>
> ><br>
<br>
<br>
<br>
> --<br>
</div></div>> Jérôme Mathieu <<a href="http://www.jerome-mathieu.com/" target="_blank" rel="noreferrer">http://www.jerome-mathieu.com<wbr>/</a>><br>
> Université Pierre & Marie Curie <<a href="http://www.upmc.fr/" target="_blank" rel="noreferrer">http://www.upmc.fr/</a>><br>
<span>> Institute of Ecology and Environmental Science (Paris)<br>
</span>> <<a href="https://ieesparis.ufr918.upmc.fr/" target="_blank" rel="noreferrer">https://ieesparis.ufr918.upmc<wbr>.fr/</a>><br>
<span class="m_-6771118843860165817im m_-6771118843860165817HOEnZb">> Team EERI<br>
<br>
> 4 place Jussieu<br>
> Tour 44-45, 5th floor, door 514<br>
> 75005 Paris<br>
<br>
> tel: 01 44 27 34 22<br>
<br>
</span><div class="m_-6771118843860165817HOEnZb"><div class="m_-6771118843860165817h5">> [[alternative HTML version deleted]]<br>
<br>
> ______________________________<wbr>_________________<br>
> R-sig-Geo mailing list<br>
> <a href="mailto:R-sig-Geo@r-project.org" target="_blank">R-sig-Geo@r-project.org</a><br>
> <a href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo" target="_blank" rel="noreferrer">https://stat.ethz.ch/mailman/l<wbr>istinfo/r-sig-geo</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>