ST_IsRing

ST_IsRing takes a linestring column and returns a boolean column. The output column returns True if the input linestring is closed and simple; otherwise, it returns False.

FunctionSyntax
Pythonis_ring(geometry)
SQLST_IsRing(geometry)
ScalaisRing(geometry)

For more details, go to the GeoAnalytics Engine API reference for is_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
13
from geoanalytics.sql import functions as ST, Linestring

data = [
    (Linestring([[[5,5],[7,6],[6,6],[6,8]]]), ),
    (Linestring([[[5,5],[7,6],[6,6],[5,5]]]), ),
    (Linestring([[[5,5],[7,6],[6,6],[6,6],[5,5]]]), )
]

df = spark.createDataFrame(data, ["linestring"])

df.select(ST.is_ring(geometry="linestring").alias("is_ring")).show()
Result
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
+-------+
|is_ring|
+-------+
|  false|
|   true|
|  false|
+-------+

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.