doc:de9im

Documentation | Other Specifications | ** DE-9IM **

TatukGIS supports a powerful, yet easy to manage mechanism for querying against spatial relationships between two shapes, known as the *Dimensionally Extended 9 Intersection Model (DE-9IM)*. See also at Wikipedia.

The idea is to manage a nine element mechanism in which each item defines the relationship possibilities between the interiors, exteriors, and boundaries of two shapes. The relationship is defined in terms of intersection types, or lack of an intersection.

The meanings of the interior, exterior, and boundary, as they relate to shape types, are defined as follows:

Interior | Boundary | Exterior | |
---|---|---|---|

TGIS_Point | Point itself | Nothing | All except Interior |

TGIS_Multipoint | Points themselves | Nothing | All except Interior |

TGIS_Arc (lines) | Line itself except starting/ending points | Starting & ending points of line | All except Interior & Boundary |

TGIS_Polygon (areas) | Area of polygon | Outline of polygon | All except Interior & Boundary |

The nature of the shape intersections is defined by a set of interior, boundary, and exterior relationship possibilities, forming a 3×3 table.

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | * | * | * |

Boundary | * | * | * |

Exterior | * | * | * |

The table can be represented by a string (row-by-row) like: `T*F**FFF*`

Each element of the table represents an intersection possibility:

Type | Description |
---|---|

T | Intersection exists |

F | Intersection does not exist |

* | Does not matter |

0 | Intersection is a point (dimension = 0) |

1 | Intersection is a line(dimension = 1) |

2 | Intersection is a polygon (dimension = 2) |

A contains B if the interiors intersect and the exterior of A is not intersected by the Interior or boundary of B.

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | T | * | * |

Boundary | * | * | * |

Exterior | F | F | * |

String representation is: `T*****FF*`

Predefined constant: `RELATE_CONTAINS`

There is also possible additional requirement that A completely contains B. The boundary of A must not intersect the interior or the boundary of B.

String representation for this case is: `T**FF*FF*`

Predefined constant: `RELATE_CONTAINS_COMPLETELY`

For relating shapes of different types. So polygon can be crossed by line, but not with another polygon. (See Overlap).

A crosses B if the interiors intersect and the exterior of B intersects with the interior of A. General formula (except line-to-line situations).

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | T | * | T |

Boundary | * | * | * |

Exterior | * | * | * |

String representation is: `"T*T******`

Predefined constant: `RELATE_CROSS`

A crosses B (and B crosses A) if the dimension of the intersection equals 0 (is a point). Only for line-to-line relationships.

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | 0 | * | * |

Boundary | * | * | * |

Exterior | * | * | * |

String representation is: `0********`

Predefined constant: `RELATE_CROSS_LINE `

There is no intersection of any kind.

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | F | F | * |

Boundary | F | F | * |

Exterior | * | * | * |

String representation is: `FF*FF****`

Predefined constant: `RELATE_DISJOINT`

A & B interiors intersect, and no interior or boundary of one shape intersects with the exterior or boundary of the other shape.

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | T | * | F |

Boundary | * | * | F |

Exterior | F | F | * |

String representation is: `T*F**FFF*`

Predefined constant: `RELATE_EQUALITY`

By interiors.

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | T | * | * |

Boundary | * | * | * |

Exterior | * | * | * |

String representation is: `T********`

Predefined constant: `RELATE_INTERSECT`

The interior of A intersects the boundary of B

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | * | T | * |

Boundary | * | * | * |

Exterior | * | * | * |

String representation is: “*T*******”

Predefined constant: RELATE_INTERSECT1

The boundary of A intersects the interior of B

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | * | * | * |

Boundary | T | * | * |

Exterior | * | * | * |

String representation is: `***T*****`

Predefined constant: `RELATE_INTERSECT2`

The boundary of A intersects the boundary of B

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | * | * | * |

Boundary | * | T | * |

Exterior | * | * | * |

String representation is: `****T****`

Predefine constant: `RELATE_INTERSECT3 `

A & B interiors intersect, and no interior or boundary of one shape intersects with the exterior or boundary of the other shape.

A\B | Interior | Boundary | Exterior |

Interior | T | * | F |

Boundary | * | * | F |

Exterior | F | F | * |

String representation is: `T*F**FFF*`

Predefined constant: `RELATE_EQUALITY`

For relating shapes of the same type. So a polygon can overlap with another polygon, but not with a line. (See Cross).

A overlaps B (and B overlaps A) if both the interiors and exteriors intersect. General formula (except line-to-line situations).

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | T | * | T |

Boundary | * | * | * |

Exterior | T | * | * |

String representation is: `T*T***T**`

Predefined constant: `RELATE_OVERLAP`

A overlaps B (and B overlap A) if the interior intersection has a dimension equal to 1 (is a line) and the exteriors intersect. Only for line-to-line relationships.

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | 1 | * | T |

Boundary | * | * | * |

Exterior | T | * | * |

String representation is: `1*T***T**`

Predefined constant: `RELATE_OVERLAP_LINE`

The boundary of A intersects with the interior of B.

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | F | * | * |

Boundary | T | * | * |

Exterior | * | * | * |

String representation is: `F**T*****`

Predefined constant: RELATE_TOUCH_INTERIOR

The boundary of A intersects the boundary of B (but not the interior of B)

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | F | * | * |

Boundary | * | T | * |

Exterior | * | * | * |

String representation is: `F***T****`

Predefined constant: `RELATE_TOUCH`

A is within B if the interiors intersect and the exterior of B is not intersected by the Interior or boundary of A.

A\B | Interior | Boundary | Exterior |
---|---|---|---|

Interior | T | * | F |

Boundary | * | * | F |

Exterior | * | * | * |

String representation is: `T*F**F***`

Predefined constant: `RELATE_WITHIN`

There is also possible additional requirement that A is completely within B.

String representation for this case is: `'TFF*FF***`

Predefined constant: `RELATE_WITHIN_COMPLETELY`

2018/11/13 10:07