def test_relate_pattern(): g = shapely.linestrings([(0, 0), (1, 0), (1, 1)]) polygon = shapely.box(0, 0, 2, 2) assert shapely.relate(g, polygon) == "11F00F212" assert shapely.relate_pattern(g, polygon, "11F00F212") assert shapely.relate_pattern(g, polygon, "*********") assert not shapely.relate_pattern(g, polygon, "F********")
def test_relate(): p1 = shapely.points(0, 0) p2 = shapely.points(1, 1) actual = shapely.relate(p1, p2) assert isinstance(actual, str) assert actual == "FF0FFF0F2"
def test_relate_none(g1, g2): assert shapely.relate(g1, g2) is None
def relate(self, other): """Returns the DE-9IM intersection matrix for the two geometries (string)""" return shapely.relate(self, other)