[Mapserver-users] A Legend question and a Scale question

Richard Greenwood rich at greenwoodmap.com
Fri Feb 13 21:11:14 PST 2004


Richie Pierce wrote:

> 1)       I have set a scale tolerance on some of my layers and I am 
> trying to get the scale to print to the map so that the user will know 
> what scale they are at.  I grabbed some code from the GMAP demo and have 
> gotten it to work, somewhat.  It works except on the initial load of the 
> page.  When the page loads it prints -1.00000.  But when the user clicks 
> refresh, or zoom, or anything and updates the page.  The scale is 
> printed correctly.  I was wondering what I’m missing.  I was also 
> wanting to remove the decimal points and round the scale to a whole 
> number. 

To round, try something like this:

<script language="JavaScript">
    document.write("Scale 1:" + Math.round([scale]/100)*100);
</script>

-- 
Richard Greenwood
www.greenwoodmap.com




More information about the MapServer-users mailing list