tudelft3d/pprepair

pprepair hangs on this geometry

ldemaz opened this issue · 2 comments

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

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).

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.