[postgis-users] degrees between points

Nicolas Ribot nicky666 at gmail.com
Wed Jan 16 09:06:45 PST 2008


> The following function seems to be the one:
>
> ST_azimuth(geometry, geometry)
> Returns the azimuth of the segment defined by the given Point
> geometries, or NULL if the two points are coincident. Return value is
> in radians.
>

Or azimuth():

select azimuth(geomfromtext('POINT (0 0)', 4326),
geomfromtext('POINT(90 90)', 4326));
      azimuth
-------------------
 0.785398163397448
(1 row)

or
select degrees(azimuth(geomfromtext('POINT (0 0)', 4326),
geomfromtext('POINT(90 90)', 4326)));
      degrees
-------------------
 45
(1 row)

Nicolas



More information about the postgis-users mailing list