I do not understand the function behaviour. I am giving the function a point B that is North of point A so I would expect something around 90 degrees but I get 263 degrees instead. In another example, I keep the same point A and I am giving the function a point B that is on the South of point A and this time I do get a correct value of 279 degrees.
The function definition states that it is using the horizontal of the vector between A and B. But I don't understand the part which says:
Angle is computed clockwise from down-to-up: on the clock: 12=0; 3=PI/2; 6=PI; 9=3PI/2.
Here are the examples, maybe I am doing something wrong with the SQL point b NE of point A:
SELECT degrees(
ST_Azimuth(
ST_Transform(ST_GeomFromText('POINT(127.702 38.169)',4326),32652),
ST_Transform(ST_GeomFromText('POINT(126.728 38.178)',4326),32652)
)
)
This returns 271 degrees whilst it should return ~45 degrees
Someone care to explain? Thanks in advance!