[gdal-dev] VRTWarpedDataset with ChunkandWarpImage

David Olson olsond at google.com
Mon Oct 27 16:16:25 PDT 2014


Here shortened version of the code...

  VSIFCloseL(VSIFileFromMemBuffer((*vsifile1).c_str(),
                                  buf1, FALSE));  // buf1 = RGB JPEG
  GDALDatasetH hsrc1_ds = GDALOpenInternal((*vsifile1).c_str(), GA_ReadOnly,
                           kGdalAllowedDrivers);
 VSIFCloseL(VSIFileFromMemBuffer((*vsifile2).c_str(),
                                  buf2, FALSE));  // buf2 = RGB JPEG
 GDALDatasetH hsrc2_ds = GDALOpenInternal((*vsifile2).c_str(), GA_ReadOnly,
                           kGdalAllowedDrivers);
....  // initialize geo_transform, gdal_warp
gdal_warp->hSrcDS = hsrc1_ds;
VRTWarpedDataset *hdst_ds =  (VRTWarpedDataset*)(GDALCreateWarpedVRT(
      hsrc1_ds, XSize, YSize, &dst_geo_transform[0], gdal_warp));
gdal_warp->hDstDS = hdst_ds;
gdal_warp->hSrcDS = hsrc2_ds;
CPLErr eErr = warp_operation.ChunkAndWarpImage(0, 0,
GDALGetRasterXSize(hdst_ds),
                                            GDALGetRasterYSize(hdst_ds));
GDALClose((GDALDatasetH)hdst_ds);   // "ERROR 6: WriteBlock() not supported
for this dataset." /band
... // Close Source Datasets etc..



On Mon, Oct 27, 2014 at 3:41 PM, David Olson <olsond at google.com> wrote:

> Evan,
>   The source and destination data are 3-band RGB so I don't believe that
> is the problem...
>   However I did define GdalWarp->nDstAlphaBand = 0 with the same result.
> Basically getting three
>   erorrs - one for each band:
>
> ERROR 6: WriteBlock() not supported for this dataset.
> ERROR 6: WriteBlock() not supported for this dataset.
> ERROR 6: WriteBlock() not supported for this dataset.
>
> Thanks, David
>
> On Mon, Oct 27, 2014 at 3:21 PM, Even Rouault <even.rouault at spatialys.com>
> wrote:
>
>> Le lundi 27 octobre 2014 22:42:11, David Olson a écrit :
>> > Hi,
>> >   I've set up a c++ code which creates a VRTWarpedDataset from a source
>> > image then uses ChunkAndWarpImage to warp additional source images and
>> > create a mosaic with the VRTWarpedDataset destination (hdst_ds).
>> >  The code is tested and runs fine without memory leak.
>> >  However I do get an error upon calling GDALClose(hdst_ds) :
>> >       *ERROR 6: WriteBlock() not supported for this dataset*.
>> >  GDALClose calls FlushCache which calls WriteBlock.
>> >  Just wanting to get some insight on this error. And possibly how to
>> avoid
>> > it.
>>
>> David,
>>
>> Difficult to tell without a reproducable snippet. But my guess is that
>> you have
>> an issue with setting up alpha band. Perhaps you have not defined
>> nDstAlphaBand
>> in the warping options ?
>>
>> Even
>>
>> --
>> Spatialys - Geospatial professional services
>> http://www.spatialys.com
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20141027/f51f9699/attachment.html>


More information about the gdal-dev mailing list