[geos-devel] Bug in GEOS polygonizer
mika.heiskanen at fmi.fi
Fri Mar 7 09:10:48 PST 2014
I'm new to GEOS, and this is my first post to this list which I just
I am quite confident I have found a bug in the GEOS polygonizer.
- I have a set of edges which I first polygonize, and then
call buildGeometry on to get a single multipolygon.
- The last two rings in the multipolygon output should not be
there, they have already been listed as holes in earlier
- The extra rings are listed last in the resulting multipolygon,
implying they might be on some internal todo-list, but are
perhaps not correctly removed when added as a hole to the
multipolygon. This todo-list might be the last geometry
collection to be added to the resulting multipolygon.
- The second coordinate of the rings is the first coordinate
of the holes already added. This might imply some internal
sorting/constructing has been done on the rings but perhaps
I will try to debug this myself, but since I am completely
new to the code I would appreciate any hints on where to
look. For this purpose I have temporarily made this link available:
The zip-file contains two files. One named EDGES, containing
about 2000 coordinate pairs forming the resulting polygons by a true
case of contouring temperature over Scandinavia, and
a second file named bug.cpp, a simple test program which uses the
GEOS C++ API and can be compiled in the GEOS source directory as
instructed by the first lines in bug.cpp:
// ./configure CXXFLAGS="-g -O0" && make
// g++ -std=c++11 -Wno-deprecated-declarations -o bug bug.cpp
The test program prints a multipolygon WKT. The last two rings in
it have as their second coordinates:
The rings are embedded in "(( ))" meaning they are polygons in
a multipolygon. However, if you search backward in the output
the same coordinates appear first in holes embedded in "( )".
I will try to debug this on Monday, until then I'm pretty much
booked. Meanwhile any hints on where to look for the bug would be
This bug seems to occur fairly frequently. The test case covers
only one temperature interval in Scandinavia, the same problem
occurred in a couple of the ~20 temperature intervals I calculated.
The test data was the first one I tried.
Mika Heiskanen / Finnish Meteorological Institute
More information about the geos-devel