st_exteriorring
Preview
This feature is in Public Preview.
Returns the exterior ring (shell), as a linestring, of the input Geography or Geometry value representing a polygon. The SRID and dimension are preserved.
For the corresponding Databricks SQL function, see st_exteriorring function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.st_exteriorring(col=<col>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
|
Notes
Input value is expected to represent a polygon, otherwise an error is returned.
Examples
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POLYGON EMPTY', 'POLYGON((0 0,10 0,0 10,0 0))', 'POLYGON ZM ((0 0 111 -11,10 0 222 -22,0 10 333 -33,0 0 444 -44),(1 1 555 -55,4 1 666 -66,1 4 777 -77,1 1 888 -88))')], ['pgn1', 'pgn2', 'pgn3'])
df.select(dbf.st_asewkt(dbf.st_exteriorring(dbf.st_geomfromtext('pgn1'))).alias('result')).collect()
Output
[Row(result='LINESTRING EMPTY')]
Python
df.select(dbf.st_asewkt(dbf.st_exteriorring(dbf.st_geomfromtext('pgn2', 3857))).alias('result')).collect()
Output
[Row(result='SRID=3857;LINESTRING(0 0,10 0,0 10,0 0)')]
Python
df.select(dbf.st_asewkt(dbf.st_exteriorring(dbf.st_geogfromtext('pgn3'))).alias('result')).collect()
Output
[Row(result='SRID=4326;LINESTRING ZM (0 0 111 -11,10 0 222 -22,0 10 333 -33,0 0 444 -44)')]