[gdal-dev] Request for clarification on SPARSE_OK=TRUE and empty tiles relation

Even Rouault even.rouault at spatialys.com
Mon May 16 12:24:04 PDT 2016


Daniele,

> I have seen a recent email on that list about filling empty tiles and
> SPARSE_OK creation option (titled "Geotiff FillEmptyTiles with no data
> value")
> I would like to understand a little better how it works.
> 
> Suppose I have 2 isolated GeoTiff files of the same datatype, let's say one
> covering California and the other covering France.
> I do a gdalbuildvrt to mosaic them together and then I convert the VRT to
> GeoTiff.
> At which level the SPARSE_OK flag and void blocks management are taken into
> account?
> I was "hoping" that using the SPARSE_OK=TRUE create option when translating
> VRT to GeoTiff would have resulted into having an output smaller with
> respect to an output generated without that creation option since there is
> a wide void area in the middle.
> Why I get the same size in both cases? 

SPARSE_OK=TRUE has only effect when blocks are not written at all. If a block 
is written with pixels set to zero (or the no data value), it will still be 
flushed to disk. It would make sense to avoid that I guess.

> Shouldn't it avoid filling void
> blocks in the gap?
> Is the VRT Driver iterating on all the tiles involved in the final bounding
> box so that it forces a write of each block even if there is no source
> dataset for that tile?

Actually it is the GeoTIFF driver that iterates over the source dataset. It 
has no knowledge of the fact that the dataset dataset is a VRT and it may have 
sparse zones.

One way to workaround this would be to create an empty sparse target GeoTIFF 
of the appropriate size, and then gdalwarp each input dataset into it (with
-wo SKIP_NOSOURCE=YES)

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list