[Gdal-dev] gdal_contour crashing

Frank Warmerdam warmerdam at pobox.com
Wed Nov 11 14:05:28 EST 2009

NopMap wrote:
> Hi!
> I have sudden problem with gdal_contour after using ist successfully many
> times. There seems to be a problem with a certain area. When I tried it
> first, gdal_contour quit with an out-of-memory message, exceeding 2GB of
> virtual memory. When I reduced the area and called
> gdal_merge.py -o M:\srtm\Hillshading_srtm.tif -ul_lr 6.3 45.4 9.2 43.5
> M:\srtm\ 
> gdal_contour -i 10 -snodata 32767 -a height M:\srtm\Hillshading_srtm.tif
> M:\srtm\Hillshading_shape.shp 
> it just hung at about 80% completion, no more CPU activity. It worked on a
> neighboring area before.
> The data was merged from downloaded CGIAR 5x5 data. Hillshading_srtm.tif
> looks good in a viewer and in gdal_info and the perrygeo hillshade.exe was
> able to produce nice shadings from the same data.
> GDAL Version is 160, binaries on Windows XP.
> What can I do to track down this problem, except for making the area smaller
> and smaller? I have not found a verbose setting on gdal_contour. Any ideas
> what could cause this behaviour?


I'm not sure why this is happening.  I will note that gdal_contour holds
contours in memory as it proceeds through the image until it has passed the
contour at which point it is emitted to disk.  This can results in high memory
use if there are lots of long (vertically) contours. Also, high contour density
can occur if there are crazy no-data values in the raster (ie. -1e7 in a
floating point raster) which can trigger a huge "pile" of contours around
the bad data value.

If you can isolate the problem to a reasonably transportable sized raster,
you could file a ticket and myself or someone else could look into the
poor performance more closely.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list