[gdal-dev] gdal_contour out of memory

Joaquim Luis jluis at ualg.pt
Thu Apr 7 07:08:34 PDT 2016


Another option is to use GMT grdcontour program

gmt grdcontour 6800_2480.tif -C1 -Dlixo.dat -V

it creates a ~8.3 Mb ascii file with a memory consuption of ~50 Mb (Task  
manager info) that you can later convert to shp with ogr2ogr

> Stefan,
>
>> I have problems creating contours with gdal_contour and some tiff files.
>> The following command
>>
>> gdal_contour -i 1.0 6800_2480.tif out.shp
>>
>> ends with "0Killed" after eating all memory and all swap. It happens  
>> with
>> gdal 1.11 and gdal-master. It did work on a Ubuntu 10.04 machine (as  
>> far as
>> I remember). Now I'm on Ubuntu 14.04.
>
> Comparing the source code, the algorithm hasn't fundamentaly changed, at  
> least
> since GDAL 1.5. I can reproduce your issue with latest trunk or 1.5.X.
> It is related to the fact that your source dataset has floating point  
> values.
> An easy workaround is to translate your raster into a Int16 one and  
> contour
> it. I've just tried it and it works.
> Or you could possibly round values to 0.5 precision with gdal_calc.py for
> perhaps a smoother result. But basically the contour alg seems to  
> require a
> lot of memory if every pixel is different from its neighbour (might be an
> approximation of what happens as the algorithm is non trivial and I  
> didn't
> study it in detail).
> It might be worth opening a ticket on that.
>
> Even
>
>>
>> Tiff file can be found here:
>> http://maps.zh.ch/download/hoehen/2014/dtm/tif/6800_2480.tif
>>
>> Any ideas?
>>
>> regards
>> Stefan


More information about the gdal-dev mailing list