ScaleHint in GetCapabilities resquest

Daniel Morissette dmorissette at MAPGEARS.COM
Fri Oct 19 10:24:03 EDT 2007


Jacolin Yves wrote:
> Hi list,
> 
> After a GetCapabilities resquest on a mapserver server, I find this line 
> inside my xml file:
> <ScaleHint min="9.97805696859274" max="249.451424214819" />
> 
> In my mapfile, I defined min et max scale values with:
>    MINSCALE 20000
>    MAXSCALE 500000
> 
> How can I convert the scaleHint value to the mapfile value? In other words, 
> what does scaleHint values means?
> 

WMS defines the scalehint values as the ground distance in meters of the 
southwest to northeast diagonal of the central pixel of a map. ScaleHint 
values are the min and max recommended values of that diagonal. (See WMS 
1.1.0 sect. 7.1.5.4)

It is calculated in msWMSPrintScaleHint() in MapServer's mapwms.c:

   diag = sqrt(2.0);

   if (minscaledenom > 0)
     scalehintmin = 
diag*(minscaledenom/resolution)/msInchesPerUnit(MS_METERS,0);
   if (maxscaledenom > 0)
     scalehintmax = 
diag*(maxscaledenom/resolution)/msInchesPerUnit(MS_METERS,0);


The use of inchesPerUnit conversion is because resolution is in pixels 
per inch, and we need the result in meters.

I'll leave it as an exercise to you to figure out the reverse conversion 
(scalehint -> scaledenom). ;)

Daniel
-- 
Daniel Morissette
http://www.mapgears.com/



More information about the mapserver-users mailing list