Skip to content

Commit 617fa68

Browse files
author
Stéphane Brunner
committed
By default use the reference OGC dpi
Calculate from the OGC reference pixel size
1 parent 902995e commit 617fa68

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/mapserver/qgswmsserver.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,16 +1109,18 @@ QImage* QgsWMSServer::createImage( int width, int height ) const
11091109

11101110
//apply DPI parameter if present. This is an extension of QGIS mapserver compared to WMS 1.3.
11111111
//Because of backwards compatibility, this parameter is optional
1112+
double OGC_PX_M = 0.00028; // OGC referance pixel size in meter, also used by qgis
1113+
int dpm = 1 / OGC_PX_M;
11121114
if ( mParameterMap.contains( "DPI" ) )
11131115
{
11141116
int dpi = mParameterMap[ "DPI" ].toInt( &conversionSuccess );
11151117
if ( conversionSuccess )
11161118
{
1117-
int dpm = dpi / 0.0254;
1118-
theImage->setDotsPerMeterX( dpm );
1119-
theImage->setDotsPerMeterY( dpm );
1119+
dpm = dpi / 0.0254;
11201120
}
11211121
}
1122+
theImage->setDotsPerMeterX( dpm );
1123+
theImage->setDotsPerMeterY( dpm );
11221124
return theImage;
11231125
}
11241126

0 commit comments

Comments
 (0)