Scale value output in MapServer CGI
Kralidis,Tom [Burlington]
Tom.Kralidis at EC.GC.CA
Fri Dec 24 05:09:29 PST 2004
> -----Original Message-----
> From: UMN MapServer Users List
> [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Richard Greenwood
> Sent: Thursday, 23 December, 2004 23:27
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-USERS] Scale value output in MapServer CGI
>
>
> 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?
>
I'm not sure :) Perhaps I'm using the incorrect terminology, but my use
case is as you note, to avoid using JavaScript for this.
..Tom
> Regards,
> --
> Richard Greenwood
> richard.greenwood at gmail.com
> www.greenwoodmap.com
>
More information about the MapServer-users
mailing list