Plot line with points at given distance

14 views (last 30 days)
Hi all,
I need to find a way to plot markers along a line (river course; attached file) with a given distance, e.g. each 500m.
Is there a way to extract these values. The find function does not work in this situation since I only get an empty double column vector. I've used the TopoToolbox before, so the dataset is a STREAMobj which might be diffucult to read for one who hasn't the toolbox installed.
I tried to plot new points with spacing, but since the river is not smoothed and also should not be, point spacing starts and every new edge.
hold on
spacing = 500;
In advance thanks for your help.
Ricco Blass
Ricco Blass on 19 Feb 2022
Yes I updated my question. Should have mentioned that before.

Sign in to comment.

Accepted Answer

Wolfgang Schwanghart
Wolfgang Schwanghart on 25 Feb 2022
Since you are working with TopoToolbox, you might want to use the function getlocation. If you have a STREAMobj S, then you can retrieve points at a distance of 500 m as follows:
DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
FD = FLOWobj(DEM);
S = STREAMobj(FD,'minarea',1000);
S = klargestconncomps(trunk(S));
[x,y,val] = getlocation(S,[0:500:max(S.distance)]);
hold on
plot(x,y,'ok','MarkerFaceColor',[.5 .5 .5])
axis image
  1 Comment
Ricco Blass
Ricco Blass on 26 Feb 2022
That's exactely what I was looking for.
Thanks a lot!!

Sign in to comment.

More Answers (1)

Catalytic on 19 Feb 2022


Find more on Line Plots 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!