AW: [mapserver-users] Micro-HowTo Display SCALE

Maul, Andreas-Alexander Andreas.Maul at bgr.de
Mon Dec 17 04:38:05 EST 2001


Hi Steves,
it is easy to cut off the scale decimals with some javascripting in the
template file, eg.:

<html>
<head>
   <title>MapServer HTML Template</title>
<script language="JavaScript">
<!--
var my_scale=Math.round([scale]);
//-->
</script>
</head>
<body>
...
<script language="JavaScript">
<!--
document.writeln("<b>Scale ca. 1 : "+my_scale+"</b>");
//-->
</script>
...
</body>
</html>

Regards,
Andreas Maul

-----Ursprüngliche Nachricht-----
Von: Stephen Woodbridge [mailto:woodbri at swoodbridge.com]
Gesendet am: Freitag, 14. Dezember 2001 23:37
An: klehr1 at tampabay.rr.com; MapServer List
Betreff: Re: [mapserver-users] Micro-HowTo Display SCALE

Steve,

I've posted this back to the list, maybe one of the developers can help
with this. I thought the number of decimal places was a bit excessive
myself :)

The only way to trim this up in html would be to write some javascript
:(

We seem to have a lot of Steves posting to this list!
  -The other Steve!

klehr1 at tampabay.rr.com wrote:
> 
> Thanks for the tip.
> 
> I just tried it out and I got Scale: 1:21600.000000
> 
> Is there away to tone down the decimals (%.2f) ?
> 
> Not sure if you can do this with Mapserver directly, but maybe you can
> format the output in a later release.
> 
> Thanks
> Steve Lehr
> 
> ----- Original Message -----
> From: Stephen Woodbridge <woodbri at swoodbridge.com>
> To: Twan Kogels <twan at twansoft.com>
> Cc: <mapserver-users at lists.gis.umn.edu>
> Sent: Friday, December 14, 2001 9:26 AM
> Subject: [mapserver-users] Micro-HowTo Display SCALE
> 
> > Hi all,
> >
> > Twan Kogels asked about the values on the MINSCALE and MAXSCALE and how
> > they relate to a given map.
> >
> > Go to your demo.html file and search for "scalebar" then replace that
> > line with the following:
> >
> >       <td align="right" valign="top"><font size=-3
> > face="arial,helvetica" color="#FFFFFF">1:[scale]</font>&nbsp;&nbsp;<img
> > src="[scalebar]"></td>
> >
> > Now just to the left of your scale bar you will have 1:ssssss.ssss where
> > ssssss.ssss is the scale of the map at whatever zoom you are at. This is
> > in the same units as the valuse on MINSCALE/MAXSCALE
> >
> > PLEASE, add this to the appropriate documentation as and example.
> >
> > Hope this helps,
> >   -Steve



More information about the mapserver-users mailing list