The gdistance package in R is what you are looking for: https://cran.r-project.org/web/packages/gdistance/gdistance.pdf
https://cran.r-project.org/web/packages/gdistance/vignettes/gdistance1.pdf Best, Jason On Wed, Jan 25, 2017 at 5:22 AM, Tristan Bourgeois < tristan.bourge...@gmail.com> wrote: > Hi Mirza, > > Thanks for your quick answer. > > Actually I don't want to calculate distance between a point and the next > downstream one. > For example, if there are 4 sewage plant on a river and 7 measurment > stations,I want the distance between each sewage plant and each station. > (water pollution dispersion calculation). > So the flow direction is not that important in my case. The difficulty is > to get the distance between a point and another one following the river > polyline. > > In your case, you can add a raster layer with elevation values ans extract > the elevation for each point of your layer. Then, for each polyline it is > possible to define a flow direction. > Hope it will help you. > > > > > 2017-01-25 11:57 GMT+01:00 Mirza Cengic <mirzac...@gmail.com>: > > > Hi Tristan, > > > > I recently had to do something similar (calculating distance to the next > > downstream point), and I was not able to find a solution with R that > would > > deal with the direction of the flow. Perhaps someone who has deeper > > understanding of packages such as iGraph etc. might be able to find a > > solution, but I wasn't. > > I solved the problem with ArcMap, using HydroTools extension, where you > > need to define a geometric network that has a direction, and then the > > calculation is pretty straightforward with HydroTools (let me know if you > > need more info). > > I would prefer to have a scripted solution in an open-source software, > but > > this worked for me in any case. If anyone has a better way for solving > > this, I would love to see how! > > > > Cheers, > > Mirza. > > > > > > -- > Tristan Bourgeois > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > > -- ---------------------------------------------------------------------------------- Jason Romine, Ph.D. Fish and Wildlife Biologist U.S. Fish & Wildlife Service Mid-Columbia River National Wildlife Refuge Complex 64 Maple St Burbank, WA 99323 Cell: 509-792-0123 https://www.fws.gov/mcriver/ Projects, publications, CV <https://jasongromine.wordpress.com/> ---------------------------------------------------------------------------------- [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo