Scale value output in MapServer CGI

Kralidis,Tom [Burlington] Tom.Kralidis at EC.GC.CA
Wed Dec 22 13:08:49 EST 2004


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

Cheers

..Tom



More information about the mapserver-users mailing list