I have a shapefile of a section of river network (polyline) which I have read into R using the sp package to have a SpatialLinesDataFrame. I also have access to a terrain raster for the region in which the river section lies. I wish to find the mean direction of the river network (analogous to ArcGIS's Linear Directional Mean) but I want to keep it in R.

I can't see the function I want in the sp or rgdal or raster packages. Is there a package with the appropriate function in it?

PS. This (Is there an R alternative for ArcMap's linear directional mean tool?) question shows the brute force method using a table with x_start, x_end, y_start, y_end. Is there anything better than this? If not, how do I extract such a table from a SpatialLinesDataFrame?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.