Skip to content
Permalink
Browse files

Fix WMS DPI scale rounding error

  • Loading branch information
elpaso committed Mar 17, 2021
1 parent 51339ef commit ec83481f0fcb3e3a5affdc200114b816b88de882
Showing with 4 additions and 2 deletions.
  1. +1 −1 src/server/services/wms/qgswmsrendercontext.cpp
  2. +3 −1 src/server/services/wms/qgswmsrenderer.cpp
@@ -172,7 +172,7 @@ qreal QgsWmsRenderContext::dotsPerMm() const
// Apply DPI parameter if present. This is an extension of QGIS Server
// compared to WMS 1.3.
// Because of backwards compatibility, this parameter is optional
int dpm = 1 / OGC_PX_M;
qreal dpm = 1 / OGC_PX_M;

if ( !mParameters.dpi().isEmpty() )
{
@@ -1096,7 +1096,9 @@ namespace QgsWms
}

mapSettings.setOutputSize( QSize( paintDevice->width(), paintDevice->height() ) );
mapSettings.setOutputDpi( paintDevice->logicalDpiX() );
// Recalculate from input DPI: do not take the (integer) value from paint device
// because it loose precision!
mapSettings.setOutputDpi( mContext.dotsPerMm() * 25.4 );

//map extent
QgsRectangle mapExtent = mWmsParameters.bboxAsRectangle();

0 comments on commit ec83481

Please sign in to comment.