def test_multipoint_cx_selection(gp_multipoint, rect): x0, y0, x1, y1 = rect for xslice in get_slices(x0, x1): for yslice in get_slices(y0, y1): expected = MultiPointArray.from_geopandas(gp_multipoint.cx[xslice, yslice]) result = MultiPointArray.from_geopandas(gp_multipoint).cx[xslice, yslice] assert all(expected == result)
def test_multipoint_array(): points = MultiPointArray([ unit_square_cw, large_square_ccw, np.concatenate([large_square_ccw, unit_square_cw]) ]) np.testing.assert_equal(points.length, [0.0, 0.0, 0.0]) np.testing.assert_equal(points.area, [0.0, 0.0, 0.0]) assert points.total_bounds == (0.0, 0.0, 3.0, 3.0)
def test_multipoint_intersects_rect(gp_multipoint, rect): sg_rect = sg.box(*rect) expected = gp_multipoint.intersects(sg_rect) multipoints = MultiPointArray.from_geopandas(gp_multipoint) # Test MultiPointArray.intersects_rect result = multipoints.intersects_bounds(rect) np.testing.assert_equal(result, expected) # Test MultiPointArray.intersects_rect with inds inds = np.flipud(np.arange(0, len(multipoints))) result = multipoints.intersects_bounds(rect, inds) np.testing.assert_equal(result, np.flipud(expected)) # Test MultiPoint.intersects_rect result = np.array( [multipoint.intersects_bounds(rect) for multipoint in multipoints]) np.testing.assert_equal(result, expected)