The Dimensionally Extended 9-Intersection Model (DE-9IM) is a topological model and a standard used to describe the spatial relations of two regions (two geometries in two-dimensions, R2), in geometry, point-set topology, geospatial topology, and fields related to computer spatial analysis. The spatial relations expressed by the model are invariant to rotation, translation and scaling transformations.
The matrix provides an approach for classifying geometry relations. Roughly speaking, with a true/false matrix domain, there are 512 possible 2D topologic relations, that can be grouped into binary classification schemes. The English language contains about 10 schemes (relations), such as "intersects", "touches" and "equals". When testing two geometries against a scheme, the result is a spatial predicate named by the scheme.
The model was developed by Clementini and others[1] [2] based on the seminal works of Egenhofer and others.[3] [4] It has been used as a basis for standards of queries and assertions in geographic information systems (GIS) and spatial databases.
The DE-9IM model is based on a 3×3 intersection matrix with the form:
where is the dimension of the intersection (∩) of the interior (I), boundary (B), and exterior (E) of geometries a and b.
The terms interior and boundary in this article are used in the sense used in algebraic topology and manifold theory, not in the sense used in general topology: for example, the interior of a line segment is the line segment without its endpoints, and its boundary is just the two endpoints (in general topology, the interior of a line segment in the plane is empty and the line segment is its own boundary).
In the notation of topological space operators, the matrix elements can be expressed also as
The dimension of empty sets (∅) are denoted as −1 or (false). The dimension of non-empty sets (¬∅) are denoted with the maximum number of dimensions of the intersection, specifically for points, for lines, for areas. Then, the domain of the model is .
A simplified version of values are obtained mapping the values to (true), so using the boolean domain . The matrix, denoted with operators, can be expressed as
The elements of the matrix can be named as shown below:
Both matrix forms, with dimensional and boolean domains, can be serialized as "DE-9IM string codes", which represent them in a single-line string pattern. Since 1999 the string codes have a standard[5] format.
For output checking or pattern analysis, a matrix value (or a string code) can be checked by a "mask": a desired output value with optional asterisk symbols as wildcards — that is, "" indicating output positions that the designer does not care about (free values or "don't-care positions").The domain of the mask elements is, or for the boolean form.
The simpler models 4-Intersection and 9-Intersection were proposed before DE-9IM for expressing spatial relations[6] (and originated the terms 4IM and 9IM). They can be used instead of the DE-9IM to optimize computation when input conditions satisfy specific constraints.
Visually, for two overlapping polygonal geometries, the result of the function DE_9IM(a,b) looks like:
This matrix can be serialized. Reading from left-to-right and top-to-bottom, the result is . So, in a compact representation as string code is ''.
Any topological property based on a DE-9IM binary spatial relation is a spatial predicate. For ease of use "named spatial predicates" have been defined for some common relations, which later became standard predicates.The spatial predicate functions that can be derived from DE-9IM include:[4]
Predicates defined with masks of domain :
Name (synonym) | Intersection matrix and mask code string (boolean OR between matrices) | Meaning and definition | Equivalent | |||
---|---|---|---|---|---|---|
Equals | l[\begin{smallmatrix} T&*&F\\ *&*&F\\ F&F&* \end{smallmatrix}r] | a and b are topologically equal. "Two geometries are topologically equal if their interiors intersect and no part of the interior or boundary of one geometry intersects the exterior of the other".[7] | Within & Contains | |||
T*F**FFF* | ||||||
Disjoint | l[\begin{smallmatrix} F&F&*\\ F&F&*\\ *&*&* \end{smallmatrix}r] | a and b are disjoint: they have no point in common. They form a set of disconnected geometries. | not Intersects | |||
FF*FF**** | ||||||
Touches (meets) | l[\begin{smallmatrix} F&T&*\\ *&*&*\\ *&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} F&*&*\\ T&*&*\\ *&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} F&*&*\\ *&T&*\\ *&*&* \end{smallmatrix}r] | a touches b: they have at least one point in common, but their interiors do not intersect. | ||
FT******* | F**T***** | F***T**** | ||||
Contains | l[\begin{smallmatrix} T&*&*\\ *&*&*\\ F&F&* \end{smallmatrix}r] | a contains b: geometry b lies in a, and the interiors intersect. Another definition: "a contains b iff no points of b lie in the exterior of a, and at least one point of the interior of b lies in the interior of a".[8] | Within(b,a) | |||
T*****FF* | ||||||
Covers | l[\begin{smallmatrix} T&*&*\\ *&*&*\\ F&F&* \end{smallmatrix}r] | l[\begin{smallmatrix} *&T&*\\ *&*&*\\ F&F&* \end{smallmatrix}r] | l[\begin{smallmatrix} *&*&*\\ T&*&*\\ F&F&* \end{smallmatrix}r] | l[\begin{smallmatrix} *&*&*\\ *&T&*\\ F&F&* \end{smallmatrix}r] | a covers b: geometry b lies in a. Other definitions: "At least one point of b lies in a, and no point of b lies in the exterior of a", or "Every point of b is a point of (the interior or boundary of) a". | CoveredBy(b,a) |
T*****FF* | *T****FF* | ***T**FF* | ****T*FF* |
Predicates that can be obtained from the above by logical negation or parameter inversion (matrix transposition), as indicated by the last column:
Intersects | l[\begin{smallmatrix} T&*&*\\ *&*&*\\ *&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} *&T&*\\ *&*&*\\ *&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} *&*&*\\ T&*&*\\ *&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} *&*&*\\ *&T&*\\ *&*&* \end{smallmatrix}r] | a intersects b: geometries a and b have at least one point in common. | not Disjoint |
---|---|---|---|---|---|---|
T******** | *T******* | ***T***** | ****T**** | |||
Within (inside) | l[\begin{smallmatrix} T&*&F\\ *&*&F\\ *&*&* \end{smallmatrix}r] | a is within b: a lies in the interior of b. | Contains(b,a) | |||
T*F**F*** | ||||||
CoveredBy | l[\begin{smallmatrix} T&*&F\\ *&*&F\\ *&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} *&T&F\\ *&*&F\\ *&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} *&*&F\\ T&*&F\\ *&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} *&*&F\\ *&T&F\\ *&*&* \end{smallmatrix}r] | a is covered by b (extends Within): geometry a lies in b. Other definitions: "At least one point of a lies in b, and no point of a lies in the exterior of b", or "Every point of a is a point of (the interior or boundary of) b". | Covers(b,a) |
T*F**F*** | *TF**F*** | **FT*F*** | **F*TF*** |
Predicates that utilize the input dimensions, and are defined with masks of domain :
Crosses or | l[\begin{smallmatrix} T&*&T\\ *&*&*\\ *&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} T&*&*\\ *&*&*\\ T&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} 0&*&*\\ *&*&*\\ *&*&* \end{smallmatrix}r] | a crosses b: they have some but not all interior points in common, and the dimension of the intersection is less than that of at least one of them. The following mask selection rules must only be checked when (except for line / line inputs, which are allowed), otherwise the predicate is false:[9] | ||
---|---|---|---|---|---|---|
T*T****** | T*****T** | 0******** | ||||
Overlaps | l[\begin{smallmatrix} T&*&T\\ *&*&*\\ T&*&* \end{smallmatrix}r] | l[\begin{smallmatrix} 1&*&T\\ *&*&*\\ T&*&* \end{smallmatrix}r] | a overlaps b: they have some but not all points in common, they have the same dimension, and the intersection of the interiors of the two geometries has the same dimension as the geometries themselves. The following mask selection rules must only be checked when, otherwise the predicate is false: | |||
T*T***T** | 1*T***T** |
Notice that:
*
. This is because EE is trivially true, and thus provides no useful information.T*F**FFF*
, is the "merge" of Contains (T*****FF*
) and Within (T*F**F***
): .T*****FF*
occurs in the definition of both Contains and Covers. Covers is a more inclusive relation. In particular, unlike Contains it does not distinguish between points in the boundary and in the interior of geometries. For most situations, Covers should be used in preference to Contains.T*F**F***
occurs in the definition of both Within and CoveredBy. For most situations, CoveredBy should be used in preference to Within.The spatial predicates have the following properties of binary relations:
The choice of terminology and semantics for the spatial predicates is based on reasonable conventions and the tradition of topological studies.[4] Relationships such as Intersects, Disjoint, Touches, Within, Equals (between two geometries a and b) have an obvious semantic:[8] [11]
The predicates Contains and Within have subtle aspects to their definition which are contrary to intuition.For example,[8] a line L which is completely contained in the boundary of a polygon P is not considered to be contained in P. This quirk can be expressed as "Polygons do not contain their boundary". This issue is caused by the final clause of the Contains definition above: "at least one point of the interior of B lies in the interior of A". For this case, the predicate Covers has more intuitive semantics (see definition), avoiding boundary considerations.
For better understanding, the dimensionality of inputs can be used as justification for a gradual introduction of semantic complexity:
Relations between | Appropriate predicates | Semantic added | |
---|---|---|---|
point/point | Equals, Disjoint | Other valid predicates collapses into Equals. | |
point/line | adds Intersects | Intersects is a refinement of Equals: "some equal point at the line". | |
line/line | adds Touches, Crosses, ... | Touches is a refinement of Intersects, about "boundaries" only. Crosses is about "only one point". |
The number of possible results in a boolean 9IM matrix is 29=512, and in a DE-9IM matrix is 39=6561. The percentage of these results that satisfy a specific predicate is determined as following,On usual applications the geometries intersects a priori, and the other relations are checked.
The composite predicates "Intersects OR Disjoint" and "Equals OR Different" have the sum 100% (always true predicates),but "Covers OR CoveredBy" have 41%, that is not the sum, because they are neither logical complements or independent relations; similarly "Contains OR Within", have 21%. The sum 25 % + 12.5 % = 37.5 % is obtained when ignoring overlapping lines in "Crosses OR Overlaps", because the valid input sets are disjoint.
The DE-9IM offers a full descriptive assertion about the two input geometries. It is a mathematical function that represents a complete set of all possible relations about two entities, like a Truth table, the Three-way comparison, a Karnaugh map or a Venn diagram. Each output value is like a truth table line, that represent relations of specific inputs.
As illustrated above, the output '212101212' resulted from DE-9IM(a,b) is a complete description of all topologic relations between specific geometries a and b. It says to us that .
By other hand, if we check predicates like Intersects(a,b) or Touches(a,b) — for the same example we have "Intersects= and Touches=" — it is an incomplete description of "all topologic relations".Predicates also do not say any thing about the dimensionality of the geometries (it doesn't matter if a and b are lines, areas or points).
This independence of geometry-type and the lack of completeness, on predicates, are useful for general queries about two geometries:
interior/boundary/exterior semantic | usual semantic | ||
---|---|---|---|
Assertions | more descriptive " a and b have " | less descriptive " a Touches b " | |
Queries | more restrictive " Show all pair of geometries where " | more general " Show all pair of geometries where Touches(a,b) " |
For usual applications, the use of spatial predicates also is justified by being more human-readable than DE-9IM descriptions: a typical user have better intuition about predicates (than a set of interiors/border/exterior intersections).
Predicates have useful semantic into usual applications, so it is useful the translation of a DE-9IM description into a list of all associated predicates,[12] [13] that is like a casting process between the two different semantic types. Examples:
The Open Geospatial Consortium (OGC) has standardized the typical spatial predicates (Contains, Crosses, Intersects, Touches, etc.) as boolean functions, and the DE-9IM model,[14] as a function that returns a string (the DE-9IM code), with domain of, meaning =point, =line, =area, and ="empty set". This DE-9IM string code is a standardized format for data interchange.
The Simple Feature Access (ISO 19125) standard,[15] in the chapter 7.2.8, "SQL routines on type Geometry", recommends as supported routines the SQL/MM Spatial[16] (ISO 13249-3 Part 3: Spatial) ST_Dimension, ST_GeometryType, ST_IsEmpty, ST_IsSimple, ST_Boundary for all Geometry Types.The same standard, consistent with the definitions of relations in "Part 1, Clause 6.1.2.3"of the SQL/MM, recommends (shall be supported) the function labels: ST_Equals, ST_Disjoint, ST_Intersects, ST_Touches, ST_Crosses, ST_Within, ST_Contains, ST_Overlaps and ST_Relate.
The DE-9IM in the OGC standards use the following definitions of Interior and Boundary, for the main OGC standard geometry types:[17]
Subtypes | Dim | Interior | boundary | |
---|---|---|---|---|
Point, MultiPoint | 0 | Point, Points | Empty | |
LineString, Line | 1 | Points that are left when the boundary points are removed. | Two end points. | |
LinearRing | 1 | All points along the geometry. | Empty. | |
MultilineString | 1 | Points that are left when the boundary points are removed. | Those points that are in the boundaries of an odd number of its elements (curves). | |
Polygon | 2 | Points within the rings. | Set of rings. | |
MultiPolygon | 2 | Points within the rings. | Set of rings of its elements (polygons). | |
NOTICE: exterior points (E) are points p not in the interior or boundary, so not need extra interpretation, . |
Most spatial databases, such as PostGIS, implements the DE-9IM model by the standard functions:[18] ST_Relate
, ST_Equals
, ST_Intersects
, etc. The function ST_Relate(a,b)
outputs the standard OGC's DE-9IM string code.
Examples: two geometries, a and b, that intersects and touches with a point (for instance with and), can be ST_Relate(a,b)='FF1F0F1F2'
or ST_Relate(a,b)='FF10F0102'
or ST_Relate(a,b)='FF1F0F1F2'
. It also satisfies ST_Intersects(a,b)=true
and ST_Touches(a,b)=true
.When ST_Relate(a,b)='0FFFFF212'
, the returned DE-9IM code have the semantic of "Intersects(a,b) & Crosses(a,b) & Within(a,b) & CoveredBy(a,b)", that is, returns true
on the boolean expression ST_Intersects(a,b) AND ST_Crosses(a,b) AND ST_Within(a,b) AND ST_Coveredby(a,b)
.
The use of is faster than direct computing of a set of correspondent predicates.[19] There are cases where using is the only way to compute a complex predicate — see the example of the code 0FFFFF0F2
,[20] of a point that not "crosses" a multipoint (a object that is a set of points), but predicate Crosses (when defined by a mask) returns true.
It is usual to overload the by adding a mask parameter,or use a returned string into the function.[21] When using, it returns a boolean. Examples:
ST_Relate(a,b,'*FF*FF212')
returns true when ST_Relate(a,b)
is 0FFFFF212
or 01FFFF212
, and returns false when 01FFFF122
or 0FF1FFFFF
.ST_RelateMatch('0FFFFF212','*FF*FF212')
and ST_RelateMatch('01FFFF212','TTF*FF212')
are true, ST_RelateMatch('01FFFF122','*FF*FF212')
is false.T*****FF*
.Standards:
| Software: | Related topics:
|