The ST_RemovePoint function takes a curve
and a point as input parameters and returns the given curve with all
points equal to the specified point removed from it. If the given
curve has Z or M coordinates, then the point must also have Z or M
coordinates. The resulting geometry is represented in the spatial
reference system of the given geometry.
If the given curve is empty, then an empty curve is returned.
If the given curve is null, or if the given point is null or empty,
then null is returned.
This function can also be called as a
method.
Syntax
Parameters
curve
A value of type ST_Curve or one of its subtypes that represents
the curve from which point is removed.
point
A value of type ST_Point that identifies the points that are removed
from curve.
Return type
db2gse.ST_Curve
Examples
Example 1
In the following example, two linestrings are added to the
SAMPLE_LINES table. These linestrings are used in the following examples.
SET CURRENT FUNCTION PATH = CURRENT FUNCTION PATH, db2gse
CREATE TABLE sample_lines (id INTEGER, line ST_LineString)
INSERT INTO sample_lines
VALUES (1,ST_LineString('linestring
(10 10, 5 5, 0 0, 10 0, 5 5, 0 10)', 0))
INSERT INTO sample_lines
VALUES (2, ST_LineString('linestring z
(0 0 4, 5 5 5, 10 10 6, 5 5 7, 0 0 8)', 0))
In the following examples, the lines of results have been
reformatted for readability. The spacing in your results will vary
according to your online display.
Example 2
The following example removes the point (5, 5) from the linestring
that has ID = 1. This point occurs twice in the linestring. Therefore,
both occurrences are removed.
SELECT CAST(ST_AsText (ST_RemovePoint (line, ST_Point(5, 5) ) )
AS VARCHAR(120) ) RESULT
FROM sample_lines
WHERE id = 1
The following example removes the point (5, 5, 5) from the
linestring that has ID = 2. This point occurs only once, so only that
occurrence is removed.
SELECT CAST (ST_AsText (ST_RemovePoint (line, ST_Point(5.0, 5.0, 5.0)))
AS VARCHAR(160) ) RESULT
FROM sample_lines
WHERE id=2
Results:
RESULT
-------------------------------------------------------------------------
LINESTRING Z ( 0.00000000 0.00000000 4.00000000, 10.00000000 10.00000000
6.00000000, 5.00000000 5.00000000 7.00000000, 0.00000000
0.00000000 8.00000000)