Skip to content

Commit c54b8e5

Browse files
author
mmassing
committedMar 14, 2011
Fix #3596
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15481 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed
 

‎src/providers/gdal/qgsgdalprovider.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,11 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
143143
mMinimum.append( 0 );
144144
mMaximum.append( 0 );
145145
}
146+
146147
// Check if we need a warped VRT for this file.
147-
if (( GDALGetGeoTransform( mGdalBaseDataset, mGeoTransform ) == CE_None
148-
&& ( mGeoTransform[1] < 0.0
148+
bool hasGeoTransform = GDALGetGeoTransform( mGdalBaseDataset, mGeoTransform ) == CE_None;
149+
if ( ( hasGeoTransform
150+
&& ( mGeoTransform[1] < 0.0
149151
|| mGeoTransform[2] != 0.0
150152
|| mGeoTransform[4] != 0.0
151153
|| mGeoTransform[5] > 0.0 ) )
@@ -168,6 +170,20 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
168170
mGdalDataset = mGdalBaseDataset;
169171
GDALReferenceDataset( mGdalDataset );
170172
}
173+
174+
if (!hasGeoTransform)
175+
{
176+
mWidth = GDALGetRasterXSize( mGdalDataset );
177+
mHeight = GDALGetRasterYSize( mGdalDataset );
178+
179+
// Initialise the affine transform matrix
180+
mGeoTransform[0] = 0;
181+
mGeoTransform[1] = 1;
182+
mGeoTransform[2] = 0;
183+
mGeoTransform[3] = 0;
184+
mGeoTransform[4] = 0;
185+
mGeoTransform[5] = -1;
186+
}
171187

172188
//check if this file has pyramids
173189
CPLErrorReset();

0 commit comments

Comments
 (0)
Please sign in to comment.