shapely.relate_pattern#
- relate_pattern(a, b, pattern, **kwargs)#
Return True if the DE-9IM relationship code satisfies the pattern.
This function compares the DE-9IM code string for two geometries against a specified pattern. If the string matches the pattern then
Trueis returned, otherwiseFalse. The pattern specified can be an exact match (0,1or2), a boolean match (uppercaseTorF), or a wildcard (*). For example, the pattern for thewithinpredicate is'T*F**F***'.- Parameters:
- a, bGeometry or array_like
Geometry or geometries to check.
- patternstring
The pattern to match the DE-9IM relationship code against.
- **kwargs
See NumPy ufunc docs for other keyword arguments.
Examples
>>> import shapely >>> from shapely import Point, Polygon >>> point = Point(0.5, 0.5) >>> square = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]) >>> shapely.relate(point, square) '0FFFFF212' >>> shapely.relate_pattern(point, square, "T*F**F***") True