tudelft3d / pprepair

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

segmentation fault #17

Closed lucsom closed 10 years ago

lucsom commented 10 years ago

Hi, i have a segmentation fault with pprepair under : ubuntu 10.04 + gdal 1.9.0 + libcgal 3.5.1-1. Same result with or without .prj. Is there anyone meeting the same issue ? or having the solution ? Sorry, i'm a beginner with this forum and program.

root@ubuntu:/home/administrateur/tudelft-gist-pprepair-c8bab39# ls CMakeCache.txt definitions FaceInfo.cpp LICENSE.txt PolygonHandle.cpp README.md CMakeFiles essai_region.prj FaceInfo.h Makefile PolygonHandle.h test cmake_install.cmake essai_region.shp IOWorker.cpp PlanarPartition.cpp pprepair test_noprj CMakeLists.txt essai_region.shx IOWorker.h PlanarPartition.h pprepair.cpp

root@ubuntu:/home/administrateur/tudelft-gist-pprepair-c8bab39# ./pprepair -i "essai_region.shp" -o "essai_region_output.shp" -fix Adding a new set of polygons to the triangulation... Path: essai_region.shp Type: ESRI Shapefile Layers: 1 Reading layer #1 (154705408 polygons)... Erreur de segmentation

hugoledoux commented 10 years ago

Does it do that with all shp? Can you successfully run pprepair with other files?

Put the problematic file somewhere and send us the link, we'll try it (the shp, dbf and shx).

lucsom commented 10 years ago

Here are the two packages used without success. It does that with all shp.

https://melanissimo.developpement-durable.gouv.fr/lecture.jsf?uuid=1085727550cbf14097631dd042beadf2

Le 29/11/2013 15:03, "> Hugo Ledoux (par Internet, dépôt noreply@github.com)" a écrit :

Does it do that with all shp? Can you successfully run pprepair with other files?

Put the problematic file somewhere and send us the link, we'll try it (the shp, dbf and shx).

— Reply to this email directly or view it on GitHub https://github.com/tudelft-gist/pprepair/issues/17#issuecomment-29517787.

hugoledoux commented 10 years ago

Your site's security certificate is not secure, I'd rather not connect to it.

All shapefiles? Can you try with that simple one: https://www.dropbox.com/sh/azzs7e1mrqjn8hl/0yM2R_hNpd

that's the output I get:

$ pprepair -i somepolygons2.shp -o out.shp -fix Adding a new set of polygons to the triangulation... Path: somepolygons2.shp Type: ESRI Shapefile Layers: 1 Reading layer #1 (9 polygons)...

  string      CODE_00
    double      AREA

Polygons added (0 s). The triangulation has now: Vertices: 309 Edges: 924 Triangles: 600 Tagging... Tagging done (0 s). Input triangulation: Holes: 2 triangles (0.333333 %) Ok: 596 triangles (99.333333 %) Overlaps: 2 triangles (0.333333 %) Repairing regions by longest boundary... Repair successful (0 s). All polygons are now valid. Triangulation already repaired! Repaired triangulation: Holes: 0 triangles (0.000000 %) Ok: 600 triangles (100.000000 %) Overlaps: 0 triangles (0.000000 %) Reconstructing polygons (geometry)... Removed 4 constrained edges Polygons reconstructed (0 s). Exporting polygons... Overwriting file... Writing file... Polygons exported (0 s). Done! Process finished in 0 minutes 0 seconds.

lucsom commented 10 years ago

Same issue than before :

root@ubuntu:/home/administrateur/tudelft-gist-pprepair-c8bab39# ls CMakeCache.txt FaceInfo.cpp Makefile
pprepair somepolygons2.shp CMakeFiles FaceInfo.h PlanarPartition.cpp
pprepair.cpp somepolygons2.shx cmake_install.cmake IOWorker.cpp PlanarPartition.h
README.md somepolygons2.zip CMakeLists.txt IOWorker.h PolygonHandle.cpp
somepolygons2.dbf test definitions LICENSE.txt PolygonHandle.h
somepolygons2.prj test_noprj

