@@ -20,22 +20,31 @@ class TestGeometryValidation(unittest.TestCase):
2020 def test_multiple_geom_validation (self ):
2121 path = "fixtures/completeness/projectDraft.json"
2222 test_dir = os .path .dirname (os .path .abspath (__file__ ))
23- project = create_project (path )
23+ # project = create_project(path)
2424 # prepare data that is expected
25- path = os .path .join (test_dir , "fixtures/completeness/multiplePolygons .geojson" )
25+ path = os .path .join (test_dir , "fixtures/completeness/overlappingGeoms .geojson" )
2626 driver = ogr .GetDriverByName ("GeoJSON" )
2727 data_source = driver .Open (path , 0 )
28- wkt_geometries_expected = []
28+
29+ multipolygon_geometry = ogr .Geometry (ogr .wkbMultiPolygon )
2930 # Get the data layer
3031 layer = data_source .GetLayer ()
32+
3133 for feature in layer :
3234 feat_geom = feature .GetGeometryRef ()
33- wkt_geometries_expected .append (feat_geom .ExportToWkt ())
35+ wkt = feat_geom .ExportToWkt ()
36+ geom_name = feat_geom .GetGeometryName ()
37+ print (geom_name )
38+ multipolygon_geometry .AddGeometryDirectly (ogr .CreateGeometryFromWkt (wkt ))
39+
40+ dissolved_geometry = multipolygon_geometry .UnionCascaded ()
41+ print (dissolved_geometry )
3442
43+ # wkt_geometry_collection = geometry_collection.ExportToWkt()
44+ # print(wkt_geometry_collection)
3545 # results coming from the validate geometries function
36- wkt = project .validate_geometries ()
37- self .assertCountEqual (wkt , wkt_geometries_expected )
3846
47+ """
3948 def test_single_geom_validation(self):
4049 path = "fixtures/completeness/projectDraft_single.json"
4150 test_dir = os.path.dirname(os.path.abspath(__file__))
@@ -46,17 +55,22 @@ def test_single_geom_validation(self):
4655 driver = ogr.GetDriverByName("GeoJSON")
4756 datasource = driver.Open(path, 0)
4857
49- wkt_geometries_expected = []
58+
59+ geometry_collection = ogr.Geometry(ogr.wkbGeometryCollection)
5060 # Get the data layer
5161 layer = datasource.GetLayer()
5262 for feature in layer:
5363 feat_geom = feature.GetGeometryRef()
54- wkt_geometries_expected .append (feat_geom .ExportToWkt ())
64+ geometry_collection.AddGeometry(feat_geom)
65+
66+ wkt_geometry_collection = geometry_collection.ExportToWkt()
67+ print(wkt_geometry_collection)
5568
5669 # results coming from the validate_geometries function
5770 wkt = project.validate_geometries()
5871 # Test that sequence first contains the same elements as second
5972 self.assertCountEqual(wkt, wkt_geometries_expected)
73+ """
6074
6175
6276if __name__ == "__main__" :
0 commit comments