[Fdo-trac] [fdo-trac] #1021: GDAL provider: upsampled rasters come out with blank horizontal stripes

FDO trac_fdo at osgeo.org
Sat Oct 24 00:21:46 PDT 2026


#1021: GDAL provider: upsampled rasters come out with blank horizontal stripes
---------------------------+----------------------
 Reporter:  jng            |        Owner:  jng
     Type:  defect         |       Status:  closed
 Priority:  major          |    Milestone:  4.2.0
Component:  GDAL Provider  |      Version:
 Severity:  3              |   Resolution:  fixed
 Keywords:                 |  External ID:
---------------------------+----------------------
Changes (by jng):

 * resolution:   => fixed
 * status:  assigned => closed

Comment:

 In [changeset:"8422" 8422]:
 {{{#!CommitTicketReference repository="" revision="8422"
 GDAL: stop upsampled rasters coming out with blank scanlines

 A raster feature source whose image is requested at a larger size than the
 source renders as horizontal stripes - some output rows are entirely
 blank.
 Reported from MapGuide as a striped render of a GeoTIFF feature source.

 Rasters above 4,000,000 pixels are read one scanline per tile
 (FdoRfpBandRaster::GetDataModel sets TileSizeY to 1), so every output row
 rounds its own source window. When the requested image is larger than the
 source, each window is less than one source pixel tall, and floor(...+0.5)
 on
 both of its edges rounds to the same pixel: the window height, and with it
 the
 height of the block copied out of it, comes out as zero. Rounded offsets
 can
 likewise land one pixel past the end of the source. GDAL returns CE_None
 for a
 zero-size window without writing anything (GDALRasterBand::RasterIO), so
 the
 tile buffer keeps the 0xFF that FdoRfpStreamReaderByTile::_getTile memsets
 it
 to, and the row is emitted blank.

 GDAL provider

   - FdoRfpStreamReaderByTile::_getTile clamps the read window to the
 image:
     fileWinXOff/fileWinYOff are held to the last source pixel and
     fileWinXSize/fileWinYSize to at least one pixel. The existing edge
 trip,
     which narrows a window straddling the right or bottom edge, can round
 a
     fraction of a source pixel down to nothing in the same way, so
     m_wrkBlockXSize/m_wrkBlockYSize are clamped to at least one after it.

 Tests

   - RfpTestDem::testUpsampledTileStream reads the 337x469 DEM fixture at
     2048x2048: over the 4,000,000-pixel threshold, and upsampled in both
     directions. Asserts the data model is scanline-tiled and that no
 output row
     is entirely 0xFF - the fixture's samples are 943..3178, so a genuine
 row
     never can be. Reports 1579 blank rows of 2048 when the provider change
 is
     removed.
   - RfpTestDem::testUpsampledTileStreamEdgeRows does the same at
 3001x1400,
     where 469/1400 puts the last output row's rounded source offset on the
 row
     just past the end of the 469-row source. Reports 931 blank rows of
 1400
     when the provider change is removed.

 Verified in Debug and Release: GDAL 68 tests (66 before), all passing. The
 Debug
 run exits 0 with no LeakSanitizer records.

 Fixes #1021
 }}}
-- 
Ticket URL: <https://trac.osgeo.org/fdo/ticket/1021#comment:1>
FDO <http://fdo.osgeo.org/>
Feature Data Objects


More information about the fdo-trac mailing list