[gdal-dev] Memory error for gdal_grid if using nearest

Even Rouault even.rouault at spatialys.com
Sun Jul 19 06:56:47 PDT 2015


Armin,

I've tried with GDAL trunk, both Linux and Windows (under Wine actually, but 
hopefully shouldn't make a difference), and didn't run into problems.

I've noted that the corner coordinates with your spatialite dataset are not 
the one your reported in your first email. I get :

Corner coordinates = (1449724.439790 8217652.262496)-(1449753.943937 
8217638.597033)

Even

> Hi Even,
> 
> I have converted it to a Spatialite file for easier download:
> https://www.wesendit.com/dl/hcjLajYe9F3i/
> 
> The problem is still the same. The offending command is:
> gdal_grid.exe test.sqlite test.tif -ot Float32 -of GTiff -zfield
> Cond1_mSm -l 02vhidep_raw -a nearest
> 
> "-a invdist" works without a problem. Are the two algorithms not using
> the same search?
> 
> Since this problem only occurs with files covering France in
> RGF93/Lambert93 (I have tested two different files, both show the same
> problem) I wonder whether the range of coordinates of RGF93 may be the
> issue. All my other files so far never had this problem.
> 
> Armin
> 
> On 17/07/2015 01:20, Even Rouault wrote:
> > On Thursday 16 July 2015 21:03:52 Armin Schmidt wrote:
> >> I have a very simple point-shapefile which throws various memory
> >> allocation errors when I try to grid it with gdal_grid using "nearest",
> >> but works absolutely fine and fast when using the "invdist" algorithm. I
> >> never had this problem before. Does anyone have any idea what is wrong?
> >> If it would help I can provide the shapefile.
> > 
> > Armin,
> > 
> > That could be useful indeed. From your description, it looks like the
> > building of the spatial index would went wrong with this particular
> > dataset, looping forever or something like that and ending up eating all
> > the memory.
> > 
> > Even
> > 
> >> The stripped down command-line is:
> >> 
> >> gdal_grid.exe 02VHiDep_raw.shp test.tif -ot Float32 -of GTiff -zfield
> >> Cond1_mSm -l 02VHiDep_raw -a nearest
> >> 
> >> After taking some time (probably searching for the nearest neighbours),
> >> this throws:
> >> 
> >> ERROR 1: CPLMalloc(): Out of memory allocating 64 bytes.
> >> FATAL: CPLMalloc(): Out of memory allocating 64 bytes.
> >> ERROR 1: TIFFWriteDirectorySec:Out of memory
> >> ERROR 2: Cannot allocate 8192 bytes
> >> ERROR 1: TIFFWriteDirectorySec:Out of memory
> >> ERROR 1: TIFFWriteDirectorySec:Out of memory
> >> 
> >> Grid data type is "Float32"
> >> Grid size = (256 256).
> >> Corner coordinates = (449675.737076 6895223.317256)-(449705.249717
> >> 6895209.690215).
> >> Grid cell size = (0.114835 0.053024).
> >> Source point count = 3280.
> >> Algorithm name: "nearest".
> >> Options are
> >> "radius1=0.000000:radius2=0.000000:angle=0.000000:nodata=0.000000"
> >> 
> >> Armin

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list