root@ubuntu:/home/administrateur/tudelft-gist-pprepair-c8bab39# chmod 777 some*

root@ubuntu:/home/administrateur/tudelft-gist-pprepair-c8bab39# ./pprepair -i "somepolygons2.shp" -o "somepolygons2.shp_output.shp" -fix Adding a new set of polygons to the triangulation... Path: somepolygons2.shp Type: ESRI Shapefile Layers: 1 Reading layer #1 (168114616 polygons)... Erreur de segmentation

root@ubuntu:/home/administrateur/tudelft-gist-pprepair-c8bab39#

Le 29/11/2013 16:04, �y@github.com)" a écrit :

Your site's security certificate is not secure, I'd rather not connect to it.

All shapefiles? Can you try with that simple one: https://www.dropbox.com/sh/azzs7e1mrqjn8hl/0yM2R_hNpd

that's the output I get:

$ pprepair -i somepolygons2.shp -o out.shp -fix Adding a new set of polygons to the triangulation... Path: somepolygons2.shp Type: ESRI Shapefile Layers: 1 Reading layer #1 https://github.com/tudelft-gist/pprepair/issues/1 (9 polygons)...

|   string      CODE_00
     double      AREA
|

Polygons added (0 s). The triangulation has now:
Vertices: 309
Edges: 924
Triangles: 600
Tagging...
Tagging done (0 s).
Input triangulation:
Holes: 2 triangles (0.333333 %)
Ok: 596 triangles (99.333333 %)
Overlaps: 2 triangles (0.333333 %)
Repairing regions by longest boundary...
Repair successful (0 s). All polygons are now valid.
Triangulation already repaired!
Repaired triangulation:
Holes: 0 triangles (0.000000 %)
Ok: 600 triangles (100.000000 %)
Overlaps: 0 triangles (0.000000 %)
Reconstructing polygons (geometry)...
Removed 4 constrained edges
Polygons reconstructed (0 s).
Exporting polygons...
Overwriting file...
Writing file...
Polygons exported (0 s).
Done! Process finished in 0 minutes 0 seconds.

— Reply to this email directly or view it on GitHub https://github.com/tudelft-gist/pprepair/issues/17#issuecomment-29521305.

hugoledoux commented 10 years ago

Hmmm, there's something weird since it states that the file has 168114616 polygons, while it has only 9... The errors happens as OGR reads the attributes.

@kenohori : any bright ideas?

kenohori commented 10 years ago

Not really, but clearly GDAL/OGR is not working properly. Could you try with a different version of OGR?

lucsom commented 10 years ago

Same issue with GDAL 1.9.2 (before it was 1.9.0) : root@ubuntu:/home/administrateur/tudelft-gist-pprepair-c8bab39# ogrinfo --version GDAL 1.9.2, released 2012/10/08 root@ubuntu:/home/administrateur/tudelft-gist-pprepair-c8bab39# ./pprepair -i "somepolygons2.shp" -o "somepolygons2_output.shp" -fix Adding a new set of polygons to the triangulation... Path: somepolygons2.shp Type: ESRI Shapefile Layers: 1 Reading layer #1 (146659344 polygons)...

Which type of linux distribution and version should you recommand ? (and same question for gdal and cgal ?) Thanks a lot for your help. Erreur de segmentation

hugoledoux commented 10 years ago

Any version of Linux should do, v1.9 of gdal is also fine.The seg fault happens because of OGR when the polygons are read from the shapefile, it is not because of the pprepair code from what we can see.

I'd suggest to reinstall OGR and make sure it works properly. You can use the small program to read a data set from there: http://www.gdal.org/ogr/ogr_apitut.html

bmmeijers commented 10 years ago

For me it does segfault with the French input dataset.

