MCPcopy Create free account
hub / github.com/shapely/shapely / relate_pattern

Function relate_pattern

shapely/predicates.py:1175–1206  ·  view source on GitHub ↗

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 ``True`` is returned, otherwise ``False``. The pattern specified can be an exact ma

(a, b, pattern, **kwargs)

Source from the content-addressed store, hash-verified

1173
1174@multithreading_enabled
1175def relate_pattern(a, b, pattern, **kwargs):
1176 """Return True if the DE-9IM relationship code satisfies the pattern.
1177
1178 This function compares the DE-9IM code string for two geometries
1179 against a specified pattern. If the string matches the pattern then
1180 ``True`` is returned, otherwise ``False``. The pattern specified can
1181 be an exact match (``0``, ``1`` or ``2``), a boolean match
1182 (uppercase ``T`` or ``F``), or a wildcard (``*``). For example,
1183 the pattern for the ``within`` predicate is ``'T*F**F***'``.
1184
1185 Parameters
1186 ----------
1187 a, b : Geometry or array_like
1188 Geometry or geometries to check.
1189 pattern : string
1190 The pattern to match the DE-9IM relationship code against.
1191 **kwargs
1192 See :ref:`NumPy ufunc docs <ufuncs.kwargs>` for other keyword arguments.
1193
1194 Examples
1195 --------
1196 >>> import shapely
1197 >>> from shapely import Point, Polygon
1198 >>> point = Point(0.5, 0.5)
1199 >>> square = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)])
1200 >>> shapely.relate(point, square)
1201 '0FFFFF212'
1202 >>> shapely.relate_pattern(point, square, "T*F**F***")
1203 True
1204
1205 """
1206 return lib.relate_pattern(a, b, pattern, **kwargs)
1207
1208
1209@multithreading_enabled

Callers

nothing calls this directly

Calls 1

relate_patternMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…