[geos-devel] Assertion failed during Buffer() on invalid geometry
John Leslie
jleslie at placebase.com
Wed Oct 24 20:51:31 EDT 2007
Hello,
So I was just trying to clean up some invalid geometries in a PostGIS
database, using Buffer(the_geom, 0), when I had GEOS fail an assertion
on me:
[local]:vmap0=# select IsValid(the_geom) from bad_geom;
NOTICE: Ring Self-intersection at or near point -67.1954 44.9132
isvalid
---------
f
[local]:vmap0=# select Buffer(the_geom, 0) from bad_geom;
server closed the connection unexpectedly
The last line in the postgres serverlog before it went down was:
[local] SELECT: ../../source/headers/geos/noding/SegmentString.h:175:
void geos::noding::SegmentString::testInvariant() const: Assertion
`pts->size() > 1' failed.
The gdb backtrace:
#0 0x00002ae52f25107b in raise () from /lib/libc.so.6
#1 0x00002ae52f25284e in abort () from /lib/libc.so.6
#2 0x00002ae52f24aaf4 in __assert_fail () from /lib/libc.so.6
#3 0x00002ae531b18bcb in
geos::noding::SegmentString::notifyCoordinatesChange (this=0x13b30a0)
at ../../source/headers/geos/noding/SegmentString.h:175
#4 0x00002ae531b197d6 in geos::noding::ScaledNoder::scale (this=<value
optimized out>, segStrings=<value optimized out>)
at ScaledNoder.cpp:160
#5 0x00002ae531b198bf in geos::noding::ScaledNoder::computeNodes
(this=0x7fff7bd57940, inputSegStr=0x7fff7bd57710)
at ScaledNoder.cpp:205
#6 0x00002ae531b1f783 in
geos::operation::buffer::BufferBuilder::computeNodedEdges
(this=0x7fff7bd578d0,
bufferSegStrList=@0x7fff7bd57710, precisionModel=<value optimized
out>) at BufferBuilder.cpp:258
#7 0x00002ae531b1fa3e in geos::operation::buffer::BufferBuilder::buffer
(this=0x7fff7bd578d0, g=0x976170, distance=0)
at BufferBuilder.cpp:146
#8 0x00002ae531b21e6a in
geos::operation::buffer::BufferOp::bufferFixedPrecision
(this=0x7fff7bd57ab0,
fixedPM=@0x7fff7bd57a30) at BufferOp.cpp:232
#9 0x00002ae531b21fe4 in
geos::operation::buffer::BufferOp::bufferReducedPrecision
(this=0x7fff7bd57ab0,
precisionDigits=<value optimized out>) at BufferOp.cpp:196
#10 0x00002ae531b2203c in
geos::operation::buffer::BufferOp::bufferReducedPrecision
(this=0x7fff7bd57ab0) at BufferOp.cpp:145
#11 0x00002ae531b2243e in
geos::operation::buffer::BufferOp::getResultGeometry (this=0x7b4a,
nDistance=44494)
at BufferOp.cpp:96
#12 0x00002ae531b2259b in geos::operation::buffer::BufferOp::bufferOp
(g=<value optimized out>, distance=0,
quadrantSegments=8, nEndCapStyle=0) at BufferOp.cpp:88
#13 0x00002ae531802f8a in GEOSBuffer (g1=0x7b4a, width=44494,
quadrantsegments=31562) at geos_c.cpp:843
#14 0x00002ae5316bfa77 in buffer (fcinfo=0x7fff7bd57bf0) at
lwgeom_geos_c.c:776
#15 0x00000000004fdf2d in ExecMakeFunctionResult ()
it looks like pts->size() was 1:
(gdb) print pts->getSize()
$2 = 1
If I run the query with GEOS compiled with NDEBUG, I get:
[local]:vmap0=# select Buffer(the_geom, 0) from bad_geom;
NOTICE: IllegalArgumentException: Cannot compute the quadrant for two
identical points -67528 44494
ERROR: GEOS buffer() threw an error!
This occurs with both svn rev 2029 and 3.0.0r4 (with PostGIS 1.3.1 and
PG 8.2.5).
A copy of the shapefile of the geometry that broke is at
http://66.234.145.9/~jleslie/bad_geom.tgz . FWIW, the invalid geometry
in question is for the '046HH' boundary in tiger/line's 2004 zcta layer.
BTW, are there any other recommended ways of "fixing" this type of
invalid geometry besides Buffer()?
Thanks,
John
More information about the geos-devel
mailing list