File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -143,9 +143,11 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
143
143
mMinimum .append ( 0 );
144
144
mMaximum .append ( 0 );
145
145
}
146
+
146
147
// 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
149
151
|| mGeoTransform [2 ] != 0.0
150
152
|| mGeoTransform [4 ] != 0.0
151
153
|| mGeoTransform [5 ] > 0.0 ) )
@@ -168,6 +170,20 @@ QgsGdalProvider::QgsGdalProvider( QString const & uri )
168
170
mGdalDataset = mGdalBaseDataset ;
169
171
GDALReferenceDataset ( mGdalDataset );
170
172
}
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
+ }
171
187
172
188
// check if this file has pyramids
173
189
CPLErrorReset ();
You can’t perform that action at this time.
0 commit comments