Search code examples
gdalqgis

GDAL - XYZ to GeoTIFF slow


I have an XYZ raster file, 1.1GB in EPSG:23700 (EOV), 50 meters resolution.

The aim is to create a GeoTIFF file to be published via GeoServer (EPSG:4326), but I have some performance issues.

If I open the XYZ file from QGIS (2.14.0, Essen), choose Raster » Conversion » Translate and start it with the default options, it completes in several minutes, which is acceptable.

But if I copy the generated gdal_translate command and run it from CLI, than it takes more than an hour or so.

I've tried -co "GDAL_CACHEMAX=500", -co "NUM_THREADS=3", but has no effect. In the process monitor, the QGIS version uses 1 core fully (25% CPU) and the default max memory of 10MByte, but the CLI version only <10% and <10Mbyte mem. The --degub ON option shows "XYZ: New stepX=50.000000000000000" and hangs there.

I've tried to run it from the QGIS Directory \bin folder and the separately downloaded GDAL instance (C:\OSGeo4W64\bin), same results.

Windows Server 2012, 16GB RAM, 2,6 GHz 4 core Xenon CPU.

Any thoughts on this?


Solution

  • Looks like there's some problem with the environment variables. If I use a modified version of the QGIS startup batch file, it all works as expected.

    @echo off
    call "%~dp0\o4w_env.bat"
    @echo off
    path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%
    set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis
    set GDAL_FILENAME_IS_UTF8=YES
    set GDAL_CACHEMAX = 500
    rem Set VSI cache to be used as buffer, see #6448
    set VSI_CACHE=TRUE
    set VSI_CACHE_SIZE=1000000
    set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt4\plugins
    
    REM This line changed to run my batch file instead of starting QGIS.
    call "d:\gdaltest.bat"