File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ();
You can’t perform that action at this time.
0 commit comments