[mapserver-users] strange behaviour of zoomscale() in phpmapscript

Daniel Morissette morissette at dmsolutions.ca
Thu Sep 20 10:29:45 EDT 2001


Claude,

I think this is a bug, but even if it's not a bug then it's worth
looking into.  I have filed it in bugzilla:
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=46

Add your Email address to the CC: in the bug report if you want to be
informed when it's fixed.

And BTW, thanks for the clear description of the problem!
-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.



Claude Philipona wrote:
> 
> Hello,
> We have observed a strange behaviour with the zoomscale method in PHPMpscript
> 3.5.
> If we set the zoomscale with a given scale, we get in return a scale that is not
> set equal to what we gave as parameter. There is always a shift, which appears,
> for a given width and height, to be a constant percentage of the scale. This
> appears anywhere on the map, even very far from the maximum mapextent.
> 
> Is it a bug or a wrong use of the fonction? Actually, we need for our application
> to be able to zoom with a precise scale, to get one to one pixel representation
> of our raster image
> 
> Here is an example of the problem
> 
> we use:
> MapScript Version (Aug 29, 2001)
> MapServer version 3.5 (pre-alpha) OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
> SUPPORTS=PROJ SUPPORTS=TTF SUPPORTS=WMS INPUT=EPPL7 INPUT=JPEG INPUT=OGR
> INPUT=GDAL INPUT=SHAPEFILE
> 
> if we do:
> $Map->zoomscale($scale, $pixelpos,
>                     $width_pix, $height_pix,
>                     $georefext, $georefmaxext);
> 
> with the following values (part of var_dump($Map->scale):
> $scale:
> int(28347)
> 
> $pixelpos:
> ["x"]=> float(281) ["y"]=> float(277)
> 
> $width:
> int(400)
> 
> $height:
> int(400)
> 
> $georefext:
> ["minx"]=> float(556933.36088877) ["miny"]=> float(111233.13134228) ["maxx"]=>
> float(562918.54274843) ["maxy"]=> float(117218.31320194)
> 
> $georefmaxext:
> ["minx"]=> float(479231.75) ["miny"]=> float(65964.67) ["maxx"]=>
> float(847736.75) ["maxy"]=> float(320184.67)
> 
> just after $Map->zoomscale() we get
> 
> $new_scale: 28276.1325
> 
> $new_extent (bbox): 559142.913985  111078.53760395  563132.98830536
> 115068.61192431
> 
> we have a difference between what we asked and what we get of :
> 28347 - 28276.1325 = 70.8675 which is 0.25% (this factor is constant for 400x400
> map at any scale, but it chages with different scale).
> 
> This behaviour doesn't  depend on the initial scale prior to the call of
> zoomscale (in this example, the initial scale was 42414)
> 
> Any idea on what is happening?
> 
> Claude Philipona



More information about the mapserver-users mailing list