[mapserver-users] scale with PHP

Daniel Morissette morissette at dmsolutions.ca
Fri Jun 28 11:14:53 EDT 2002


Guillaume Sueur wrote:
> 
> Are you sure it works for the full extent scale ? I had to write a little
> function to get the scale because at full extent of the map, thereturned
> scale by mapscript was -1. It was Ok for other extents. Strange no ?
> 

Manuel Marichal Pérez wrote:
> 
>         I have installed Mapserver 3.6.0 and 3.6.1. In both of them, the "scale"
>         member of a MapObj object in PHP/MapScript is always -1  :(
> 


Maybe I should have mentioned that the scale is not computed by
MapServer and MapScript until you call one of $map->draw(),
$map->prepareImage(), $map->prepareQuery() or $map->setExtent().  

So an easy way to force calculation of the scale at full extent is to do
this:

  $map = ms_newMapObj(...);
  $map->setExtent($map->extent->minx, $map->extent->miny,
                  $map->extent->maxx, $map->extent->maxy);
  echo "Map Scale is ".$map->scale;

-- 
------------------------------------------------------------
 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.



More information about the mapserver-users mailing list