Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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!

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

A point to the north will give an azimuth near 0 or 360.

When it is exactly to the north it will be 0 as it moves to the east it will become larger until is is 45 a NorthEast of your point, if you pull it down level with you and east it will be 90 or level and to the west will be 270. As it moves below you it will fall between 90 and 270 depending on how much to the east or west the point is.

Looking at your query I would say that the second point is west of the first one so 270 is about right.

share|improve this answer
add comment

There is a extract from my system :

SELECT degrees( 
    ST_Azimuth(u1.the_geom, u2.the_geom ) ) 
from units as u1, units as u2 where u1.serial='SOURCE' and u2.serial='TARGET' 

The behaviour of the function is : "what is the azimuth (bearing) of TARGET given a SOURCE?"

Consider NORTH is azimuth ZERO. So, SOUTH is 180, WEST is 270 and EAST is 90.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.