tudelft3d / prepair

Automatic repair of single polygons (according to the OGC Simple Features / ISO19107 rules) using a constrained triangulation.
GNU General Public License v3.0
115 stars 24 forks source link

Segmentation fault/core dump #6

Closed ldemaz closed 10 years ago

ldemaz commented 10 years ago

Hi Hugo and Ken,

I have prepair and pprepair integrated into a nice workflow on my system with postgis/postGRES, called out of a set of python scripts (I am happy to send these along if interested).
I am writing an updated script now, but have come across a segmentation fault with prepair.

./prepair --wkt 'POLYGON((27.6731453499999986 -31.9559552800000013, 27.6731453499999986 -31.9559552800000013, 27.6735961699999997 -31.9556177800000007, 27.6735961699999997 -31.9556177800000007, 27.6739497499999985 -31.9559627800000001, 27.6739497499999985 -31.9559627800000001, 27.6735342899999992 -31.9562815299999983, 27.6735342899999992 -31.9562815299999983, 27.6735342899999992 -31.9562815299999983, 27.6731453499999986 -31.9559552800000013))'

Segmentation fault (core dumped)

Could you please advise what I am doing wrong here, or whether this geometry has something flawed (although geos tells me its valid).

Thanks!

kenohori commented 10 years ago

Hi,

This particular polygon also crashes for me. I'll debug it and let you know.

hugoledoux commented 10 years ago

Crashed also for me, although I'd be surprised if GEOS returned that it's valid. My GEOS says duplicate vertices, and you can see that first two are identical.

ldemaz commented 10 years ago

Thanks for looking into this for me. So, a bit more information: this is one polygon out of 9. Pprepair processes the set of them without complaint - this is one polygon out of a set of 8 or 9. All fail when processed separately with prepair.

For some reason, when I call gIsValid (R's bindings to geos) to inspect each polygon (read into a spatialPolygonsDataFrame) in this set, it says they are all valid.

Look forward to your further thoughts on this. Thanks!

kenohori commented 10 years ago

It's fixed now. Apparently the CGAL function is_edge(...) has problems if you pass the same vertex twice, so now we check for duplicate vertices before it.

ldemaz commented 10 years ago

Excellent, thanks! I will reinstall the latest build.

kenohori commented 10 years ago

Great. Thanks for the bug report!