Skip to content
πŸŽ‰ SedonaDB 0.4.0 is out now! πŸ—ΊοΈ Python DataFrame API, R dplyr, Geography support & GPU-accelerated spatial joins. Read the release blog β†’

ST_LongestLine

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

ST_LongestLine

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

Return type: 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)