[Gdal-dev] Error Message with gdalwarp

Frank Warmerdam warmerdam at pobox.com
Tue Oct 12 10:11:57 EDT 2004


Dobmeyer, Todd wrote:
> My files are geo-referenced so I assume I do not need to use that
> utility you sent me. My .tif file is 21600x21600. I want to go from 135
> W to 60 W and from 30 N to 45 N. I converted these to pixels like you
> said and came out to my x_pixel being 37,800, my y_pixel to be 14,400,
> my x_size to 9000, and my y_size to be 1800. When I type in my command,
> I get this following error.
> 
> Input file size is 21600, 21600
> Computed -srcwin 37800 14400 -28799 -12599 from projected window.
> 0.ERROR 2: CPLMalloc(): Out of memory allocating -28799 bytes.

Todd,

The arguments to the -srcwin are "xoff yoff xsize ysize".  So the first
two arguments are the pixel/line location of the top left corner of your
source window (zero based) and the next two arguments are the window
of the requested window in pixels and lines.

Assuming the top left corner is 37800,14400 you would use:

   -srcwin 37800 14400 9000 1800

Clearly the error checking in the application should be better so the
code wouldn't end up blowing a gasket down in the guts.

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