ScaleHint in GetCapabilities resquest

Jacolin Yves yjacolin at FREE.FR
Mon Oct 22 07:12:48 EDT 2007


Le Friday 19 October 2007 16:24:03 Daniel Morissette, vous avez écrit :
> 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,

Does the default resolution of a map is 75 dpi?

The reversion conversion should be : minScale = (ScaleHint/diag)*resolution
with diag = sqrt(2.0);
resolution in pixel/m -> 2.54 E-02 pixel/inch (equal to dpi?)

so minScale = (9.97805696859274/sqrt(2.0))*75/2.54*100
minScale = 20 833 (instead of 20 000)
maxScale = 520 833 (500 000)

Does this differences are normal?

Thanks,

Y.
-- 
Yves Jacolin
---
http://softlibre.gloobe.org



More information about the mapserver-users mailing list