[gdal-dev] Doubt about memory raster

Frank Warmerdam warmerdam at pobox.com
Tue Feb 9 12:19:49 EST 2010


Jorge Arévalo wrote:
> Mmm... But I suppose this is in case of rasters with pixel type =
> Byte. In that cases, should I always follow this scheme? pArray for
> first band, pArray + 1 for second band, and so on (interlaced)? I
> mean, why don't pArray for first band, pArray + raster_width for
> second band...(non interlaced)?
> 
> Anyway, I'm working in a "WKT Raster format to GDAL format" parser. I
> get all the bands in different arrays: void * pBandData, for example.
> And the pixel type of these bands can be Byte, Int16, Float32, etc.
> So, I don't have one array for all the raster data, I have a different
> one per band.
> 
> In such situation, has sense this scheme?
> 
> DATAPOINTER = pBandData
> PIXELOFFSET = (GDALDataTypeSize(raster_pixel_size) / 8) (this is, 1 =
> pixel size byte, 2 = pixel size int16, 4 = pixel size int32, etc)
> LINEOFFSET = PIXELOFFSET * raster_width_in_px

Jorge,

Yes, this is correct, but you can just omit the PIXELOFFSET and
LINEOFFSET values in this situation since this is the default
configuration.  You only need to specify them if you are doing
something complicated, like interleaving.

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