def test_ogr_lvbag_invalid_polygon(): pytest.skip() if not ogrtest.have_geos() and not ogrtest.have_sfcgal(): pytest.skip() ds = ogr.Open('data/lvbag/inval_polygon.xml') assert ds is not None, 'cannot open dataset' assert ds.GetLayerCount() == 1, 'bad layer count' lyr = ds.GetLayer(0) feat = lyr.GetNextFeature() assert feat.GetGeomFieldRef(0).IsValid() feat = lyr.GetNextFeature() assert feat.GetGeomFieldRef(0).IsValid() feat = lyr.GetNextFeature() assert feat.GetGeomFieldRef(0).IsValid() feat = lyr.GetNextFeature() assert feat.GetGeomFieldRef(0).IsValid() feat = lyr.GetNextFeature() assert feat is None
def test_ogr_lvbag_invalid_polygon(): pytest.skip() if not ogrtest.have_geos() and not ogrtest.have_sfcgal(): pytest.skip() ds = gdal.OpenEx('data/lvbag/inval_polygon.xml', gdal.OF_VECTOR, open_options=['AUTOCORRECT_INVALID_DATA=YES']) assert ds is not None, 'cannot open dataset' assert ds.GetLayerCount() == 1, 'bad layer count' lyr = ds.GetLayer(0) feat = lyr.GetNextFeature() assert feat.GetGeomFieldRef(0).IsValid() feat = lyr.GetNextFeature() assert feat.GetGeomFieldRef(0).IsValid() feat = lyr.GetNextFeature() assert feat.GetGeomFieldRef(0).IsValid() feat = lyr.GetNextFeature() assert feat.GetGeomFieldRef(0).IsValid() feat = lyr.GetNextFeature() assert feat is None