Opened 23 years ago

Closed 23 years ago

Last modified 23 years ago

#46 closed defect (fixed)

PHP MapScript - ZoomScale() error

Reported by: dmorissette Owned by: assefa
Priority: high Milestone:
Component: MapScript-PHP Version: 3.5
Severity: normal Keywords:
Cc: claude.philipona@…

Description

Subject:        [mapserver-users] strange behaviour of zoomscale() in 
phpmapscript
   Date:        Sat, 15 Sep 2001 13:24:53 +0200
   From:        "Claude Philipona" <claude.philipona@camptocamp.com>
     To:        <mapserver-users@lists.gis.umn.edu>

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

Change History (3)

comment:1 by claude.philipona@…, 23 years ago

Cc: claude.philipona@… added
op_sys: Windows 98Linux

comment:2 by assefa, 23 years ago

Resolution: fixed
Status: newclosed
Correct in function GetDeltaExtentsUsingScale in php_mapscript.c (was not in 
sync with msCalculateScale (mapscale.c) ).

Claude, could you please give it a try with the new version. Thanks,

comment:3 by claude.philipona@…, 23 years ago

The bug seems to be solved. It returns the same scale that we are asking, no 
error. Thanks for the quick fix.
Note: See TracTickets for help on using tickets.