[gdal-dev] Slow warping

Even Rouault even.rouault at spatialys.com
Fri Nov 27 04:10:18 PST 2015


Le vendredi 27 novembre 2015 12:58:01, Ari Jolma a écrit :
> I warped an image for which I estimated a geotransform. I'm wondering
> why it took so long (hours).
> 
> My source image is a jpeg, lets call it src.jpg. I add the geotransform
> as a jpgw-file.
> 
> This goes fast:
> 
> gdal_translate -of JPEG src.jpg test.jpg
> Input file size is 6048, 4032
> 0...10...20...30...40...50...60...70...80...90...100 - done.
> 
> but the result is not warped, there is a test.jpg-aux.xml file, which
> contains the original geotransform.
> 
> gdalwarp does not do it:
> 
> gdalwarp -of JPEG jpg-3067/09410_001.jpg test2.jpg
> Output driver `JPEG' not recognised or does not support
> direct output file creation.
> 
> Using the AutoCreateWarpedVRT in bindings works:
> 
> use Geo::GDAL;
> 
> my $dataset = Geo::GDAL::Open('src.jpg');
> my $warped = Geo::GDAL::AutoCreateWarpedVRT($dataset);
> Geo::GDAL::Driver('JPEG')->Copy('tets3.jpg', $warped, 1, undef, sub {my
> $prog = shift; say $prog});
> 
> but it is really slow.
> 
> Does QGIS use AutoCreateWarpedVRT when it does on-the-fly reprojection?

Yes

> It outputs
> 
> Warning: Creating Warped VRT.
> 
> to the terminal. And it is fast.

If the image is let's say upside-down, it might be that the block cache isn't 
large enough to handle the CreateCopy() and that the source JPEG must be fully 
uncompressed each time a line is warped. Try setting GDAL_CACHEMAX to 150 
(6048 * 4032 * 3 = 73 MB. and a x 2 security margin).
Look also if cache trashing warnings appear with CPL_DEBUG=ON

Even

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


More information about the gdal-dev mailing list