[gdal-dev] Doubt about memory raster

Frank Warmerdam warmerdam at pobox.com
Tue Feb 9 10:30:32 EST 2010


Jorge Arévalo wrote:
> In MEM driver page: http://www.gdal.org/frmt_mem.html says:
> 
> "PIXELOFFSET: Offset in bytes between the start of one pixel and the
> next on the same scanline. (optional)"
> 
> The data pixels are bytes, but the pixeloffset is 2. I suppose in the
> example, the data pixels are interlaced (one scan line starts on
> pabyBigMem and the other in pabyBigMem + 1), and for this reason
> pixeloffset = 2.
> 
> How do you specify this (if pixels are interlaced or not) when
> creating the raster and adding the bands? Maybe this is not necessary,
> and you specify this when reading or writing, but then, why in
> GDALDatasetRasterIO the pixeloffset and lineoffset are set to 0?

Jorge,

To address such an existing array, the options to GDALAddBand()
would need to include DATAPOINTER, PIXELOFFSET and LINEOFFSET.
DATAPOINTER for the first call to addband would be pabyBigMem
and it would be pabyBigMem+1 for the second band.   In both
cases PIXELOFFSET would be 2 and LINEOFFSET would be
PIXELOFFSET*(image_width_in_pixels).

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