diff --git a/CHANGELOG.md b/CHANGELOG.md index cf28321..db03fb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added +- PostGIS ST_LineSubstring support - PostGIS ST_LineFromEncodedPolyline support - PostGIS ST_LineLocatePoint support diff --git a/src/Database/PostgisFunctions/MagellanGeometryProcessingFunctions.php b/src/Database/PostgisFunctions/MagellanGeometryProcessingFunctions.php index 96e89e6..6dc78af 100644 --- a/src/Database/PostgisFunctions/MagellanGeometryProcessingFunctions.php +++ b/src/Database/PostgisFunctions/MagellanGeometryProcessingFunctions.php @@ -198,6 +198,17 @@ public static function lineMerge($geometry, bool|Expression|\Closure|null $direc return MagellanBaseExpression::geometry('ST_LineMerge', [GeoParam::wrap($geometry), $directed]); } + /** + * Computes the line which is the section of the input line starting and ending at the given fractional locations. The first argument must be a LINESTRING. The second and third arguments are values in the range [0, 1] representing the start and end locations as fractions of line length. The Z and M values are interpolated for added endpoints if present. + * + * + * @see https://postgis.net/docs/ST_LineSubstring.html + */ + public static function lineSubstring($geometry, float|Expression|\Closure $startFraction, float|Expression|\Closure $endFraction, ?GeometryType $geometryType = null): MagellanGeometryExpression + { + return MagellanBaseExpression::geometry('ST_LineSubstring', [GeoParam::wrap($geometry), $startFraction, $endFraction], $geometryType); + } + /** * Returns the smallest circle polygon that contains a geometry. *