<div dir="ltr"><div class="gmail_default" style="font-family:comic sans ms,sans-serif">Even,</div><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><br></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif">Is there away to get the bounding polygon of the data?</div><div class="gmail_default" style="font-family:comic sans ms,sans-serif"><br></div><div class="gmail_default" style="font-family:comic sans ms,sans-serif">Thanks</div><div class="gmail_default" style="font-family:comic sans ms,sans-serif">Damian</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 25 September 2015 at 09:04, Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Damian,<br>
<br>
There's no dedicated function in the GDAL API to know if a window is only no<br>
data without querying the pixel values. It would make only sense for drivers<br>
that support sparse coverages, like VRT, some formulations of TIFF with<br>
missing blocks, ERDAS Imagine, GeoPackage, ...<br>
<br>
Even<br>
<div class="HOEnZb"><div class="h5"><br>
> Hi,<br>
><br>
> GDALRasterBand::RasterIO returning block containing 0 for area that does<br>
> not overlap the data.<br>
><br>
> This is slightly different from requesting data for an area that overlaps<br>
> the data, but there is no data.<br>
><br>
> Is there away of checking for this condition before I call RasterIO?<br>
><br>
><br>
> I’m using the following to read a block of data at a time:<br>
><br>
> GDALRasterBand *poBand;<br>
> …<br>
> poBand->RasterIO(GF_Read,startX+xoffset,startY+yoffset,blockWidth,blockHeig<br>
> ht,buffer[band],blockWidth,blockHeight,GDT_Int32,0,0);<br>
><br>
><br>
> This works fine, but I would like to be told if the block I am reading does<br>
> not overlap the data.<br>
><br>
> There are two reasons for this;<br>
><br>
> (1) It’s an early exit, before the block is set to 0 or the no-data value.<br>
> (2) It means I don’t have to check the block to see if it is filled with<br>
> just 0 or no-data.<br>
><br>
> The stack trace for the calls is as follows:<br>
><br>
> tplgdal11164d.dll!VRTSimpleSource::GetSrcDstWindow(int nXOff, int nYOff,<br>
> int nXSize, int nYSize, int nBufXSize, int nBufYSize, int * pnReqXOff, int<br>
> * pnReqYOff, int * pnReqXSize, int * pnReqYSize, int * pnOutXOff, int *<br>
> pnOutYOff, int * pnOutXSize, int * pnOutYSize)  Line 685 C++<br>
>   tplgdal11164d.dll!VRTSimpleSource::RasterIO(int nXOff, int nYOff, int<br>
> nXSize, int nYSize, void * pData, int nBufXSize, int nBufYSize,<br>
> GDALDataType eBufType, int nPixelSpace, int nLineSpace)  Line 889 + 0xad<br>
> bytes C++<br>
>   tplgdal11164d.dll!VRTSourcedRasterBand::IRasterIO(GDALRWFlag eRWFlag, int<br>
> nXOff, int nYOff, int nXSize, int nYSize, void * pData, int nBufXSize, int<br>
> nBufYSize, GDALDataType eBufType, int nPixelSpace, int nLineSpace)  Line<br>
> 206 + 0x9c bytes C++<br>
>   tplgdal11164d.dll!GDALRasterBand::RasterIO(GDALRWFlag eRWFlag, int nXOff,<br>
> int nYOff, int nXSize, int nYSize, void * pData, int nBufXSize, int<br>
> nBufYSize, GDALDataType eBufType, int nPixelSpace, int nLineSpace)  Line<br>
> 261 C++<br>
><br>
> In VRTSimpleSource::RasterIO the first thing that happens is a call to<br>
> GetSrcDstWindow. If this call fails the function returns with a CE_None.<br>
> This is after the block has been set to 0.<br>
><br>
> The simplest change would be to extend the return enum to have a CE_NoData.<br>
> But that does not really fit with the name of the enum and does to deal<br>
> with (1).<br>
><br>
> The other option is to provide access to GetSrcDstWindow. This would allow<br>
> the application to check to see if there is data in the block requested.<br>
><br>
><br>
> I may of course be missing a more sensible way of doing this without any<br>
> code changes to GDAL. If I am missing something could someone let me know<br>
> what I should be doing.<br>
><br>
> Thanks<br>
> Damian<br>
><br>
><br>
> Using: GDAL version 11.2<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</font></span></blockquote></div><br></div>