Skip to content

Commit 4e61363

Browse files
committed
[BUGFIX] Set default units to mm in exportSld
The default units in QgsMapRenderer is Millimeters. The default units in SLD is Pixel but exportSld does not convert all millimeters in pixels. We notes this bug by comparing default QGS Server rendering and rendering with the SLD generated by QGIS. To resolve it, we just have to add units to the document element.
1 parent f672344 commit 4e61363

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/core/qgsmaplayer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,7 @@ void QgsMapLayer::exportSldStyle( QDomDocument &doc, QString &errorMsg )
13701370
// Create the root element
13711371
QDomElement root = myDocument.createElementNS( "http://www.opengis.net/sld", "StyledLayerDescriptor" );
13721372
root.setAttribute( "version", "1.1.0" );
1373+
root.setAttribute( "units", "mm" ); // default qgsmaprenderer is Millimeters
13731374
root.setAttribute( "xsi:schemaLocation", "http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" );
13741375
root.setAttribute( "xmlns:ogc", "http://www.opengis.net/ogc" );
13751376
root.setAttribute( "xmlns:se", "http://www.opengis.net/se" );

0 commit comments

Comments
 (0)