获得一个线段的轴承(角度)的最简单方法是什么?

dan*_*dan 4 postgresql postgis

在PostGIS/PostgreSQL中,是否有一个函数可以给出给定点所在的线串的线段角度?

elr*_*bis 5

在PostGIS版本1.5.3上,ST_Azimuth()需要两个点作为输入 - 就我所知,所有版本都是true - 我只是使用ST_Line_Interpolate_Point()从行中提取 ,如下所示:

ST_Azimuth(
  ST_Line_Interpolate_Point(wkb_geometry, 0.2), /* point at 20% length */
  ST_Line_Interpolate_Point(wkb_geometry, 0.8)  /* point at 80% length */
)/(2*pi())*360 as angle                         /* radians to degrees  */
Run Code Online (Sandbox Code Playgroud)