def test_wkt_polygons_containsEmpty():
     """ Selecting all points within a Polygon. """
     pc_in = read_las.read("testdata/AHN2.las")
     pc_out = points_in_polygon_wkt_file(pc_in, "testdata/ahn2_geometries_wkt/ahn2_polygon_empty.wkt")
     x = pc_out[point]['x']['data']
     y = pc_out[point]['y']['data']
     assert (len(x) == 0)
     assert (len(y) == 0)
    def test_wkt_polygons_contains(self):
        """Selecting all points within a Polygon with artificial data."""
        test_data = ComplexTestData()
        path = os.path.join(self._test_dir, 'wkt_test.wkt')
        with open(path, 'w') as f:
            f.write(test_data.get_wkt_polygon_around_first_point_only())
        pc_in = test_data.get_point_cloud()
        expected_point = np.array(pc_in[point]['x']['data'][0], pc_in[point]['y']['data'][0])

        pc_out = points_in_polygon_wkt_file(pc_in, path)

        assert_equal(len(pc_out[point]['x']['data']), 1)
        selected_point = np.array(pc_out[point]['x']['data'][0], pc_out[point]['y']['data'][0])
        np.testing.assert_allclose(selected_point, expected_point)
 def test_points_in_polygon_wkt_invalidPolygon():
     pc_in = read_las.read("testdata/AHN2.las")
     with pytest.raises(ValueError):
         points_in_polygon_wkt_file(pc_in, "testdata/ahn2_geometries_wkt/invalid_polygon.wkt")
 def test_points_in_polygon_wkt_MultiLine():
     pc_in = read_las.read("testdata/AHN2.las")
     with pytest.raises(ValueError):
         points_in_polygon_wkt_file(pc_in, "testdata/ahn2_geometries_wkt/multiline.wkt")