[gdal-dev] GDALRasterBand to NSImage

Patrick Cannon patrick.cannon at barcosoft.com
Wed Apr 23 13:47:04 PDT 2014


Hi Even,

Thank you for the reply.

Yes I understand it is an index for the color table.

But the raster data is not all the same and I would expect the index to
have something other than a 1 returned for each byte.

If I use the same call under Linux with the exact same file it works as
expected.

So, is there a compile option for GDAL that may have been missed that is
causing it to handle the file incorrectly?

Thanks.
Patrick


> Le mercredi 23 avril 2014 22:22:45, Patrick Cannon a écrit :
>> Hello Everyone,
>>
>> I have been trying to get a few raster files loaded via GDAL but it
>> seems
>> that all I get back from GDALRasterIO is a bunch of 1’s which then get
>> set
>> as 255 or white.
>>
>> The call I am using is:
>>     GDALRasterIO(ds->GetRasterBand(1), GF_Read,
>>                  0, 0, pixWide, pixHigh,
>>                  fileData, pixWide, pixHigh, GDT_Byte, 0, 0);
>>
>> The meta data for the chart looks valid:
>> BSB_KNP=SC=458596,GD=NAD83,PR=MERCATOR,PP=28.867,PI=30.000,SP=,SK=0.0021196
>> ,TA=90.0021196,UN=FATHOMS,SD=MEAN LOWER LOW WATER,DX=45.86,DY=45.86
>
> BSB datasets come with a color palette (GDALColorTable). So GDALRasterIO()
> returns you the index in the color palette for each pixel. You have then
> to
> combine that with the R,G,B components of the color table.
>
>>
>> So I would expect the data to be getting filled correctly.
>>
>> OS X 10.9 with Xcode 5.1.1.
>>
>> If anyone has a suggestion or could point me to a working Objective-C
>> example that would be great.
>>
>> Thanks,
>> Patrick
>
> --
> Geospatial professional services
> http://even.rouault.free.fr/services.html
>





More information about the gdal-dev mailing list