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

Claude Philipona claude.philipona at camptocamp.com
Sat Sep 15 07:24:53 EDT 2001


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