tudelft3d/pprepair

Pprepair ends after consuming all memory

mgageo opened this issue · 19 comments

To test pprepair, I use an other dataset with 117710 polygons.
After a few features, th program stays on feature #21929, and the free memory decrease from 5.4G to zero and the program abort.

What I do:
curl -o /tmp/RPG_2010_35.ZIP http://www.data.gouv.fr/var/download/ign/RPG_2010_035.ZIP
( cd /tmp ; unzip RPG_2010_35.ZIP)
pprepair -i /tmp/RPG_2010_035.shp -o /tmp/fix.shp -fix

This is only a test, I don't need a fix for this dataset.

Thanks for the report. I tried it and got the same result. It might be due to a problem with OGR, but I'm not sure.

I'll look into it in the coming weeks.

Unfortunately I still haven't managed to figure out what is causing this, but I'll get to it at some point :-)

It works now. Fixed together with #7

With the same shapefile, I have this error
Holes: 223817 triangles (4.222247 %)
Ok: 5037562 triangles (95.032238 %)
Overlaps: 39519 triangles (0.745515 %)
Repairing regions by longest boundary...
Repair of all polygons not possible (1 s).
Repairing regions by random neighbour...
Repair successful (0 s). All polygons are now valid.
Repaired triangulation:
Holes: 0 triangles (0.000000 %)
Ok: 5300898 triangles (100.000000 %)
Overlaps: 0 triangles (0.000000 %)
Reconstructing polygons (geometry)...
Removed 258549 constrained edges
terminate called after throwing an instance of 'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: is_simple_2(first, last, traits)
File: /usr/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h
Line: 420
Abandon
root@debian:/d/web/pprepair#

I change this line in the Makefile.linux:
LDFLAGS=-g -O3 -D_REENTRANT -frounding-math -Wl,-Bsymbolic-functions -L$(LPATH) -lCGAL_Core -lCGAL -lgmpxx -lmpfr -lgmp -lboost_thread-mt -lCGAL_Core -lCGAL -lgmpxx -lmpfr -lgmp -lboost_thread-mt -lgdal1.6.0

Huh... I think it worked for me on Mac. I'll test it on Linux tomorrow. Maybe it's a GCC thing.

Also thanks for the corrected line. I'll correct it.

It works for me. Did you try uncommenting what is now line 26 in definitions/CGALDefinitions.h (#define EXACT_CONSTRUCTIONS)? It seems to be necessary for this dataset.

It's the same with or without the define.
I test under Debian GNU/Linux 6.0.6 Squeeze

I make an other test with Debian wheezy 7.0.
For Makefile.linux, I revert to LDFLAGS=...-lgdal
With #define EXACT_CONSTRUCTIONS uncommented, I need a VM with 4 Go of memory.
And the end it's the same:
terminate called after throwing an instance of 'CGAL::Precondition_exception'
what(): CGAL ERROR: precondition violation!
Expr: is_simple_2(first, last, traits)
File: /usr/include/CGAL/Polygon_2/Polygon_2_algorithms_impl.h
Line: 421
Aborted
root@wheezy:/tmp#

Sorry for making you debug this, but I cannot replicate the problem :-).
What version of CGAL are you using?
Did you get it from apt-get or from source?
Can you try compiling with MPFI as well?

From a fresh install of wheezy, I add:
apt-get -y install
devscripts fakeroot build-essential
lynx curl ntpdate lsof ngrep tshark unzip
dselect apt-show-versions
and after for pprepair
apt-get -y install git
libgdal1-dev libcgal-dev
The version of cgal is
root@wheezy:# dpkg -s libcgal-dev
Package: libcgal-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 26322
Maintainer: Joachim Reichel reichel@debian.org
Architecture: amd64
Source: cgal
Version: 4.0-5
Depends: libcgal9 (= 4.0-5), libboost-dev, libboost-thread-dev, libboost-program-options-dev, libgmp10-dev, libmpfr-dev, libqt4-dev, zlib1g-dev
Description: C++ library for computational geometry (development files)
CGAL (Computational Geometry Algorithms Library) makes the most important
of the solutions and methods developed in computational geometry available
to users in industry and academia in a C++ library. The goal is to provide
easy access to useful, reliable geometric algorithms.
.
This package contains the header files and static libraries.
Homepage: http://www.cgal.org/
root@wheezy:
#

I add mpfi
apt-get -y install libmpfi-dev
and after
make -f Makefile.linux clean
make -f Makefile.linux
It's the same error

I try with CGAL-4.2
apt-get -y install libboost-dev cmake libmpfr-dev libgmp3-dev libboost-system-dev
cd /usr/local/src
wget https://gforge.inria.fr/frs/download.php/32359/CGAL-4.2.tar.gz
tar xzf CGAL-4.2.tar.gz
cd CGAL-4.2
cmake .
make
make install
ldconfig
And the end is
Polygons added (83 s). The triangulation has now:
Vertices: 2650464
Edges: 7951389
Triangles: 5300898
Tagging...
Tagging done (14 s).
Input triangulation:
Holes: 223817 triangles (4.222247 %)
Ok: 5037562 triangles (95.032238 %)
Overlaps: 39519 triangles (0.745515 %)
Repairing regions by longest boundary...
Repair of all polygons not possible (1 s).
Repairing regions by random neighbour...
Repair successful (0 s). All polygons are now valid.
Repaired triangulation:
Holes: 0 triangles (0.000000 %)
Ok: 5300898 triangles (100.000000 %)
Overlaps: 0 triangles (0.000000 %)
Reconstructing polygons (geometry)...
Removed 258558 constrained edges
Segmentation fault
root@wheezy:/usr/local/src/CGAL-4.2#

Could you try again with the newest version of pprepair, compiling with CMake?

After cmake .; make I have this error:
root@wheezy:/d/web/pprepair# ./pprepair -i ${tmpDir}/${shp}.shp -o /tmp/fixed.shp -fix
Adding a new set of polygons to the triangulation...
Path: /d/web/tmp/FSAC_onf.shp
Type: ESRI Shapefile
Layers: 1
Segmentation fault
root@wheezy:/d/web/pprepair#

Hi,
i have the same problem with an ubuntu server (10.04) with gdal-1.9.0, should you have some news about this issue ?
Thanks.

That's a totally different seg fault lucsom. I think it has to do with the CRS. Can you try to remove the PRJ file from the folder? Or if it's not there add one.

Opened new bug report #16

Reopened the issue to solve the problem with the dataset in the first post

Related to #11, so closing it here.