-- A DE-9IM pattern matrix is a device for comparing geometries. -- These are serveral types of such matrices. There are several -- types of such matrices. For example, the equals pattern matrix -- will tell you if any two geometries are equal. -- In this example, an equals pattern matrix, shown below is read left -- to right, and top to bottom into the string ("T*F**FFF*"). -- -- b -- -- Interior Boundary Exterior -- Interior T * F -- a Boundary * * F -- Exterior F F * -- -- The table relate_test is created with the following CREATE TABLE statement. CREATE TABLE relate_test (g1 ST_Geometry, g2 ST_Geometry, g3 ST_Geometry); -- The following INSERT statements insert a sample subclass into the -- relate_test table. INSERT INTO relate_test VALUES( ST_PointFromText('point (10.02 20.01)',1000), ST_PointFromText('point (10.02 20.01)',1000), ST_PointFromText('point (30.01 20.01)',1000) ); -- The following SELECT statement and the corresponding result -- set demonstrates that the geometries which are equal match the -- equals pattern matrix, and those which are not equal do not match. SELECT ST_Relate(g1,g2,"T*F**FFF*") equals, ST_Relate(g1,g3,"T*F**FFF*") not_equals FROM relate_test;