@@ -87,7 +87,7 @@ QString QgsMapSettingsUtils::worldFileContent( const QgsMapSettings &mapSettings
87
87
s[1 ] = 0 ;
88
88
s[2 ] = xOrigin;
89
89
s[3 ] = 0 ;
90
- s[4 ] = ms.mapUnitsPerPixel ();
90
+ s[4 ] = - ms.mapUnitsPerPixel ();
91
91
s[5 ] = yOrigin;
92
92
93
93
// rotation matrix
@@ -104,7 +104,9 @@ QString QgsMapSettingsUtils::worldFileContent( const QgsMapSettings &mapSettings
104
104
double b = r[0 ] * s[1 ] + r[1 ] * s[4 ];
105
105
double c = r[0 ] * s[2 ] + r[1 ] * s[5 ] + r[2 ];
106
106
double d = r[3 ] * s[0 ] + r[4 ] * s[3 ];
107
- double e = r[3 ] * s[1 ] + r[4 ] * s[4 ];
107
+ // Pixel YDim - almost always negative
108
+ // See https://en.wikipedia.org/wiki/World_file#cite_ref-3, https://issues.qgis.org/issues/18491
109
+ double e = r[3 ] * s[1 ] + r[4 ] * s[4 ];
108
110
double f = r[3 ] * s[2 ] + r[4 ] * s[5 ] + r[5 ];
109
111
110
112
QString content;
@@ -113,10 +115,9 @@ QString QgsMapSettingsUtils::worldFileContent( const QgsMapSettings &mapSettings
113
115
// Rotation on y axis
114
116
content += qgsDoubleToString ( d ) + " \r\n " ;
115
117
// Rotation on x axis
116
- content += qgsDoubleToString ( -b ) + " \r\n " ;
117
- // Pixel YDim - almost always negative
118
- // See https://en.wikipedia.org/wiki/World_file#cite_ref-3
119
- content += " -" + qgsDoubleToString ( e ) + " \r\n " ;
118
+ content += qgsDoubleToString ( b ) + " \r\n " ;
119
+ // Pixel YDim
120
+ content += qgsDoubleToString ( e ) + " \r\n " ;
120
121
// Origin X (center of top left cell)
121
122
content += qgsDoubleToString ( c ) + " \r\n " ;
122
123
// Origin Y (center of top left cell)
0 commit comments