[postgis-users] Calculate accumulative bearing given a zig-zagging line

Shaozhong SHI shishaozhong at gmail.com
Sat Feb 19 09:51:09 PST 2022


On Thursday, 17 February 2022, Sandro Santilli <strk at kbt.io> wrote:

> On Thu, Feb 17, 2022 at 08:21:24AM +0000, Shaozhong SHI wrote:
> > Is there a function for calculating accumulative bearing given a
> > zig-zagging line?
> >
> > If we set a segment to travel towards north and its bearing is 0. Next
> > segment may zig-zag towards 10 degrees.  The following one may zig-zag
> > towards -5 degree.
> >
> > Calculating accumulative bearing may assist us to check whether a line
> does
> > a U-turn.  If accumulative bearing is greater than 180, it is a U-turn.
> >
> > Is there such function available?
>
> You can use ST_Azimuth, some normalization routine to turn the radians
> into a signed value and the sum aggregate to "accumulate" it.
>
> --strk;
> This is interesting.  Can you expand and do a demo?

Regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20220219/76de0011/attachment.html>


More information about the postgis-users mailing list