[mapserver-dev] Should layer->scalefactor contain resolution factor?

Tamas Szekeres szekerest at gmail.com
Sat Nov 8 14:48:35 PST 2014


Hi Devs,

I'm trying to implement a fix for #5029
<https://github.com/mapserver/mapserver/issues/5029>, but I'm not quite
sure about the expected interpretation of layer->scalefactor.

According to mapwms.c the value is set as follows:

*if(GET_LAYER(map, i)->sizeunits != MS_PIXELS)*
*        GET_LAYER(map, i)->scalefactor = (msInchesPerUnit(GET_LAYER(map,
i)->sizeunits,0)/msInchesPerUnit(map->units,0)) / map->cellsize;*
*      else if(GET_LAYER(map, i)->symbolscaledenom > 0 && map->scaledenom >
0)*
*        GET_LAYER(map, i)->scalefactor = GET_LAYER(map,
i)->symbolscaledenom/map->scaledenom;*
*      else*
*        GET_LAYER(map, i)->scalefactor = 1;*

But in mapdraw.c we have:

*for(i=0; i<map->numlayers; i++) {*
*    if(GET_LAYER(map, i)->sizeunits != MS_PIXELS)*
*      GET_LAYER(map, i)->scalefactor = (msInchesPerUnit(GET_LAYER(map,
i)->sizeunits,0)/msInchesPerUnit(map->units,0)) / geo_cellsize;*
*    else if(GET_LAYER(map, i)->symbolscaledenom > 0 && map->scaledenom >
0)*
*      GET_LAYER(map, i)->scalefactor = GET_LAYER(map,
i)->symbolscaledenom/map->scaledenom*map->resolution/map->defresolution;*
*    else*
*      GET_LAYER(map, i)->scalefactor = map->resolution/map->defresolution;*
*  }*


In my understanding layer->scalefactor should contain the resolution factor
(to have the symbols to scale properly) so the corresponding code in wms.c
is incorrect.

However the legend drawing code uses layer->scalefactor *
image->resolutionfactor which causes a double magnification for the symbols.

Let me know about the expected behaviour.

Thanks,

Tamas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20141108/7cec3d3f/attachment.html>


More information about the mapserver-dev mailing list