Tests if an ST_Geometry value is spatially related to another ST_Geometry value.
Argument … |
Specifies … |
ageometry |
the other ST_Geometry value. |
amatrix |
a CHARACTER(9) value where each character corresponds to a cell in the DE‑9IM pattern matrix. |
The mapping for amatrix, as defined by SQL/MM Spatial, is as follows:
Position |
DE-9IM Cell |
1 |
(Interior(SELF) ∩ Interior(ageometry)).ST_Dimension |
2 |
(Interior(SELF) ∩ Boundary(ageometry)).ST_Dimension |
3 |
(Interior(SELF) ∩ Exterior(ageometry)).ST_Dimension |
4 |
(Boundary(SELF) ∩ Interior(ageometry)).ST_Dimension |
5 |
(Boundary(SELF) ∩ Boundary(ageometry)).ST_Dimension |
6 |
(Boundary(SELF) ∩ Exterior(ageometry)).ST_Dimension |
7 |
(Exterior(SELF) ∩ Interior(ageometry)).ST_Dimension |
8 |
(Exterior(SELF) ∩ Boundary(ageometry)).ST_Dimension |
9 |
(Exterior(SELF) ∩ Exterior(ageometry)).ST_Dimension |
Valid values for each character are: 'T', 'F', '0', '1', '2', and '*'.
The value specifies the set of acceptable values for an intersection at that given cell. The meaning is as follows.
Cell Value |
Intersection Set Results |
'T' |
{ 0, 1, 2 } |
'F' |
{ -1 } |
'0' |
{ 0 } |
'1' |
{ 1 } |
'2' |
{ 2 } |
'*' |
{ -1, 0, 1, 2 } |
Returns an INTEGER value:
All ST_Geometry types except geometry collections.
Note: This method can be called on 3D geometries (those that include z coordinates). However, the z coordinate is ignored in method calculations.
Use of a geospatial index can greatly improve the performance of queries that use this method.
SELECT streetName
FROM sample_streets
WHERE streetShape.ST_Relate(
NEW ST_Geometry('LINESTRING(2 2, 3 2, 4 1)'), '0********') = 1
ORDER BY streetName;