-
Notifications
You must be signed in to change notification settings - Fork 227
Open
Labels
Description
Consider the test case:
namespace cartesian {
using point = boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>;
using linestring = boost::geometry::model::linestring<point>;
using polygon = boost::geometry::model::polygon<point>;
using multipolygon = boost::geometry::model::multi_polygon<polygon>;
using mpoint = boost::geometry::model::multi_point<point>;
}
namespace spherical {
using point = boost::geometry::model::d2::point_xy<double, boost::geometry::cs::spherical_equatorial<boost::geometry::degree> >;
using linestring = boost::geometry::model::linestring<point>;
using polygon = boost::geometry::model::polygon<point>;
using multipolygon = boost::geometry::model::multi_polygon<polygon>;
using mpoint = boost::geometry::model::multi_point<point>;
const double earthRadiusMts = 6371000;
}
BOOST_AUTO_TEST_CASE(testUnionBug) {
auto p1wkt = "POLYGON((-78.4072265625001 43.06652924482626,-78.4072265625 43.06740063068311,-78.4063141178686 43.06653210403569,-78.4072265625001 43.06652924482626))";
auto p2wkt = "POLYGON((-78.55968743491499 43.06594969590624,-78.55036227331367 43.07380195109801,-78.53503704605811 43.08248347074284,-78.51769210872999 43.08880392487917,-78.49899564953199 43.09251971058174,-78.47966844278045 43.09348761253013,-78.46045580120891 43.09167037120638,-78.44209853911326 43.08713812460473,-78.42530412309867 43.08006566649393,-78.41071917768537 43.07072563376782,-78.40631359930124 43.06653210565861,-78.55968743491499 43.06594969590624))";
{
spherical::polygon p1,p2;
boost::geometry::read_wkt(p1wkt, p1);
boost::geometry::read_wkt(p2wkt, p2);
spherical::multipolygon out;
boost::geometry::union_(
p1,
p2,
out);
std::cout << "Spherical union: " << boost::geometry::wkt(out) << std::endl;
}
{
cartesian::polygon p1,p2;
boost::geometry::read_wkt(p1wkt, p1);
boost::geometry::read_wkt(p2wkt, p2);
cartesian::multipolygon out;
boost::geometry::union_(
p1,
p2,
out);
std::cout << "Cartesian union: " << boost::geometry::wkt(out) << std::endl;
}
}
when executed against Boost 1.66 the output is:
Spherical union: MULTIPOLYGON()
Cartesian union: MULTIPOLYGON(((-78.5597 43.0659,-78.5504 43.0738,-78.535 43.0825,-78.5177 43.0888,-78.499 43.0925,-78.4797 43.0935,-78.4605 43.0917,-78.4421 43.0871,-78.4253 43.0801,-78.4107 43.0707,-78.4063 43.0665,-78.5597 43.0659)))
Now I assume that union can only be empty if both constituting geometries are empty and under this assumption i take it this a bug. I will continue trying to diagnose and put more info, but as diagnostics are time consuming, I am submitting the issue as i see it now.
This the same general problem domain myself and @vosst have been working on (and earlier raised #470).