jiayuasu opened a new issue, #2798: URL: https://github.com/apache/sedona/issues/2798
## Summary Add `ST_ShortestLine(geom1, geom2)` function that returns the shortest `LineString` connecting two geometries. This is the PostGIS equivalent of [`ST_ShortestLine`](https://postgis.net/docs/ST_ShortestLine.html). **Parent issue:** #2230 ## Design JTS already provides `DistanceOp.nearestPoints()` which returns the two nearest `Coordinate`s between two geometries. Sedona already uses this in `ST_ClosestPoint` (returns only the first point). `ST_ShortestLine` constructs a `LineString` from both points instead. ### Signature ```sql ST_ShortestLine(geometry g1, geometry g2) → geometry (LineString) ``` ### Implementation layers 1. **Java core** (`Functions.java`): Thin wrapper around `DistanceOp.nearestPoints()`, returning a `LineString` 2. **Scala Expression** (`Functions.scala`): `InferredExpression` case class 3. **Catalog registration** (`Catalog.scala`) 4. **Scala API** (`st_functions.scala`): Column wrappers 5. **Python API** (`st_functions.py`): Python wrapper 6. **Tests**: Scala + Python ### Example ```sql SELECT ST_ShortestLine( ST_GeomFromWKT('POINT(0 0)'), ST_GeomFromWKT('POINT(3 4)') ); -- LINESTRING (0 0, 3 4) ``` ## Edge cases - Empty geometries should return `null` - Identical geometries should return a zero-length line (degenerate `LineString` or `POINT`) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
