id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 8376,difference of non-closed polygons returns closed polygon,Volker Schöch ,Barend Gehrels,"The output multi-polygon from boost::geometry::difference should have the same orientation, closed-ness and underlying scalar data type, as the input (multi-)polygons. My polygon type is '''oriented counter-clockwise''' and '''not closed''', my point type is based on '''int'''. Please find below some code that results in a '''closed''' polygon. ''Note: The sym_difference algorithm has the same problem which I filed as a separate ticket #8375.'' This is the data used as input to difference: {{{ _TPolygon const polygon = _TPolygon(""MULTIPOLYGON(((1920 1462,3720 1462,3720 3262,1920 3262)))"") - _TPolygon(""MULTIPOLYGON(((1918 1957,1918 1657,2218 2189)),((3718 1957,3360 2233,3718 1561)),((3360 2233,2818 3253,2218 2189,2818 2653)))""); }}} This is the resulting multi-polygon, with the first contained polygon being closed: {{{ MULTIPOLYGON(((1920 1660,1920 1462,3720 1462,3720 3262,1920 3262,1920 1958,2218 2189,1920 1660),(3718 1561,3360 2233,3718 1957),(2818 2653,2218 2189,2818 3253,3360 2233))) }}} This is my code that wraps boost::geometry to implement the operator used above: {{{ template template _TPolygon< T > _TPolygon< T >::operator-(Geometry const& geometry) const { // should not be necessary //if( boost::geometry::area(geometry)==0 ) return *this; _TPolygon< T > polygonOut; boost::geometry::difference(*this, geometry, polygonOut); // should not be necessary //boost::geometry::correct( polygonOut ); return polygonOut; } }}}",Bugs,closed,Boost 1.56.0,geometry,Boost 1.55.0,Problem,fixed,"difference, multi-polygon, polygon, closed, open, correct",mkaravel