tudelft3d / pprepair

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

pprepair triangulation (--outtr option) contains invalid polygons #33

Closed lucasmation closed 8 years ago

lucasmation commented 8 years ago

We noticed that the pprepair output file with the triangulation contains invalid polygons. Upon inspection, the triangulation contains some elements that are actually points or lines. You can reproduce this error with any of the Brasil, Enumeration District files.

We ran: pprepair -i file.shp -v --outtr triang.shp (pprepair-new version, from maybe a week ago)

Then imported triang.shp in Postgis, and tested the Validity of the polygons ( ST_IsValid). A small fraction of the polygons are invalid. After fixing them in POSTGIS (ST_MakeValid) the invalid polygons all became either points or lines (I'll post a follow up comment with frequency of such problems).

Visual inspection seemed to indicate that these invalid polygons were "redundant" (i.e. for every point/line (invalid polygon) there were two valid triangles for which borders coincide with the point/line. So I just deleted the invalid polygons. However, after deleting the triangulation is no longer is a planar partition. I tried running ST_Union on the "cleaned" triangulation and got "non noded intersection" error messages.

PS: we finally gave up installing pprepair on Linux and installed it on a MAC-OS (in fact VirtualBox inside another machine). So now we think we have an environment similar to what the developers use.

lucasmation commented 8 years ago

I just checked with pprepair master branch and this also happens.

For example, with the master branch:

hugoledoux commented 8 years ago

this is linked to floating-point precision, better explained in #35