From 47d8d3665dcc12f04d5c025ab646e30259059522 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Mon, 18 Mar 2019 13:31:56 +0100 Subject: [PATCH] FileGDB/OpenFileGDB: be robust when winding order of outer ring is incorrect (fixes #1369) --- .../ogr/data/weird_winding_order_fgdb.zip | Bin 0 -> 29564 bytes autotest/ogr/ogr_fgdb.py | 41 +++++++++++++++++- autotest/ogr/ogr_openfilegdb.py | 18 +++++++- gdal/ogr/ogrpgeogeometry.cpp | 6 ++- .../ogrsf_frmts/openfilegdb/filegdbtable.cpp | 3 +- 5 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 autotest/ogr/data/weird_winding_order_fgdb.zip diff --git a/autotest/ogr/data/weird_winding_order_fgdb.zip b/autotest/ogr/data/weird_winding_order_fgdb.zip new file mode 100644 index 0000000000000000000000000000000000000000..d77081c970e23cc8cbafc15187254e28999962a4 GIT binary patch literal 29564 zcmbTd18}C>(l#91P9~Yywr$(CZD(RmCbn(c=ER!Vb}})(%zn>4-MFmHX|){`Ij$xsUfYAJ4Co|Lch#=bPIY8M_%f8XD;7=>Z$Cf}w-? z2D^dD;(hPN1L%K$X9N-_!3z$(0-&}kySzH6AfNZ6G%c9dw>4s9Z38*!fVy2DhW^~=b8dn0$2fdezwUIhe zc-Mly!TJ~pwd-sLbP13;uK#KCn?K);1+q0R5g7=N8C%`}{t(IFrhOYPY4TAO7wa;b zI?W96WXlX>)LG8*uG{&!15%(!p!L$FmIG?Iph&x*zn4-1Ef>)MsO>A&%RV|hE*r(qmvzm$K$^Ri4 zybrzkBPIElWZce1`62xP5QL^tuk^q)F~+f7=z=k&^pR}O{fGna_1??}OR+p0ZI7)x zmg5N7<0xC=NY$@(kw1Xb1oR^dI|wRUM^Y*W)PQE~9U4 zOr!7Qc9x_K=TCcbtanyv|7T9C=k?8SMwD8}`R*d|B0GWaI`{`EgF*FZqLnbwIi%i2 z>wA_{wPlCthMh|n@bk$Rs*WDYz*%GSbm~$5M=IluFy~S7z*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gVh_KWP+zH3!-Negyk->>okC2>s?50KtBC0|27| z`{1F6X2$eiqXE0(fw6$C;m}y0ng467zZ%7XF@Vj^(CR5cTsQx%djHn?42%bC(}l*n z!~S36{pzFuZ2W}QjR?}H^V?(k^}7(*TL}eYLX?;{0srfDGO&ROioNyZ=GdR!g}}}u zC^qBw*njpR0bfI4*ANse$oJcP|DNXf>D&mMFM(p;>D(OqQyG9WBT(#Z-5X&4IZpyC z#IG*{{ceK(pUc31pXh)lyY_1$WWWM515S8AIW&5|JZR|jhl0#4$QM-@7$(T?3S>sf K2l6BsnEwOS?S?Y| literal 0 HcmV?d00001 diff --git a/autotest/ogr/ogr_fgdb.py b/autotest/ogr/ogr_fgdb.py index 0e761957cb18..1d1f68b54416 100755 --- a/autotest/ogr/ogr_fgdb.py +++ b/autotest/ogr/ogr_fgdb.py @@ -2100,6 +2100,9 @@ def test_ogr_fgdb_23(): def test_ogr_fgdb_24(): + if ogrtest.fgdb_drv is None: + pytest.skip() + ds = ogr.Open('data/filegdb_polygonzm_m_not_closing_with_curves.gdb') lyr = ds.GetLayer(0) ds_ref = ogr.Open('data/filegdb_polygonzm_m_not_closing_with_curves.gdb.csv') @@ -2127,6 +2130,9 @@ def test_ogr_fgdb_24(): def test_ogr_fgdb_25(): + if ogrtest.fgdb_drv is None: + pytest.skip() + ds = ogr.Open('data/curves.gdb') sql_lyr = ds.ExecuteSQL('SELECT OBJECTID FROM polygon WHERE OBJECTID = 2') assert sql_lyr is not None @@ -2145,7 +2151,36 @@ def test_ogr_fgdb_25(): f.DumpReadable() pytest.fail() - + +############################################################################### +# Test bugfix for https://github.com/OSGeo/gdal/issues/1369 +# where a polygon with inner rings has its exterior ring with wrong orientation + +def test_ogr_fgdb_weird_winding_order(): + + if ogrtest.fgdb_drv is None: + pytest.skip() + + if not ogr_fgdb_is_sdk_1_4_or_later(): + pytest.skip('SDK 1.4 required') + + if not ogrtest.have_geos(): + pytest.skip() + + try: + shutil.rmtree('tmp/roads_clip Drawing.gdb') + except OSError: + pass + gdaltest.unzip('tmp', 'data/weird_winding_order_fgdb.zip') + + ds = ogr.Open('tmp/roads_clip Drawing.gdb') + lyr = ds.GetLayer(0) + f = lyr.GetNextFeature() + g = f.GetGeometryRef() + assert g.GetGeometryCount() == 1 + assert g.GetGeometryRef(0).GetGeometryCount() == 17 + + ############################################################################### # Cleanup @@ -2171,6 +2206,10 @@ def test_ogr_fgdb_cleanup(): shutil.rmtree('tmp/test3005.gdb') except OSError: pass + try: + shutil.rmtree('tmp/roads_clip Drawing.gdb') + except OSError: + pass if ogrtest.openfilegdb_drv is not None: ogrtest.fgdb_drv.Deregister() diff --git a/autotest/ogr/ogr_openfilegdb.py b/autotest/ogr/ogr_openfilegdb.py index 83e834a64899..6c22befe671e 100755 --- a/autotest/ogr/ogr_openfilegdb.py +++ b/autotest/ogr/ogr_openfilegdb.py @@ -1315,7 +1315,23 @@ def test_ogr_openfilegdb_21(): f.DumpReadable() pytest.fail() - +############################################################################### +# Test bugfix for https://github.com/OSGeo/gdal/issues/1369 +# where a polygon with inner rings has its exterior ring with wrong orientation + +def test_ogr_openfilegdb_weird_winding_order(): + + if not ogrtest.have_geos(): + pytest.skip() + + ds = ogr.Open('/vsizip/data/weird_winding_order_fgdb.zip/roads_clip Drawing.gdb') + lyr = ds.GetLayer(0) + f = lyr.GetNextFeature() + g = f.GetGeometryRef() + assert g.GetGeometryCount() == 1 + assert g.GetGeometryRef(0).GetGeometryCount() == 17 + + ############################################################################### # Cleanup diff --git a/gdal/ogr/ogrpgeogeometry.cpp b/gdal/ogr/ogrpgeogeometry.cpp index 84461f72edd4..b5a703ecdab6 100644 --- a/gdal/ogr/ogrpgeogeometry.cpp +++ b/gdal/ogr/ogrpgeogeometry.cpp @@ -2882,8 +2882,12 @@ OGRErr OGRCreateFromShapeBin( GByte *pabyShape, if( tabPolygons != nullptr ) { int isValidGeometry = FALSE; + // The outer ring is supposed to be clockwise oriented + // If it is not, then use the default/slow method. const char* papszOptions[] = - { "METHOD=ONLY_CCW", nullptr }; + { !(tabPolygons[0]->getExteriorRing()->isClockwise()) ? + "METHOD=DEFAULT" : "METHOD=ONLY_CCW", + nullptr }; poOGR = OGRGeometryFactory::organizePolygons( reinterpret_cast(tabPolygons), nParts, diff --git a/gdal/ogr/ogrsf_frmts/openfilegdb/filegdbtable.cpp b/gdal/ogr/ogrsf_frmts/openfilegdb/filegdbtable.cpp index 1c97556d2821..c3805b8cba46 100644 --- a/gdal/ogr/ogrsf_frmts/openfilegdb/filegdbtable.cpp +++ b/gdal/ogr/ogrsf_frmts/openfilegdb/filegdbtable.cpp @@ -3104,9 +3104,8 @@ OGRGeometry* FileGDBOGRGeometryConverterImpl::GetAsGeometry(const OGRField* psFi } delete[] papoRings; papoRings = nullptr; - const char* papszOptions[] = { "METHOD=ONLY_CCW", nullptr }; poRet = OGRGeometryFactory::organizePolygons( - (OGRGeometry**) papoPolygons, nParts, nullptr, papszOptions ); + (OGRGeometry**) papoPolygons, nParts, nullptr, nullptr ); delete[] papoPolygons; } #ifdef ASSUME_INNER_RINGS_IMMEDIATELY_AFTER_OUTER_RING