ST_Relate takes two geometry columns and a string and returns a boolean column. The function returns True
if
the first geometry and the second geometry satisfy the spatial relationship defined by the specified DE-9IM
string code; otherwise, it returns False
. The string code contains nine characters that represent the nine spatial relations of the
dimensionally extended 9-intersection model (DE-9IM).
The character values indicate the dimensionality of the relationship: 0
for points,
1
for linestrings, 2
for polygons, and '
to indicate an empty set.
Function | Syntax |
---|---|
Python | relate(geometry1, geometry2, relation) |
SQL | ST |
Scala | relate(geometry1, geometry2, relation) |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for relate.
This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.
Examples
from geoanalytics_fabric.sql import functions as ST, Linestring, Polygon
data = [
(Linestring([[[10,10],[30,30]]]), Linestring([[[20,20],[40,40]]])),
(Linestring([[[10,10],[30,30]]]), Linestring([[[10,10],[30,30]]])),
]
df = spark.createDataFrame(data, ["linestring1", "linestring2"])
df.select(ST.relate("linestring1", "linestring2", relation="1FFF0FFF2").alias("relate")).show()
+------+
|relate|
+------+
| false|
| true|
+------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |