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.
포인트와 라인 사이의 최장 라인
SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 0, 0 2 )'::geometry);
2
SELECT ST_MaxDistance('POINT(0 0)'::geometry, 'LINESTRING ( 2 2, 2 2 )'::geometry);
2.82842712474619
Maximum distance between vertices of a single geometry.
SELECT ST_MaxDistance('POLYGON ((10 10, 10 0, 0 0, 10 10))'::geometry);
14.142135623730951