Running it through gdb reveals that it is something with the constraint hierarchy of CGAL being used.

Program received signal SIGSEGV, Segmentation fault.
0x00000000004bfb13 in CGAL::Constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_2<CGAL::Epeck, CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Epeck, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Triangulation_face_base_with_info_2<FaceInfo, CGAL::Epeck, CGAL::Constrained_triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_ds_face_base_2<void> > > > > > >, CGAL::Default>, false>, bool>::vertices_in_constraint_begin (
    this=<optimized out>, va=..., vb=...) at /usr/include/CGAL/Constraint_hierarchy_2.h:379
379 }
bmmeijers commented 10 years ago

And a bit more stack trace.

#0  0x00000000004bfb13 in CGAL::Constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_2<CGAL::Epeck, CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Epeck, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Triangulation_face_base_with_info_2<FaceInfo, CGAL::Epeck, CGAL::Constrained_triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_ds_face_base_2<void> > > > > > >, CGAL::Default>, false>, bool>::vertices_in_constraint_begin (this=<optimized out>, va=..., vb=...) at /usr/include/CGAL/Constraint_hierarchy_2.h:379
#1  0x00000000004c9d8c in CGAL::Constrained_triangulation_plus_2<CGAL::Constrained_Delaunay_triangulation_2<CGAL::Epeck, CGAL::Triangulation_data_structure_2<CGAL::Triangulation_vertex_base_2<CGAL::Epeck, CGAL::Triangulation_ds_vertex_base_2<void> >, CGAL::Triangulation_face_base_with_info_2<FaceInfo, CGAL::Epeck, CGAL::Constrained_triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_face_base_2<CGAL::Epeck, CGAL::Triangulation_ds_face_base_2<void> > > > >, CGAL::Exact_intersections_tag> >::remove_constraint<CGAL::Emptyset_iterator> (this=this@entry=0x7fffffffd4c0, va=..., vb=..., 
    out=out@entry=...) at /usr/include/CGAL/Constrained_triangulation_plus_2.h:235
#2  0x00000000004a08ba in remove_constraint (vb=..., va=..., this=0x7fffffffd4c0) at /usr/include/CGAL/Constrained_triangulation_plus_2.h:545
#3  IOWorker::splitRing (this=this@entry=0x7fffffffe018, ring=...) at /home/martijn/src/pprepair/IOWorker.cpp:1538
#4  0x00000000004a4293 in IOWorker::addToTriangulation (this=0x7fffffffe018, triangulation=..., edgesToTag=..., file=<optimized out>, schemaIndex=0)
    at /home/martijn/src/pprepair/IOWorker.cpp:211
#5  0x00000000004db56a in PlanarPartition::addToTriangulation (this=0x7fffffffe010, file=0x715b38 "/tmp/FR9301616_HAB_PG_region.shp", schemaIndex=0)
    at /home/martijn/src/pprepair/PlanarPartition.cpp:51
#6  0x000000000048af94 in main (argc=6, argv=0x7fffffffe378) at /home/martijn/src/pprepair/pprepair.cpp:303
hugoledoux commented 10 years ago

Notice that for lucsom above the segfault is not the same at all: it's when OGR reads the geometries from the shapefile. You successfully do so since CGAL creates it.

Can you paste the console output here please?

lucsom commented 10 years ago

I've found a workaround : i did a complete reinstallation under a newer version of ubuntu (12.04), and everything goes well. Thanks for your help and fast answers.

Lucsom

Le 03/12/2013 10:43, "> Hugo Ledoux (par Internet, dépôt noreply@github.com)" a écrit :

Notice that for lucsom above the segfault is not the same at all: it's when OGR reads the geometries from the shapefile. You successfully do so since CGAL creates it.

Can you paste the console output here please?

— Reply to this email directly or view it on GitHub https://github.com/tudelft-gist/pprepair/issues/17#issuecomment-29695680.

kenohori commented 10 years ago

Great! I'm glad to hear that.