resolutionfactor not used during LegendIcon creation (AGG) #4725

jpmaloberti opened this Issue Aug 9, 2013 · 0 comments


None yet

2 participants


I'm using the createLegendIcon class method, in a PHPMapscript script to generate a high resolution legend (PNG icons with AGG/PNG driver), inserted in a PDF document. The RESOLUTION value in the mapfile is modified from the script to obtain a medium (150 DPI) or high (300 DPI) resolution map. The DEFRESOLUTION is always 75. The map is scaled correctly but the legend icons are always in a poor resolution (normal size) or not well scaled (if oversized). It seems they are generated in a screen resolution.
Here the PHP code for 30 px x 20 px icons :
$factSize = ($myMap -> resolution) / ($myMap -> defresolution);
$myIcon = $myClass -> createLegendIcon(30 * $factSize, 20 * factSize);

Searching in maplegend.c I modified the calls to msDrawLineSymbol and msDrawShadeSymbol in msDrawLegendIcon function : I changed the last parameter from lp->scalefactor to lp-scalefactor * (image_draw->resolutionfactor) and the results are now ok.
I did'nt modify the call to msDrawMarkerSymbol for now.

@tbonfort tbonfort added a commit to mapserver/msautotest_DEPRECATED that referenced this issue Aug 9, 2013
@tbonfort tbonfort add test for legend scale-dependant rendering c978c77
@tbonfort tbonfort closed this in 50dfe81 Aug 9, 2013
@tbonfort tbonfort was assigned Aug 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment