id summary reporter owner description type status milestone component version severity resolution keywords cc 10661 difference algorithm returning invalid geometry Volker Schöch Barend Gehrels "My ""_TPolygon"" type is actually a '''multi-polygon''', using a polygon type that is based on '''int''', oriented '''counter-clockwise''' and '''open''' (not closed). Please consider the following example: {{{ _TPolygon polygonA; boost::geometry::read_wkt(""MULTIPOLYGON(((1701 985,3501 985,3501 2785,1701 2785,1701 985)))"", polygonA); // does not throw boost::geometry::is_valid(polygonA); // returns true _TPolygon polygonB; boost::geometry::read_wkt(""MULTIPOLYGON(((1698 1860,1698 1122,2598 1392,3492 1842,3492 32706,2598 2340,1698 1860)))"", polygonB); // does not throw boost::geometry::is_valid(polygonB); // returns true _TPolygon polygonC; boost::geometry::difference(polygonA, polygonB, polygonC); // does not throw // polygonC: MULTIPOLYGON(((1701 1122,1701 985,3501 985,3501 2785,3492 1857,3492 1842,2598 1392,1701 1122)),((1701 1861,2598 2340,1669 2785,1701 2785,1701 1861))) boost::geometry::is_valid(polygonC); // returns false! _TPolygon polygonD; boost::geometry::read_wkt(""MULTIPOLYGON(((1698 2772,1698 1860,2598 2340,3492 2412,3492 32743,1698 2772)))"", polygonD); // does not throw boost::geometry::is_valid(polygonD); // returns true _TPolygon polygonE; boost::geometry::difference(polygonC, polygonD, polygonE); // throws ""Boost.Geometry Overlay invalid input exception""! }}} This '''worked in boost 1.55.0'''. The result for polygonC was slightly different in 1.55.0, and there was a reasonable(?) result for polygonE: {{{ polygonC: MULTIPOLYGON(((1701 1122,1701 985,3501 985,3501 2785,3492 2785,3492 1842,2598 1392,1701 1122)),((1701 1861,2598 2340,2611 2785,1701 2785,1701 1861))) polygonE: MULTIPOLYGON(((3492 2412,3492 1842,2598 1392,1701 1122,1701 985,3501 985,3501 2785,3492 2785,3492 2412),(1701 1861,2598 2340,1701 1861))) }}} " Bugs closed To Be Determined geometry Boost 1.56.0 Regression duplicate difference, multi-polygon, polygon, self-intersection