[gdal-dev] band overview into numpy array how-to?
Yann Chemin
yann.chemin at gmail.com
Sat Jul 19 20:28:47 EDT 2008
oh! thanks, that is a nice feature...
I'll clean up and start again from that then.
2008/7/19 Frank Warmerdam <warmerdam at pobox.com>:
> Antonio Valentino wrote:
>>
>> Il giorno Sat, 19 Jul 2008 09:39:04 +0700
>> "Yann Chemin" <yann.chemin at gmail.com> ha scritto:
>>
>>> Hi I am trying to get an image into a numpy array (for later display
>>> in wx.Image)
>>>
>>> it is to have a view of the image at a screen size resolution more or
>>> less. Due to the nature of the images (large size),
>>> it will be easier to interact with overviews for display.
>>> How can I load an overview into a numpy array?
>>
>> gdal.Band.GetOverview(self, ov_index) --> RasterBand instance
>>
>> gdal.Band.ReadAsArray(self, xoff=0, yoff=0, win_xsize=None,
>> win_ysize=None, buf_xsize=None, buf_ysize=None, buf_obj=None)
>>
>
> Yann,
>
> I would add that ReadAsArray() will automatically make use of available
> overviews if buf_xsize/buf_ysize are less than win_xsize/win_ysize as
> appropriate. So generally, just use ReadAsArray() to request your desired
> region and indicate the reduced resolution you want to load it at, and
> the overviews will be used when appropriate and available.
>
> 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 | President OSGeo, http://osgeo.org
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
--
Yann Chemin
International Rice Research Institute
Office: http://www.irri.org/gis
Perso: http://www.freewebs.com/ychemin
More information about the gdal-dev
mailing list