<br><br>On Thursday, 17 February 2022, Sandro Santilli <<a href="mailto:strk@kbt.io">strk@kbt.io</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Feb 17, 2022 at 08:21:24AM +0000, Shaozhong SHI wrote:<br>
> Is there a function for calculating accumulative bearing given a<br>
> zig-zagging line?<br>
> <br>
> If we set a segment to travel towards north and its bearing is 0. Next<br>
> segment may zig-zag towards 10 degrees.  The following one may zig-zag<br>
> towards -5 degree.<br>
> <br>
> Calculating accumulative bearing may assist us to check whether a line does<br>
> a U-turn.  If accumulative bearing is greater than 180, it is a U-turn.<br>
> <br>
> Is there such function available?<br>
<br>
You can use ST_Azimuth, some normalization routine to turn the radians<br>
into a signed value and the sum aggregate to "accumulate" it.<br>
<br>
--strk;<br>This is interesting.  Can you expand and do a demo?
</blockquote><div>Regards, </div><div>David </div>