- contains_properly(a, b, **kwargs)#
Returns True if geometry B is completely inside geometry A, with no common boundary points.
A contains B properly if B intersects the interior of A but not the boundary (or exterior). This means that a geometry A does not “contain properly” itself, which contrasts with the
containsfunction, where common points on the boundary are allowed.
Note: this function will prepare the geometries under the hood if needed. You can prepare the geometries in advance to avoid repeated preparation when calling this function multiple times.
- a, bGeometry or array_like
For other keyword-only arguments, see the NumPy ufunc docs.
>>> from shapely import Polygon >>> area1 = Polygon([(0, 0), (3, 0), (3, 3), (0, 3), (0, 0)]) >>> area2 = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) >>> area3 = Polygon([(1, 1), (2, 1), (2, 2), (1, 2), (1, 1)])
area2have a common border:
>>> contains(area1, area2) True >>> contains_properly(area1, area2) False
area3is completely inside
area1with no common border:
>>> contains(area1, area3) True >>> contains_properly(area1, area3) True