1

When loading a raster dataset that does not have a geotransform, QGIS overwrites GDAL default geotransform to use a negative Y spacing instead of positive.

This is done in qgisgdalprovider, here:

if ( GDALGetGeoTransform( mGdalDataset, mGeoTransform ) != CE_None )
{
    // if the raster does not have a valid transform we need to use
    // a pixel size of (1,-1), but GDAL returns (1,1)
    mGeoTransform[5] = -1;
}

Why? It can be a problem for example if you process such raster data with GDAL, and produce vector data to display later in QGIS, they will not overlap (regardless of CRS).

I realize that the identity geotransform will not happen in real data, but the topic of the default geotransform is important enough that I'm curious why QGIS made that decision. See here or here for example.

  • 2
    this is to handle the fact the image origin is in the top/left and geographic origin is bottom/left corner. – Ian Turton Dec 20 '18 at 13:56
  • The thing is that vector data do not have geotransforms (i.e it's always the identity) so these defaults are a bit inconsistent, and can bite you if you process such data. But I understand that it's nice that random png images show up not flipped for example. – fouronnes Dec 20 '18 at 15:01
  • I wonder the comment about the positive pixel size. gdal.org/gdal_tutorial.html considers north-up images as normal ones. – user30184 Dec 20 '18 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.