Interface RelatePredicate


  • public interface RelatePredicate
    Creates predicate instances for evaluating OGC-standard named topological relationships. Predicates can be evaluated for geometries using RelateNG.
    Author:
    Martin Davis
    • Method Detail

      • intersects

        static TopologyPredicate intersects()
        Creates a predicate to determine whether two geometries intersect.

        The intersects predicate has the following equivalent definitions:

        • The two geometries have at least one point in common
        • The DE-9IM Intersection Matrix for the two geometries matches at least one of the patterns
          • [T********]
          • [*T*******]
          • [***T*****]
          • [****T****]
        • disjoint() = false
          (intersects is the inverse of disjoint)
        Returns:
        the predicate instance
        See Also:
        disjoint()
      • disjoint

        static TopologyPredicate disjoint()
        Creates a predicate to determine whether two geometries are disjoint.

        The disjoint predicate has the following equivalent definitions:

        • The two geometries have no point in common
        • The DE-9IM Intersection Matrix for the two geometries matches [FF*FF****]
        • intersects() = false
          (disjoint is the inverse of intersects)
        Returns:
        the predicate instance
        See Also:
        intersects()
      • contains

        static TopologyPredicate contains()
        Creates a predicate to determine whether a geometry contains another geometry.

        The contains predicate has the following equivalent definitions:

        • Every point of the other geometry is a point of this geometry, and the interiors of the two geometries have at least one point in common.
        • The DE-9IM Intersection Matrix for the two geometries matches the pattern [T*****FF*]
        • within(B, A) = true
          (contains is the converse of within() )
        An implication of the definition is that "Geometries do not contain their boundary". In other words, if a geometry A is a subset of the points in the boundary of a geometry B, B.contains(A) = false. (As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) For a predicate with similar behavior but avoiding this subtle limitation, see covers().
        Returns:
        the predicate instance
        See Also:
        within()
      • within

        static TopologyPredicate within()
        Creates a predicate to determine whether a geometry is within another geometry.

        The within predicate has the following equivalent definitions:

        • Every point of this geometry is a point of the other geometry, and the interiors of the two geometries have at least one point in common.
        • The DE-9IM Intersection Matrix for the two geometries matches [T*F**F***]
        • contains(B, A) = true
          (within is the converse of contains())
        An implication of the definition is that "The boundary of a Geometry is not within the Geometry". In other words, if a geometry A is a subset of the points in the boundary of a geometry B, within(B, A) = false (As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.) For a predicate with similar behavior but avoiding this subtle limitation, see coveredBy().
        Returns:
        the predicate instance
        See Also:
        contains()
      • covers

        static TopologyPredicate covers()
        Creates a predicate to determine whether a geometry covers another geometry.

        The covers predicate has the following equivalent definitions:

        • Every point of the other geometry is a point of this geometry.
        • The DE-9IM Intersection Matrix for the two geometries matches at least one of the following patterns:
          • [T*****FF*]
          • [*T****FF*]
          • [***T**FF*]
          • [****T*FF*]
        • coveredBy(b, a) = true
          (covers is the converse of coveredBy())
        If either geometry is empty, the value of this predicate is false.

        This predicate is similar to contains(), but is more inclusive (i.e. returns true for more cases). In particular, unlike contains it does not distinguish between points in the boundary and in the interior of geometries. For most cases, covers should be used in preference to contains. As an added benefit, covers is more amenable to optimization, and hence should be more performant.

        Returns:
        the predicate instance
        See Also:
        coveredBy()
      • coveredBy

        static TopologyPredicate coveredBy()
        Creates a predicate to determine whether a geometry is covered by another geometry.

        The coveredBy predicate has the following equivalent definitions:

        • Every point of this geometry is a point of the other geometry.
        • The DE-9IM Intersection Matrix for the two geometries matches at least one of the following patterns:
          • [T*F**F***]
          • [*TF**F***]
          • [**FT*F***]
          • [**F*TF***]
        • covers(B, A) = true
          (coveredBy is the converse of covers())
        If either geometry is empty, the value of this predicate is false.

        This predicate is similar to within(), but is more inclusive (i.e. returns true for more cases).

        Returns:
        the predicate instance
        See Also:
        covers()
      • crosses

        static TopologyPredicate crosses()
        Creates a predicate to determine whether a geometry crosses another geometry.

        The crosses predicate has the following equivalent definitions:

        • The geometries have some but not all interior points in common.
        • The DE-9IM Intersection Matrix for the two geometries matches one of the following patterns:
          • [T*T******] (for P/L, P/A, and L/A cases)
          • [T*****T**] (for L/P, A/P, and A/L cases)
          • [0********] (for L/L cases)
        For the A/A and P/P cases this predicate returns false.

        The SFS defined this predicate only for P/L, P/A, L/L, and L/A cases. To make the relation symmetric JTS extends the definition to apply to L/P, A/P and A/L cases as well.

        Returns:
        the predicate instance
      • equalsTopo

        static TopologyPredicate equalsTopo()
        Creates a predicate to determine whether two geometries are topologically equal.

        The equals predicate has the following equivalent definitions:

        • The two geometries have at least one point in common, and no point of either geometry lies in the exterior of the other geometry.
        • The DE-9IM Intersection Matrix for the two geometries matches the pattern T*F**FFF*
        Returns:
        the predicate instance
      • overlaps

        static TopologyPredicate overlaps()
        Creates a predicate to determine whether a geometry overlaps another geometry.

        The overlaps predicate has the following equivalent definitions:

        • The geometries have at least one point each not shared by the other (or equivalently neither covers the other), they have the same dimension, and the intersection of the interiors of the two geometries has the same dimension as the geometries themselves.
        • The DE-9IM Intersection Matrix for the two geometries matches [T*T***T**] (for P/P and A/A cases) or [1*T***T**] (for L/L cases)
        If the geometries are of different dimension this predicate returns false. This predicate is symmetric.
        Returns:
        the predicate instance
      • touches

        static TopologyPredicate touches()
        Creates a predicate to determine whether a geometry touches another geometry.

        The touches predicate has the following equivalent definitions:

        • The geometries have at least one point in common, but their interiors do not intersect.
        • The DE-9IM Intersection Matrix for the two geometries matches at least one of the following patterns
          • [FT*******]
          • [F**T*****]
          • [F***T****]
        If both geometries have dimension 0, the predicate returns false, since points have only interiors. This predicate is symmetric.
        Returns:
        the predicate instance
      • matches

        static TopologyPredicate matches​(String imPattern)
        Creates a predicate that matches a DE-9IM matrix pattern.
        Parameters:
        imPattern - the pattern to match
        Returns:
        a predicate that matches the pattern
        See Also:
        IntersectionMatrixPattern