ST_Relate — 1st Version tests if a Geometry is spatially related to another Geometry as specified by a intersection pattern matrix. 2nd Version returns the DE-9IM (Dimensionally Extended 9 Intersection Model) for two geometries.
boolean ST_Relate(
bytea geomA, bytea geomB, varchar
PatternMatrix)
;
varchar ST_Relate(
bytea geomA, bytea geomB)
;
1st Version Tests if a Geometry is spatially related to another Geometry by testing for intersections between the interior, boundary and exterior of the two Geometries values as specified by the intersection pattern matrix.
Returns True if the DE-9IM IntersectionMatrix for the two Geometrys match a given intersection Pattern Matrix.
2nd Version returns the DE-9IM (Dimensionally Extended 9 Intersection Model) for two geometries.
Spatial standards define just ST_Relate 1st version.
GeometryCollections are unsupported |
2D | 3D | M |
---|---|---|
OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
---|---|---|---|
2.1.1.2 | 7.2.19.1 | 7.2.8.1 | 5.1.25 |
---1st Version --Test if 2 polygons overlap SELECT ST_Relate(PA,PB,'T*T***T**') from (SELECT ST_GeomFromText('POLYGON ((10 30, 0 10, 30 20, 30 30, 20 40, 10 30))') as PA, ST_GeomFromText('POLYGON ((10 40, 20 40, 20 20, 10 20, 10 40))') as PB) as foo; --Result TRUE ---2nd Version SELECT ST_Relate(PA,PB) from (SELECT ST_GeomFromText('POLYGON ((10 30, 0 10, 30 20, 30 30, 20 40, 10 30))') as PA, ST_GeomFromText('POLYGON ((10 40, 20 40, 20 20, 10 20, 10 40))') as PB) as foo; --Result 212101212