How can I (quickly) buffer a river centerline with constant width to compute banks?
Show older comments
I am developing a meandering river model. At each time step, centerline nodes are adjusted by a dx and dy value and the river moves about its floodplain. At some point, the bend of a river runs into another bend of the same river, causing a cutoff. In reality, the cutoff will occur when the banks intersect, not the centerline.
My problem is that my bank calculation method fails for segments with very high curvature (e.g. those that have just undergone a cutoff), but works sufficiently well elsewhere. I cannot figure out how else to generate my right and left banks to avoid this problem.
http://imgur.com/a/uHvRM for some images of the problem.
Here's what I'm doing:
Given a vector of X,Y centerline coordinates, I first calculate the downstream angle between the river centerline and the (arbitrary) valley centerline:
atan((Y2-Y1))/(X2-X1)). Actual code is
Xang = Xs(1:end-1);
Xang_plus1 = Xs(2:end);
Yang = Ys(1:end-1);
Yang_plus1 = Ys(2:end);
angles = atan2(Yang_plus1-Yang,Xang_plus1-Xang);
Once I compute these angles, I calculate the left and right banks using the following code:
Xl = Xs(1:end-1)-sin(pi-angles)*B;
Yl = Ys(1:end-1)-cos(pi-angles)*B;
Xr = Xs(1:end-1)+sin(pi-angles)*B;
Yr = Ys(1:end-1)+cos(pi-angles)*B;
Like I said before, this code works very well except where the curvature is high, ie where the river changes directions drastically.
I've tried different thresholding, smoothing, and regridding techniques but can't find a robust method. I've looked at bufferm, but not only did it not work correctly (user error, I'm sure), it took ~10 seconds. This is a routine I need to run at least twice per time step over 1000s of time steps, so a 10s subroutine is unacceptable.
Does anyone have any suggestions for how I can generate my riverbanks accurately and quickly, or do I have to resort to curvature-based thresholding?
Thanks for any help!
2 Comments
Image Analyst
on 5 Feb 2013
Some screenshots would help illustrate your situation.
Jon
on 5 Feb 2013
Accepted Answer
More Answers (1)
Chad Greene
on 26 Feb 2015
0 votes
The xy2sn function may be useful. Convert your river xy coordinates to along-flow and cross-flow components, make two lines as the original line +/- some cross-flow offset, then convert those two lines back to xy coordinates.
Categories
Find more on Parallel for-Loops (parfor) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!