Skip to content

Commit b54b159

Browse files
committedOct 23, 2015
[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 1a9aec4 commit b54b159

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
@@ -1380,6 +1380,7 @@ void QgsMapLayer::exportSldStyle( QDomDocument &doc, QString &errorMsg )
13801380
// Create the root element
13811381
QDomElement root = myDocument.createElementNS( "http://www.opengis.net/sld", "StyledLayerDescriptor" );
13821382
root.setAttribute( "version", "1.1.0" );
1383+
root.setAttribute( "units", "mm" ); // default qgsmaprenderer is Millimeters
13831384
root.setAttribute( "xsi:schemaLocation", "http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" );
13841385
root.setAttribute( "xmlns:ogc", "http://www.opengis.net/ogc" );
13851386
root.setAttribute( "xmlns:se", "http://www.opengis.net/se" );

0 commit comments

Comments
 (0)
Please sign in to comment.