[mapserver-users] ways to get map scale value

Hankley, Chip Chip.Hankley at GASAI.Com
Mon Jul 1 09:57:13 EDT 2002


Do you mean beyond the use of [SCALE]?

See the template reference in the docs.

http://mapserver.gis.umn.edu/doc36/template-reference.htmlhttp://mapserver.g
is.umn.edu/doc36/template-reference.html

Note the need for *some* caution using this, as the docs say 

"Current image scale. The exact value is not appropriate for user
information but essential for some applications. The value can be rounded
e.g. using JavaScript or server side post processing.:

Here's an example using JavaScript to make it more 'palatable' in the
display:

<script language="javascript">
function fnxRoundNo(i) {
  var new_scale;
  new_scale = separate(Math.round(i/100)*100, ",");
  
  document.write("Scale 1:" + new_scale);
}
function separate(input, separator) {
    input = "" + input;
    var output = "";
    for (var i=0; i < input.length; i++) {
      if (i != 0 && (input.length - i) % 3 == 0) output += separator;
      output += input.charAt(i);
    }
    return output;
}
</script>

... here's the pertinent HTML

<script>fnxRoundNo([scale]);</script>

...

-----Original Message-----
From: Jee Young Lee [mailto:JeeYoung.Lee at safe.com]
Sent: Friday, June 28, 2002 6:45 PM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] ways to get map scale value


Does anyone know any easy way (without using mapscript) to get the map scale
value?  Or, do I need to use mapscript to get the map scale? 
Thanks in advance!

-Jee



More information about the mapserver-users mailing list