def test_shp_polygons_containsEmpty(): """ Selecting all points within a Polygon. """ pc_in = read_las.read("testdata/AHN2.las") pc_out = points_in_polygon_shp_file(pc_in, "testdata/ahn2_geometries_shp/ahn2_polygon_empty.shp") x = pc_out[point]['x']['data'] y = pc_out[point]['y']['data'] assert (len(x) == 0) assert (len(y) == 0)
def test_shp_polygons_contains(): """ Selecting all points within a Polygon. """ pc_in = read_las.read("testdata/AHN2.las") pc_out = points_in_polygon_shp_file(pc_in, "testdata/ahn2_geometries_shp/ahn2_polygon.shp") x = pc_out[point]['x']['data'] y = pc_out[point]['y']['data'] # Seemingly redundant 'astype' call: since pandas 0.24 Dataframe() doesn't enforce the given dtype as before df_out = pd.DataFrame({'x': x, 'y': y}, dtype=np.int32).astype(dtype=np.int32) df = pd.read_csv("testdata/ahn2_polygon.out", sep=',', header=0, index_col=0, dtype=np.int32) assert (pd.DataFrame.equals(df, df_out))
def test_points_in_polygon_shp_invalidPolygon(): pc_in = read_las.read("testdata/AHN2.las") with pytest.raises(ValueError): points_in_polygon_shp_file(pc_in, "testdata/ahn2_geometries_shp/invalid_polygon.shp")
def test_points_in_polygon_shp_MultiLine(): pc_in = read_las.read("testdata/AHN2.las") with pytest.raises(ValueError): points_in_polygon_shp_file(pc_in, "testdata/ahn2_geometries_shp/multiline.shp")