Skip to content
🎉 Apache Sedona 1.8.1 is now available! Check out the new features and improvements.

ST_LongestLine

Introduction: Returns the LineString geometry representing the maximum distance between any two points from the input geometries.

Format: ST_LongestLine(geom1: Geometry, geom2: Geometry)

Since: v1.6.1

SQL Example:

SELECT ST_LongestLine(
        ST_GeomFromText("POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))"),
        ST_GeomFromText("POLYGON ((10 20, 30 30, 40 20, 30 10, 10 20))")
)

Output:

LINESTRING (40 40, 10 20)