Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
By default use the reference OGC dpi
Calculate from the OGC reference pixel size
  • Loading branch information
Stéphane Brunner committed Sep 14, 2013
1 parent 902995e commit 617fa68
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/mapserver/qgswmsserver.cpp
Expand Up @@ -1109,16 +1109,18 @@ QImage* QgsWMSServer::createImage( int width, int height ) const

//apply DPI parameter if present. This is an extension of QGIS mapserver compared to WMS 1.3.
//Because of backwards compatibility, this parameter is optional
double OGC_PX_M = 0.00028; // OGC referance pixel size in meter, also used by qgis
int dpm = 1 / OGC_PX_M;
if ( mParameterMap.contains( "DPI" ) )
{
int dpi = mParameterMap[ "DPI" ].toInt( &conversionSuccess );
if ( conversionSuccess )
{
int dpm = dpi / 0.0254;
theImage->setDotsPerMeterX( dpm );
theImage->setDotsPerMeterY( dpm );
dpm = dpi / 0.0254;
}
}
theImage->setDotsPerMeterX( dpm );
theImage->setDotsPerMeterY( dpm );
return theImage;
}

Expand Down

0 comments on commit 617fa68

Please sign in to comment.