Bug 1030

Summary: scale not updated correctly in jsapi mode
Product: Chameleon Reporter: Bart van den Eijnden <bartvde@osgis.nl>
Component: CoreAssignee: Bart van den Eijnden <bartvde@osgis.nl>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 2.2   
Target Milestone: 2.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 989    

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