제목

ST_MaxDistance — 두 도형 사이의 2차원 최장 거리를 투영 단위로 반환합니다.

요약

float ST_MaxDistance(geometry g);

float ST_MaxDistance(geometry g1, geometry g2);

설명

두 도형 사이의 2차원 최장 거리를 투영 단위로 반환합니다. g1과 g2가 동일한 도형일 경우 이 함수는 해당 도형 내에서 서로 가장 멀리 있는 두 꼭짓점 사이의 거리를 반환합니다.

If only one geometry is provided, or g1 and g2 are the same geometry, returns the distance between the two vertices farthest apart in that geometry.

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

Enhanced: 3.7.0 - support for a single geometry input.

예시

포인트와 라인 사이의 최장 라인

Code
SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 0,0 2 )'::geometry);
래스터 출력
2
Figure
Geometry figure for visual-st-maxdistance-01
Code
SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 2,2 2 )'::geometry);
래스터 출력
2.82842712474619
Figure
Geometry figure for visual-st-maxdistance-02

Maximum distance between vertices of a single geometry.

Code
SELECT ST_MaxDistance('POLYGON ((10 10,10 0,0 0,10 10))'::geometry);
래스터 출력
14.142135623730951
Figure
Geometry figure for visual-st-maxdistance-03