ST_ExteriorRing

ST_ExteriorRing
Input polygon and the resulting exterior rings.

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.

FunctionSyntax
Pythonexterior_ring(polygon)
SQLST_ExteriorRing(polygon)
ScalaexteriorRing(polygon)

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

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
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)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
6
+-------------------------------------------------+
|exterior_ring                                    |
+-------------------------------------------------+
|{"paths":[[[20,0],[20,0],[40,0],[30,20],[20,0]]]}|
|NULL                                             |
+-------------------------------------------------+

Version table

ReleaseNotes

1.0.0

Python and SQL functions introduced

1.5.0

Scala function introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.