def test_polygon_input():
# polygon closes open paths
outl1 = ((0, 0), (0, 1), (1, 1.), (1, 0), (0, 0))
outl2 = ((1, 1), (1, 2), (2, 2.), (2, 1), (1, 1))
nan = np.ones(shape=(1, 2)) * np.nan
outl = np.vstack((outl1, nan, outl2))
outl_poly = MultiPolygon([Polygon(outl1), Polygon(outl2)])
r = Region_cls(1, 'Unit Square', 'USq', outl_poly)
assert np.allclose(r.coords, outl, equal_nan=True)
assert r.polygon == outl_poly
评论列表
文章目录