Bug 1030 - scale not updated correctly in jsapi mode
: scale not updated correctly in jsapi mode
Status: RESOLVED FIXED
: Chameleon
Core
: 2.2
: PC Windows XP
: P2 normal
: 2.2
Assigned To:
:
:
:
:
: 989
  Show dependency treegraph
 
Reported: 2005-05-13 17:35 by
Modified: 2005-05-18 13:47 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2005-05-13 17:35:25
The scale used for the Scale widget always lags behind one zoom action. The
problem is both in 2.0.1 as in 2.2 beta.

Okay, finally tracked this one down with Paul's help.

The problem was in UpdateMap.php (BuildHTMLOutputMapExtentsChanged function)
with Mapscript not updating the $oMap->scale correctly, only after a call to
draw() it would update but that's quite inefficient.

So we ended up calculating the scale in PHP instead.

$inchesPerUnit = array(1, 12, 63360.0, 39.3701, 39370.1, 4374754);
$mnScale =
(($oMap->extent->maxx-$oMap->extent->minx)*$oMap->resolution*$inchesPerUnit[$oMap->units])/($oMap->width);

$szResult .= "<input type=\"hidden\" name=\"MAP_SCALE\" value=".$mnScale."> <br>\n";
------- Comment #1 From 2005-05-13 17:40:42 -------
I can do this for CVS head. But I don't know how to work in the 2.0 branch so if
this needs to be backported, someone else should do it, or please explain to me
how to fix stuff in 2.0.X with CVS.
------- Comment #2 From 2005-05-16 07:40:22 -------
Done in both 2.0 and 2.2.

2.2: revision 1.49 of UpdateMap.php
2.0: revision 1.46.2.1 of UpdateMap.php