ST_IsSimple

ST_IsSimple takes a geometry column and returns a boolean column. The output returns True if the given geometry is simple; otherwise, it returns False. The criteria for simplicity vary for each geometry type and are as follows:

  • A point is always simple.
  • A multipoint is considered simple if no two points are coincident.
  • A linestring is considered simple if it does not cross the same point twice, except for start and end points. A multipart linestring is only considered simple if the parts do not interect except at the start or end points of the parts.
  • A polygon or multipart polygon is considered simple if each ring does not cross the same point twice and no two rings cross or intersect except at a single point (i.e. they are tangent at a point but not a line).
FunctionSyntax
Pythonis_simple(geometry)
SQLST_IsSimple(geometry)
ScalaisSimple(geometry)

For more details, go to the GeoAnalytics Engine API reference for is_simple.

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_simple("linestring").alias("is_simple")).show()
Result
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
+---------+
|is_simple|
+---------+
|     true|
|     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.