Assorted formatting queries
Matthew Perry
perrygeo at GMAIL.COM
Sun Jul 2 09:35:00 PDT 2006
On 7/2/06, Nigel Gilbert <n.gilbert at surrey.ac.uk> wrote:
>
> I'm just finishing the first iteration of a Mapserver template and have a
> number of small queries that I cannot find the answers to in the
> documentation:
>
> 1. I am using [scale] to insert the current map scale (as "1:[scale]").
> However, the value inserted by mapserver includes many decimal places and
> would be better rounded to a reasonable number of significant figures before
> it is displayed. Is there any easier way of doing this than writing a
> rounding routine in Javascript?
>
You can use javascript to store scale as a variable and then do the rounding:
var scale = [scale];
var scale_round = Math.round(scale * 1000) / 1000;
document.write(scale);
--
Matt Perry
perrygeo at gmail.com
http://www.perrygeo.net
More information about the MapServer-users
mailing list