
ST_Overlaps takes two geometry columns and returns a boolean column. The function returns True
if the first geometry and
the second geometry spatially overlap; otherwise, it returns False
. Two geometries overlap when their intersection is
the same geometry type as either of the inputs but not equal to either of the inputs.
Function | Syntax |
---|---|
Python | overlaps(geometry1, geometry2) |
SQL | ST |
Scala | overlaps(geometry1, geometry2) |
For more details, go to the GeoAnalytics Engine API reference for overlaps.
This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.
Examples
from geoanalytics.sql import functions as ST, Linestring, Polygon
data = [
(Linestring([[[10,10],[30,30]]]), Linestring([[[20,20],[40,40]]])),
(Linestring([[[0,0],[10,10],[20,0]]]), Linestring([[[10,10],[30,30]]])),
]
df = spark.createDataFrame(data, ["linestring1", "linestring2"])
df.select(ST.overlaps("linestring1", "linestring2").alias("overlaps")).show()
+--------+
|overlaps|
+--------+
| true|
| false|
+--------+
Version table
Release | Notes |
---|---|
1.0.0 | Python and SQL functions introduced |
1.5.0 | Scala function introduced |