Esempio n. 1
0
def test_check_multi_polygon_in_single_polygon():
    inner_pols = Polygons(SMALL_POLY_INNER + SMALL_POLY_OVERLAP_INNER)
    outer_pol = Polygons(SMALL_POLY_OUTER)

    inner_pols.operation_polygons(outer_pol,
                                  value=1,
                                  opname="eli",
                                  inside=True)
    assert len(inner_pols.dataframe) == 0
Esempio n. 2
0
def test_check_single_polygon_in_single_polygon():
    inner_pol = Polygons(SMALL_POLY_INNER)
    outer_pol = Polygons(SMALL_POLY_OUTER)

    # Do not delete inner_pol when specified to delete polygons inside inner polygon
    inner_pol.operation_polygons(outer_pol,
                                 value=1,
                                 opname="eli",
                                 inside=False)
    assert len(inner_pol.dataframe) == 5

    # Do not delete outer_pol when specified to delete polygons outside outer polygon
    outer_pol.operation_polygons(inner_pol, value=1, opname="eli", inside=True)
    assert len(outer_pol.dataframe) == 5

    inner_pol.operation_polygons(outer_pol, value=1, opname="eli", inside=True)
    assert len(inner_pol.dataframe) == 0

    inner_pol = Polygons(SMALL_POLY_INNER)

    outer_pol.operation_polygons(inner_pol,
                                 value=1,
                                 opname="eli",
                                 inside=False)
    assert len(outer_pol.dataframe) == 0