tudelft3d / pprepair

Validation and Automatic Repair of Planar Partitions
GNU General Public License v3.0
57 stars 22 forks source link

pprepair hangs on this geometry #54

Open ldemaz opened 6 years ago

ldemaz commented 6 years ago

Hello, we have encountered a problem with this geometry. It has 6 polygons, with 1 and 2 duplicated. When we run

./pprepair -i polys.shp -o polys_fix.shp -fix

pprepair hangs and has to be aborted. Some testing reveals that the problem lies with option -rrrn. Every other option results in a solution, albeit one that kills polygons 4 and 5 (which seem valid, shown here in red).

We have built pprepair to output to .shp (because of an existing workflow) rather than geojson, and are using it with gdal 2.2.3.

Any thoughts on why this is hanging? Thanks

ldemaz commented 6 years ago

As an update, I can confirm hanging on another geometry also. This is a multipolygon that first went through prepair (fixing a self-intersection).

Pre-prepair:

POLYGON((30.6412432373056 -22.3588451355342,30.6418011367807 -22.3588451355342,30.641672390748 -22.3591240852718,30.640942829896 -22.3590382545833,30.6411788642893 -22.3583086937312,30.6413934410105 -22.3585018127803,30.6410501182566 -22.3585876434688,30.6412432373056 -22.3588451355342)

Post-prepair (i.e. the contents of the shapefile):

MULTIPOLYGON (((30.6412432373056 -22.3588451355342,30.6410770138319 -22.3586235042359,30.640942829896 -22.3590382545833,30.641672390748 -22.3591240852718,30.6418011367807 -22.3588451355342,30.6412432373056 -22.3588451355342)),((30.6413934410105 -22.3585018127803,30.6411788642893 -22.3583086937312,30.6410920036326 -22.3585771721248,30.6413934410105 -22.3585018127803)),((30.6410501182566 -22.3585876434688,30.6410770138319 -22.3586235042359,30.6410920036326 -22.3585771721248,30.6410501182566 -22.3585876434688)))

Which looks like this

It seems that the culprit is again the -rrrn flag (part of -fix).

Tested on RHEL (gdal 2.2.3) and Mac Sierra (gdal 2.2.2).

ldemaz commented 6 years ago

Also, just to add to this, pprepair works on this, if passing other arguments, e.g.

../pprepair/pprepair -i temp2.shp -o tempf.shp -rtnn -rtam

But the results seem to remove two of three parts fairly consistently (i.e. when testing various other options besides -rrlb -rrrn). I haven't used pprepair in a while, but I seem to recall that it should preserve those parts.