[geos-devel] [GEOS] #959: Reversed result in GEOSClipByRect
GEOS
geos-trac at osgeo.org
Mon Mar 11 08:36:18 PDT 2019
#959: Reversed result in GEOSClipByRect
-------------------------+--------------------------
Reporter: Algunenano | Owner: geos-devel@…
Type: defect | Status: new
Priority: major | Milestone: 3.5.2
Component: Default | Version: 3.5.0
Severity: Significant | Keywords:
-------------------------+--------------------------
When passing the following **invalid** geometry to GEOSClipByRect, the
result of the clipping is reversed (you get the part of the box that
doesn't intersects with the geometry).
{{{
template<> template<> void object::test<14>
()
{
const char* wkt = "POLYGON((680 2050,682 2050,683 2054,686 2059,690
2061,694 2062,697 2065,699 2071,700 2080,701 2081,702 2081,703 2082,702
2083,701 2084,701 2085,699 2086,700 2086,699 2086,698 2085,699 2085,695
2083,689 2083,687 2083,685 2085,679 2083,677 2081,677 2078,673 2069,668
2062,667 2062,666 2062,665 2060,667 2058,667 2056,665 2055,666 2055,666
2054,667 2053,666 2052,667 2050,668 2050,670 2054,672 2052,673 2053,674
2052,676 2050,679 2050,680 2050))";
geom1_ = GEOSGeomFromWKT(wkt);
geom2_ = GEOSClipByRect(geom1_, -8, -8, 2056, 2056);
isEqual(geom2_, "POLYGON((665 2055,667 2056,684.2 2056,683 2054,682
2050,680 2050,679 2050,676 2050,674 2052,673 2053,672 2052,670 2054,668
2050,667 2050,666 2052,667 2053,666 2054,666 2055,665 2055))");
}
}}}
This is affecting Postgis, both in ST_ClipByBox2d and ST_AsMVTGeom
(although it has a hack to try to detect this and drop the geometry
completely).
--
Ticket URL: <https://trac.osgeo.org/geos/ticket/959>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).
More information about the geos-devel
mailing list