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

ST_AddPoint

Introduction: RETURN Linestring with additional point at the given index, if position is not available the point will be added at the end of line.

Format:

ST_AddPoint(geom: Geometry, point: Geometry, position: Integer)

ST_AddPoint(geom: Geometry, point: Geometry)

Since: v1.0.0

SQL Example

SELECT ST_AddPoint(ST_GeomFromText("LINESTRING(0 0, 1 1, 1 0)"), ST_GeomFromText("Point(21 52)"), 1)

SELECT ST_AddPoint(ST_GeomFromText("Linestring(0 0, 1 1, 1 0)"), ST_GeomFromText("Point(21 52)"))

Output:

LINESTRING(0 0, 21 52, 1 1, 1 0)
LINESTRING(0 0, 1 1, 1 0, 21 52)