st_boundary function
Applies to: Databricks Runtime 18.0 and above
Preview
This feature is in Public Preview.
注記
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.
Returns the boundary of the input GEOMETRY value as GEOMETRY value.
Syntax
st_boundary ( geoExpr )
Arguments
geoExpr: AGEOMETRYvalue.
Returns
Returns a GEOMETRY value representing the boundary of the input GEOMETRY value.
More precisely:
- If the input is a point, its boundary is the corresponding empty point.
- If the input is a multipoint, its boundary is the corresponding empty multipoint.
- If the input is a linestring, its boundary is the empty multipoint if it is closed, or the non-empty multipoint consisting of its two endpoints if it is not closed.
- If the input is a multilinestring, its boundary is the possibly empty multipoint that consists of all the boundary points of all its non-closed linestrings with odd parity (mod-2 rule).
- If the input is an empty polygon, its boundary is the corresponding empty multilinestring.
- If the input is a non-empty polygon with a single outer ring, its boundary is the linestring representing the outer ring.
- If the input is a non-empty polygon with both an outer and at least one inner ring, its boundary is a multilinestring containing the rings represented as linestrings.
- If the input is an empty multipolygon, its boundary is the corresponding empty multilinestring.
- If the input is a non-empty multipolygon with a single outer boundary, its boundary is the linestring representing this single outer boundary.
- If the input is a non-empty multipolygon with at least two polygon rings, its boundary is the multilinestring containing the linestrings representing the rings of the polygons.
- For collections, the boundary can be a multipoint, linestring, multilinestring, or a collection containing a multipoint and linestring/multilinestring.
The SRID value of the returned GEOMETRY value is equal to that of the input value.
Examples
SQL
> SELECT st_boundary(st_geomfromewkt('SRID=3857;POLYGON((0 0,10 0,10 10,0 10,0 0),(2 2,8 2,8 8,2 8,2 2))'));
SRID=3857;MULTILINESTRING((0 0,10 0,10 10,0 10,0 0),(2 2,8 2,8 8,2 8,2 2))