Skip to main content
100%

Finding longest path between two geoms

✓ Published0🌍 Public
Aandrewxhill
Last edited Jan 7, 2012
Created on Jan 7, 2012

This example computes the longest straight-line distance between two geographic geometries: a point near the UK coast and a line formed by the union of two points further south. It uses PostGIS functions `ST_LongestLine` and `ST_SetSRID` to construct the geometries and find the connecting line, then `ST_Distance_Sphere` calculates the great-circle distance in meters. The SQL query reveals the underlying spatial computation, showing how PostGIS can determine the maximum separation between a point and a multi-point geometry on a spherical Earth model.

AI-generated description

Similar vizzes