tudelft3d / pprepair

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

pprepair fails with terminate called after throwing an instance of 'CGAL::Assertion_exception' #4

Closed mgageo closed 12 years ago

mgageo commented 12 years ago

I use pprepair on a small shapefile http://mga.alwaysdata.net/geo/GDB/FSAC_parcelles/ root@debian:/d/web/pprepair# ./pprepair -i FSAC_parcelles.shp -o fixed.shp -fix Adding a new set of polygons to the triangulation... Path: /mnt/USB/FSAC_parcelles/FSAC_parcelles.shp Type: ESRI Shapefile Layers: 1 Reading layer #1 (25 polygons)...

          string          Colonne1
    Feature #9 (10 vertices): self intersecting outer boundary #0. Split.
    Created 2 rings.
    Feature #11: duplicate vertices in outer boundary #0. Removed duplicates.
    Feature #11: incorrect winding in inner boundary #0. Reversed.
    Feature #11: inner boundary cannot fit in any outer boundary. Skipped.
    Feature #15 (16 vertices): self intersecting outer boundary #0. Split.
    Created 3 rings.
    Feature #16 (10 vertices): self intersecting outer boundary #0. Split.

terminate called after throwing an instance of 'CGAL::Assertion_exception' what(): CGAL ERROR: assertion violation! Expr: hcl != NULL File: /usr/include/CGAL/Constraint_hierarchy_2.h Line: 576 Abandon root@debian:

kenohori commented 12 years ago

It works for me...

Adding a new set of polygons to the triangulation... Path: /Users/ken/Desktop/parcelles/FSAC_parcelles.shp Type: ESRI Shapefile Layers: 1 Reading layer #1 (29 polygons)...

  string      Colonne1

Polygons added (0 s). The triangulation has now: Vertices: 132 Edges: 393 Triangles: 254 Tagging... Tagging done (0 s). Input triangulation: Holes: 0 triangles (0.00000000 %) Ok: 254 triangles (100.00000000 %) Overlaps: 0 triangles (0.00000000 %) Repairing regions by longest boundary... Repair successful (0 s). All polygons are now valid. Triangulation already repaired! Repaired triangulation: Holes: 0 triangles (0.00000000 %) Ok: 254 triangles (100.00000000 %) Overlaps: 0 triangles (0.00000000 %) Reconstructing polygons (geometry)... Polygons reconstructed (0 s). Exporting polygons... Overwriting file... Writing file... Polygons exported (0 s). Done! Process finished in 0 minutes 0 seconds.

kenohori commented 12 years ago

Are you sure we're using the same shapefile? I don't even get any errors in it...

Also, I get 29 polygons instead of 25

mgageo commented 12 years ago

Thank for your fast response What I do: for ext in shp shx prj dbf ; do curl -o /tmp/FSAC_parcelles.${ext} http://mga.alwaysdata.net/geo/GDB/FSAC_parcelles/FSAC_parcelles.${ext} done md5sum /tmp/FSAC_parcelles.* ./pprepair -i /tmp/FSAC_parcelles.shp -o fixed.shp -fix The md5 of the files: 407ff92b2718e6f2828052accebdb6e3 /tmp/FSAC_parcelles.dbf 37fdc6bb4d46b104c618c8f8634975ad /tmp/FSAC_parcelles.prj d7ac8220f264ea13352923ffb9a8955d /tmp/FSAC_parcelles.shp 04a01350de5bfeae654ac2d161015cac /tmp/FSAC_parcelles.shx I am on a debian squeeze: Linux debian 2.6.32-5-amd64 #1 SMP Sun Sep 23 10:07:46 UTC 2012 x86_64 GNU/Linux

kenohori commented 12 years ago

Ok, I can reproduce the error now. Short story: Uncomment the line #define EXACT_CONSTRUCTIONS in definitions/CGALDefinitions.h and it will work Longer story: Processing some data sets require a higher level of precision than the default option (floating point) can provide. We don't enable this option by default because it comes with some disadvantages too. It uses far more memory (4x is common), processing takes a bit longer, and output has to be in floating point anyway, so sometimes the data is valid in memory but invalid in the output.

mgageo commented 12 years ago

With this configuration, it's good for me too. Tanks a lot !