[gdal-dev] GDALWarp Datasets

Even Rouault even.rouault at spatialys.com
Fri Feb 15 01:57:49 PST 2019


On vendredi 15 février 2019 00:06:28 CET James McClain wrote:
> Hello,
> 
> If I may, I would like to a few questions regarding how best to use the
> GDALWarp function (
> https://github.com/OSGeo/gdal/blob/master/gdal/apps/gdalwarp_lib.cpp#L748-L7
> 70) and the datasets that it creates.
> 
> In particular, I am experimenting with using such datasets to read warped
> extents on an on-demand basis and in a thread-safe way.
> 
> I have found that the VRT output format is lazy with respect to computation
> and allocation which is great for my use case, but it appears not to be
> thread safe with respect to reading from a single warped dataset from
> multiple threads.

No single GDALDataset object of any driver should be used simultaneously by 
multiple threads (this extends to any GDAL/OGR class instance). If this seems 
to work for GTiff, you're just lucky, but that might just fail as well.
If you need to access a dataset from several threads, each one should have its 
own GDALDataset object (so this won't work for the MEM driver)

> 
> On a more meta level, are datasets created by GDALWarp the right approach
> (if I want to lazy get warped extents in a thread-safe manner) or should I
> look elsewhere?

If you're not interested in the pixel values, using GDALSuggestedWarpOutput2() 
is a better fit.

Even

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


More information about the gdal-dev mailing list