WMS Scale hint insight

Daniel Morissette dmorissette at MAPGEARS.COM
Wed Mar 21 15:42:44 EDT 2007


Here is the definition of WMS ScaleHint:

** (see WMS 1.1.0 sect. 7.1.5.4) The 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.


The reason why you get different scale values in your client is that 
scale is meaningless in a web environment since the server has no idea 
of the resolution of the screen of the client, so we have to go with 
assumptions.

MapServer uses a default screen resolution of 72 pixels per inch for its 
scale calculations, which can be changed with the RESOLUTION mapfile 
parameter (see 
http://mapserver.gis.umn.edu/docs/reference/mapfile/mapObj/?searchterm=resolution%20reference) 
and I am guessing that your client uses an assumption of 96dpi based on 
the values that you see. Setting RESOLUTION 96 in your mapfile would 
give you numbers that match in your client, but that are not necessarily 
true since the actual screen resolution may be a different value.

This issue has been discussed multiple times on this list, look for the 
very complete posts from Ed McNierney on this topic in the list archives.

Daniel



Travis Kirstine wrote:
> Hi All,
> I was hoping someone could provide some insight into minscale / maxscale and
> wms scalehints.
> 
> In my mapfile I have defined the scales as:
> 
>    LAYER
>       NAME "6km_tiles"
>       TILEINDEX "6km_tiles/6km_tindex"
>       TILEITEM "location"
>       METADATA
>          "wms_title" "6km Tiles"
>       END
>       PROJECTION
>          "init=epsg:26917" # utm nad 83 zone 17
>       END
>       TYPE RASTER
>       STATUS OFF
>       MAXSCALE 250000
>       MINSCALE 10000
>    END
> 
> and in my get capabilities request the layer / scale hints are defined as:
> 
>     <Layer queryable="0" opaque="0" cascaded="0">
>         <Name>6km_tiles</Name>
>         <Title>6km Tiles</Title>
>         <SRS>EPSG:26917</SRS>
>         <ScaleHint min="4.98902848429637" max="124.725712107409" />
>     </Layer>
> 
> and when I view the data as a client with the scales are defined as:
> 
>    max = 1:333,332
>    min = 1:13,333
> 
> How do these all relate? Why does the client's min/max scale "respect"
> scales defined in the mapfile?  How are the scalehints calculated?
> 
> Any insight would be great.
> 
> Thanks,
> 
> Travis Kirstine
> First Base Solutions Limited
> Markham, ON
> Canada


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



More information about the mapserver-users mailing list