[gdal-dev] Raster visualization

Ari Jolma ari.jolma at gmail.com
Thu May 10 10:48:32 EDT 2012


On 05/10/2012 04:48 PM, Petr Kitashov wrote:
> Hi,
>
> I need just to display some region(any) from raster file. Seems like I 
> understand everything until rasterIO.
> RasterIO fills(in my case) void* pData with raster info - that's 
> great, but how to display it?

I do it like this:

1) Call GDALRasterIO to get the part of interest into a 2D table of 
floats or integers (ral_grid).

This happens in ral_grid_create_using_GDAL in 
https://github.com/ajolma/geoinformatica/blob/master/libral/ral_grid_rw.c

2) Create a ral_pixbuf (each pixel has RGBA values) of the same size as 
ral_grid.

3) Render the ral_grid onto the ral_pixbuf using current palette etc.

4) Convert the ral_pixbuf into GdkPixBuf.

5) Use the GdkPixBuf in a GTK+ image widget for display.

This happens in ral_pixbuf_create_from_grid, ral_render_integer_grid, 
and ral_gdk_pixbuf in 
https://github.com/ajolma/geoinformatica/blob/master/libral/ral_pixbuf.c

This is GTK+ specific. There are other Graphics toolkits.

>
> Which data is stored there when I use GDALDataset::rasterIO, and which 
> in case of GDALRasterBand::RasterIO?
>
> I.e. how to determine pixel values from pData?
>
> I'm sorry if this question is stupid, but i spent a lot of time in 
> google and didn't find any solution.

I hope the above helps.

Ari

>
> -- 
> Best Regards,
> Petr Kitashov
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120510/4d98e3b4/attachment.html


More information about the gdal-dev mailing list