
ST_ExteriorRing takes a polygon column and returns a linestring column. The linestring represents the exterior
ring of the polygon. Multipart polygons will return null
.
Function | Syntax |
---|---|
Python | exterior |
SQL | ST |
Scala | exterior |
For more details, go to the GeoAnalytics Engine API reference for exterior_ring.
This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.
Examples
from geoanalytics.sql import functions as ST, Polygon
data = [
(Polygon([[[20,0],[30,20],[40,0],[20,0]]]),),
(Polygon([[[0,0],[0,10],[10,10],[10,0],[0,0]],[[1,1],[1,2],[2,2],[2,1],[1,1]]]),)
]
df = spark.createDataFrame(data,["polygon"])
df.select(ST.exterior_ring("polygon").alias("exterior_ring")).show(truncate=False)
+-------------------------------------------------+
|exterior_ring |
+-------------------------------------------------+
|{"paths":[[[20,0],[20,0],[40,0],[30,20],[20,0]]]}|
|NULL |
+-------------------------------------------------+
Version table
Release | Notes |
---|---|
1.0.0 | Python and SQL functions introduced |
1.5.0 | Scala function introduced |