Name

ST_Azimuth — 두 도형 사이의 2차원 최단 라인을 반환합니다.

Synopsis

float ST_Azimuth(geometry origin, geometry target);

float ST_Azimuth(geography origin, geography target);

설명

Returns the azimuth in radians of the target point from the origin point, or NULL if the two points are coincident. The azimuth angle is a positive clockwise angle referenced from the positive Y axis (geometry) or the North meridian (geography): North = 0; Northeast = π/4; East = π/2; Southeast = 3π/4; South = π; Southwest 5π/4; West = 3π/2; Northwest = 7π/4.

For the geography type, the azimuth solution is known as the inverse geodesic problem.

The azimuth is a mathematical concept defined as the angle between a reference vector and a point, with angular units in radians. The result value in radians can be converted to degrees using the PostgreSQL function degrees().

객체를 해당 객체의 수직축을 따라 이동시키기 위해 ST_Translate 함수와 방위각을 함께 이용할 때 방위각이 특히 유용합니다. 이런 내용의 예시를 보려면 Plpgsqlfunctions PostGIS wiki section 의 upgis_lineshift 단원을 살펴보십시오.

1.1.0 버전부터 사용할 수 있습니다.

개선 사항: 2.0.0 버전부터 지리형을 지원합니다.

개선 사항: 2.2.0 버전부터 회전타원체 측정시 정확도와 강력함을 향상시키기 위해 GeographicLib을 이용합니다. 이 새 기능의 장점을 취하려면 Proj 4.9.0 이상 버전이 필요합니다.

예시

도 단위의 도형 방위각

SELECT degrees(ST_Azimuth( ST_Point(25, 45),  ST_Point(75, 100))) AS degA_B,
       degrees(ST_Azimuth( ST_Point(75, 100), ST_Point(25, 45) )) AS degB_A;

      dega_b       |     degb_a
------------------+------------------
 42.2736890060937 | 222.273689006094

Blue: origin Point(25,45); Green: target Point(75, 100); Yellow: Y axis or North; Red: azimuth angle.

Blue: origin Point(75, 100); Green: target Point(25, 45); Yellow: Y axis or North; Red: azimuth angle.