[Chameleon] Report the correct map scale

Paul Spencer pspencer at dmsolutions.ca
Tue Aug 9 08:08:20 EDT 2005


Abe,

this is actually not a bug, believe it or not!  I'm not sure if it is 
part of the documentation, but this has been the 'way it works' forever, 
much to my dismay.  You may also be able to call less-expensive 
functions such as $map->prepareImage(); to force the same thing.

Please try to get Daniel to change this,  I haven't had much luck 
convincing him :>

Paul

Abe Gillespie wrote:
> No, it's not with the JSAPI.  I found out it is a bug in MapScript
> itself.  Apparently the map object's scale is not updated until a draw
> is performed.  The following code is a work around:
> 
> $img = $map->draw();
> $img->free();
> 
> After this the scale is what it should be.  I'll have to tell the
> MapServer folks when I get the chance.
> 
> -Abe
> 
> On 8/9/05, Bart van den Eijnden <BEN at syncera-itsolutions.nl> wrote:
> 
>>Abe,
>>
>>are you in JSAPI mode or not?
>>
>>I fixed a similar problem a few months  ago, maybe you can check this bug report, the solution might also apply to your problem:
>>
>>http://bugzilla.maptools.org/show_bug.cgi?id=1030
>>
>>Best regards,
>>Bart
>>
>>Bart van den Eijnden
>>Syncera IT Solutions
>>Postbus 270
>>2600 AG  DELFT
>>
>>tel.nr.: 015-7512436
>>email: BEN at Syncera-ITSolutions.nl
>>
>>
>>>>>Abe Gillespie <abe.gillespie at gmail.com> 08/08/05 11:10pm >>>
>>
>>I'm having an issue getting the current map scale during widget load.
>>If I debug write out the scale of the map for the ZoomIn widget it's
>>always one step behind.  The following dump is from first loading the
>>page through two subsequent zoom-ins:
>>
>>Initial page load>
>>ZoomIn::ParseURL
>>pre-zoom scale: 432308.993166
>>
>>First zoom in>
>>ZoomIn::ParseURL
>>pre-zoom scale: 432308.993186
>>post-zoom scale: 432308.993186
>>
>>Second zoom in>
>>ZoomIn::ParseURL
>>pre-zoom scale: 102414.886918
>>post-zoom scale: 102414.886918
>>
>>Things to note:
>>1.  Initial page load doesn't have the "post-zoom" line because no
>>zooming was done.
>>2.  At first zoom in you see the scale is the same as when the page is
>>initially loaded (before AND after the actual zoom).
>>3.  At second zoom the scale has finally changed ... but this is
>>actually what the scale should have been reported for the post-zoom
>>line of the first zoom.
>>
>>Now the widget I'm creating is experiencing the same problems and
>>needs the current correct scale to function properly.
>>
>>Any ideas?
>>Thanks.
>>-Abe
>>
>>_______________________________________________
>>Chameleon mailing list
>>Chameleon at lists.maptools.org
>>http://lists.maptools.org/mailman/listinfo/chameleon
>>
>>
> 
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

-- 
+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+


More information about the Chameleon mailing list