Name

ST_MaxDistance — Retorna a maior distância 2-dimensional entre duas geometrias em unidades projetadas.

Synopsis

float ST_MaxDistance(geometry g);

float ST_MaxDistance(geometry g1, geometry g2);

Descrição

Retorna a distância 2-dimensional máxima entre duas geometrias em unidades projetadas. Se g1 e g2 forem a mesma geometria, a função retornará a distância entre os dois vértices mais longes um do outro naquela geometria.

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.

Disponibilidade: 1.5.0

Enhanced: 3.7.0 - support for a single geometry input.

Exemplos

Linha mais longa entre ponto e linha

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