Fork me on GitHub

ST_FurthestCoordinate

Signatures

{POINT, MULTIPOINT} ST_FurthestCoordinate(POINT point, GEOMETRY geom);

Description

Returns the coordinate of geom furthest from point using 2D distances (z-coordinates are ignored).

What if the furthest coordinate is not unique?

Then all furthest coordinates are returned in a MULTIPOINT.

Examples

SELECT ST_FurthestCoordinate('POINT(0 0)',
                             'POLYGON((2 2, 10 0, 10 5, 0 5, 2 2))');
-- Answer: POINT(10 5)

SELECT ST_FurthestCoordinate('POINT(5 2.5)',
                             'LINESTRING(3 1, 2 2, 2 4, 4 5)');
-- Answer: POINT(2 4)

SELECT ST_FurthestCoordinate('POINT(5 2.5)',
                             'POLYGON((0 0, 10 0, 10 5, 0 5, 0 0))');
-- Answer: MULTIPOINT((10 5), (0 0), (0 5), (10 0))

See also