Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Removes the n-th point from the input linestring GEOGRAPHY
or GEOMETRY
.
Syntax
st_removepoint ( geoExpr, indexExpr )
Arguments
geoExpr
: AGEOGRAPHY
orGEOMETRY
value representing a linestring.indexExpr
: AnINTEGER
value indicating the 1-based position in the linestring of the point that should be removed.
Returns
A value of type GEOGRAPHY
or GEOMETRY
, representing the linestring after the point at the indexExpr
-th position has been removed.
The SRID value of the output linestring is equal to that of the input GEOGRAPHY
or GEOMETRY
value.
The dimension of the output linestring is the same as that of the input GEOGRAPHY
or GEOMETRY
value.
The function returns NULL
if any of the inputs is NULL
.
Error conditions
- If the value of
geoExpr
is not a linestring or is an empty linestring, the function returns ST_INVALID_ARGUMENT. - If the absolute value of the value of
indexExpr
is 0 or larger than the number of points in the linestring, the function returns ST_INVALID_INDEX_VALUE
Examples
-- Returns the linestring after removing the second point counting from the left.
> SELECT st_astext(st_removepoint(st_geomfromtext('LINESTRING(1 2,3 4,5 6)'), 2))
LINESTRING(1 2,5 6)
-- Returns the linestring after removing the first point counting from the right.
> SELECT st_asewkt(st_removepoint(st_geogfromtext('LINESTRING(1 2,3 4,5 6)'), -1))
SRID=4326;LINESTRING(1 2,3 4)