Opened 9 months ago

Closed 9 months ago

Last modified 9 months ago

#6599 closed defect (fixed)

Error when applying PixelFuntion to a VRTDerivedRasterBand

Reported by: bugbuster Owned by: warmerdam
Priority: normal Milestone: 1.11.6
Component: GDAL_Raster Version: 2.0.2
Severity: normal Keywords: vrt derived
Cc:

Description

I have tried to apply a PixelFunction? to a VRTDerivedRasterBand with no succes. My environment :

  • windows 8 64 bits
  • VisualC++ 2010

To illustrate the problem, I slightly modified gdal_translate.cpp code :

In every call to SnafuFunc?(), I print several Input/output parameters. I noticed that I always get :

  • nSources = 0
  • papoSources = 0x000 (which is consistent with nSources being null)

The data I have used for this test are :

  • original image : TIF gray scale 8-bit depth
  • VRT image :
    <VRTDataset rasterXSize="512" rasterYSize="512"  >
      <VRTRasterBand dataType="Byte" band="1" subClass="VRTDerivedRasterBand">
        <Description>SnafuFunc</Description>
        <PixelFunctionType>MySnafuFunc</PixelFunctionType>
        <SourceTransferType>Byte</SourceTransferType>
        <SimpleSource>
          <SourceFilename relativeToVRT="1">fubar_ori.tif</SourceFilename>
          <SourceBand>1</SourceBand>
          <SourceProperties RasterXSize="512" RasterYSize="512" DataType="Byte" />
          <SrcRect xOff="0" yOff="0" xSize="512" ySize="512"/>
          <DstRect xOff="0" yOff="0" xSize="512" ySize="512"/>
        </SimpleSource>
      </VRTRasterBand>
    </VRTDataset>
    

Why do I always get nSources = 0 in every call to SnafuFunc?() ? Every call to SnafuFunc?() exit with a CE_Failure status. Am I doing something wrong ?

Thanks for your help

Attachments (3)

fubar.vrt (645 bytes) - added by bugbuster 9 months ago.
fubar_ori.tif (256.4 KB) - added by bugbuster 9 months ago.
original TIF image
gdal_translate_modified.cpp (75.2 KB) - added by bugbuster 9 months ago.
gdal_translate.cpp source code, with modification for SnafuFunc?()

Download all attachments as: .zip

Change History (10)

Changed 9 months ago by bugbuster

Attachment: fubar.vrt added

Changed 9 months ago by bugbuster

Attachment: fubar_ori.tif added

original TIF image

Changed 9 months ago by bugbuster

Attachment: gdal_translate_modified.cpp added

gdal_translate.cpp source code, with modification for SnafuFunc?()

comment:1 Changed 9 months ago by Even Rouault

Resolution: fixed
Status: newclosed

In 34728:

VRT: make CheckCompatibleForDatasetIO() return FALSE on VRTDerivedRasterBands (fixes #6599)

comment:2 Changed 9 months ago by Even Rouault

In 34729:

Test fixes #6599

comment:3 Changed 9 months ago by Even Rouault

In 34730:

VRT: make CheckCompatibleForDatasetIO() return FALSE on VRTDerivedRasterBands (fixes #6599)

comment:4 Changed 9 months ago by Even Rouault

In 34731:

VRT: make CheckCompatibleForDatasetIO() return FALSE on VRTDerivedRasterBands (fixes #6599)

comment:5 Changed 9 months ago by Even Rouault

In 34732:

VRT: make CheckCompatibleForDatasetIO() return FALSE on VRTDerivedRasterBands (fixes #6599)

comment:6 Changed 9 months ago by Even Rouault

A workaround can be to modify the VRT and replace <SimpleSource?> by <ComplexSource?>.

comment:7 Changed 9 months ago by Even Rouault

Component: defaultGDAL_Raster
Keywords: vrt derived added
Milestone: 1.11.6
Note: See TracTickets for help on using tickets.