You didn't say if you are using MapScript, the CGI or what. I'll assume 
MapScript
based on context.

Scale is such an arbitrary thing with web-based mapping. You definitely can't
set SCALE within the mapObj and hope things work. Instead you'll probably need
to compute an extent based on a point and a scale value. To do this you need a 
couple
of pieces of info:

1) the number of pixels per inch of the output device, MapServer uses 72 
internally
2) the number of inches per map unit: for meters that value would be 39.3701

>From there the rest is easy, here's some pseudo code:

 extentFromScale(x, y, scale, width, height) {

  cellsize = (scale/PixelsPerInch)/InchesPerMapUnit;

  minx = x - cellsize*width/2.0;
  miny = y - cellsize*height/2.0;
  maxx = x + cellsize*width/2.0;
  maxy = y + cellsize*height/2.0;
}

Now just plug the extent values into the main map extent (note scale is a value 
of, say, 50000).

For the CGI just initialize the application using mapxy and scale parameters 
and be done with it.

Steve
>>> Peter Kingsbury <[EMAIL PROTECTED]> 11/29/05 7:36 PM >>>
In my mapping application, I'd like to have a default scale to be used 
when the page first loads.

I've attempted to set this in the map file (e.g. SCALE value in the root 
object) as well as MAXSCALE, however it seems to default to a certain 
aggravating value.

I've also tried twiddling with the map extents, however this just causes 
the scale to bump up away from my target scale. :)

Any help is appreciated!

- P

Reply via email to