st_exteriorring
function
Applies to: Databricks SQL
Databricks Runtime 17.2 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 exterior ring of the input polygon as a linestring.
Syntax
st_exteriorring ( geoExpr )
Arguments
geoExpr
: AGEOGRAPHY
orGEOMETRY
value.
Returns
A value of the same type as geoExpr
. The function returns an empty linestring if the input is an empty polygon. Otherwise, the function returns the exterior ring of the polygon as a (closed) linestring. The SRID of the output value is equal to that of the input value.
Notes
The function returns NULL
if the input is NULL
.
Error conditions
- If
geoExpr
is not a polygon, the function returns ST_INVALID_ARGUMENT.INVALID_TYPE.
Examples
SQL
-- Example taking an empty 2D polygon GEOMETRY.
> SELECT st_asewkt(st_exteriorring(st_geomfromtext('POLYGON EMPTY')));
LINESTRING EMPTY
-- Example taking an empty 2D polygon GEOMETRY with one empty ring.
> SELECT st_asewkt(st_exteriorring(st_geomfromtext('POLYGON(EMPTY)')));
LINESTRING EMPTY
-- Example taking a 2D polygon GEOMETRY with one non-empty ring.
> SELECT st_asewkt(st_exteriorring(st_geomfromtext('POLYGON((0 0,10 0,0 10,0 0))', 3857)));
SRID=3857;LINESTRING(0 0,10 0,0 10,0 0)
-- Example taking a 3DZ polygon GEOGRAPHY with two rings.
> SELECT st_asewkt(st_exteriorring(st_geogfromtext('POLYGON Z ((0 0 -1,10 0 -2,0 10 -3,0 0 -1),(1 1 -5,4 1 -6,1 4 -7,1 1 -5))')));
SRID=4326;LINESTRING Z (0 0 -1,10 0 -2,0 10 -3,0 0 -1)
-- Example taking a NULL input.
> SELECT st_exteriorring(NULL);
NULL