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.
Important
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
from pyspark.databricks.sql import functions as dbf
dbf.st_exteriorring(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
A Geography or Geometry value representing a polygon. |
Notes
Input value is expected to represent a polygon, otherwise an error is returned.
Examples
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()
[Row(result='LINESTRING EMPTY')]
df.select(dbf.st_asewkt(dbf.st_exteriorring(dbf.st_geomfromtext('pgn2', 3857))).alias('result')).collect()
[Row(result='SRID=3857;LINESTRING(0 0,10 0,0 10,0 0)')]
df.select(dbf.st_asewkt(dbf.st_exteriorring(dbf.st_geogfromtext('pgn3'))).alias('result')).collect()
[Row(result='SRID=4326;LINESTRING ZM (0 0 111 -11,10 0 222 -22,0 10 333 -33,0 0 444 -44)')]