Thanks Armin, I have done the calculations using the formula I suppose mapserver is using, something like:
md = (width-1)/(MS_PPI*inchesPerUnit[units]); gd = extent.maxx - extent.minx; scale = gd/md; It is pretty much ok now. The "only" thing left to solve (I hope) is the reference map. Since the users are now lilmited to one extent only, I would like my reference map to always show the whole map with the refbox set to the extent in which the map was opened. And that is all. I don't have to use the reference map for anything else in this case (no actions on the refmap needed). What is the simplest way of disabling it? Just one note: do the offsX and offsY parameters in refmap.phtml need to be exactly the same as "left" and "top" in .refmap class in default.css? I wanted to move my reference map to the right (it was not centrally aligned in the frame) so I just increased the value of "left" in default.css to 8 instead of 4. It seems fine but I don't know if this will cause trouble as the offsX is set to 6 in refmap.phtml? thanks dejan > -----Original Message----- > From: Armin Burger [mailto:armin.burger at gmx.net] > Sent: Friday, May 26, 2006 4:02 PM > To: Gambin Dejan > Subject: Re: [Pmapper-users] Dynamic map creation in pmapper > > > the max scale is just a coarse estimation using the height relations. > You might also use the width relations and then use the > average of both. > > Gambin Dejan wrote: > > Hi, > > > > I have been able to change s1 parameter after resizing the > map. But it > > seems my calculation is somehow wrong. I have saved my new > y_dgeo in a > > JS variable somewhere during map initialization. Then I > have tried to > > use it for the new calculation using the formula as in > returnMaxScale > > function. So: > > > > $s1 = ($my_new_y_dgeo / $mapheight) / (0.0254 / $scrRes); > (my_new_dgeo > > is 625) > > > > In first loading I get it correct > (625/294)/(0.0254/96)=8035, but in > > second I get (625/399)/(0.0254/96)=5920...and the scale shown is > > 6247... > > > > Any clue? > > > > dejan > > >