
ST_Intersects takes two geometry columns and returns a boolean column. The function returns True
if the first geometry
and the second geometry spatially intersect; otherwise, it returns False
.
Function | Syntax |
---|---|
Python | intersects(geometry1, geometry2) |
SQL | ST |
Scala | intersects(geometry1, geometry2) |
For more details, go to the GeoAnalytics Engine API reference for intersects.
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 = [
(Polygon([[[0,0],[10,10],[20,0]]]), Linestring([[[5,2],[20,20]]])),
(Polygon([[[0,0],[10,10],[20,0]]]), Linestring([[[30,40],[32,43]]])),
]
df = spark.createDataFrame(data, ["polygon", "linestring"])
df.select(ST.intersects("polygon", "linestring").alias("intersects")).show()
+----------+
|intersects|
+----------+
| true|
| false|
+----------+
Version table
Release | Notes |
---|---|
1.0.0 | Python and SQL functions introduced |
1.5.0 | Scala function introduced |