[gdal-dev] Doubt about memory raster

Jorge Arévalo jorge.arevalo at gmail.com
Tue Feb 9 06:54:49 EST 2010


Hello,

I'm creating a raster-in-memory using MEM driver and following this
example http://trac.osgeo.org/gdal/ticket/1503

I feel confused about an issue:

sprintf( szPixelOffset, "PIXELOFFSET=2" );

(...)

GDALAddBand( hDS, GDT_Byte, apszOptions )

(...)

GDALDatasetRasterIO( hDS, GF_Read, 49999, 49999, 1, 1,
                         abyResult, 1, 1, GDT_Byte,
                         2, NULL, 0, 0, 0 );

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?

Thanks in advance

Best regards,
Jorge


More information about the gdal-dev mailing list