Scale value output in MapServer CGI

Richard Greenwood richard.greenwood at GMAIL.COM
Thu Dec 23 23:26:31 EST 2004


On Wed, 22 Dec 2004 13:08:49 -0500, Kralidis,Tom [Burlington]
<Tom.Kralidis at ec.gc.ca> wrote:
> Hi,
>
> Using MapServer CGI, I currently run the [scale] value through the
> JavaScript functions below:
>
>   // fix scale values
>   function fnxRoundNo(i) {
>     var new_scale;
>     new_scale = separate(Math.round(i/100)*100, ",");
>     document.write("Scale 1: " + new_scale);
>   }
>
>   function separate(input, separator) {
>     var input2 = "" + input;
>     var output = "";
>     for (var i=0; i < input2.length; i++) {
>       if (i != 0 && (input2.length - i) % 3 == 0) output += separator;
>       output += input2.charAt(i);
>     }
>     return output;
>   }
>
> So something like 226787247.360000 is output as: 1: 226,787,200 via:
> javascript:fnxRoundNo(226787247.360000);
>
> Is there a way to get this from the CGI itself without having to put
> through JavaScript?

Not that I know of.

>  If no, does anyone think this would be a useful
> enhancement to MapServer CGI (i.e. addition of [scale_rounded] type
> template variable)?

Yes, seems like it would be useful. Like if you wanted to avoid
javascript. But I would think it should be a map file parameter. Why
are you thinking template variable?

Regards,
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the mapserver-users mailing list