[gdal-dev] Finding if a source exists in particular block of a VRTRasterBand

Even Rouault even.rouault at mines-paris.org
Thu Mar 14 00:05:51 PDT 2013


Le jeudi 14 mars 2013 05:18:17, ryagz a écrit :
> Hi,
> 
> I have created a VRTDataset and added multiple simple sources to its
> rasterbands in a function of my application. In another function i have the
> instance of this VRTDataset and its VRTRasterbands and, Now i would like to
> find for a particular offsets an dimensions if there exists a source in
> VRTRasterband.
> 
> I did not find any API functions to do this operations, so thought to  call
> functions from the classes and tried the code like bellow:
> 
> GDALRasterBand* preBand = dataSource->GetRasterBand(1);
> VRTSourcedRasterBand* Vrtband =
> dynamic_cast<VRTSourcedRasterBand*>(preBand);
> int hasValidSource = 0;
> for(int srcIndex = 0; srcIndex < Vrtband->nSources; srcIndex++)
> {
> VRTSimpleSource* simpleSource =
> static_cast<VRTSimpleSource*>(Vrtband->papoSources[srcIndex]);
> hasValidSource = simpleSource->GetSrcDstWindow(xoff, yoff, read_size[0],
> read_size[1],	          read_size[0], read_size[1],	  &nReqXOff, &nReqYOff,
> &nReqXSize, &nReqYSize,	  &nOutXOff, &nOutYOff, &nOutXSize, &nOutYSize );
> }
> 
> To do this operation, the problem i am facing is VRTSimpleSource class is
> not exported and so the function GetSrcDstWindow() is throwing a linker
> errors.
> 
> Is there any way to solve this issue?
> Or Is there any API function which does this operation?

You can look at the gdallocationinfo source code to see how it manages to 
retrieve the source file :

$ gdallocationinfo byte.vrt 0 0
Report:
  Location: (0P,0L)
  Band 1:
    <LocationInfo><File>/home/even/gdal/svn/trunk/gdal/byte.tif</File></LocationInfo>
    Value: 110

Migth require GDAL 1.9 at least.

> 
> Thanks,
> Ryagz
> 
> 
> 
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/Finding-if-a-source-exists-in-particul
> ar-block-of-a-VRTRasterBand-tp5040251.html Sent from the GDAL - Dev mailing
> list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list