[maplab-users] PhpMapScript- setExtent problem - URGENT

Swapan Mazumdar swapan at dataworld.co.za
Thu Jun 24 08:20:21 EDT 2004


Paul,

Thank you for your prompt reply. I used the same calculations suggested
by you but now the map doesn't show even. Pl. look at the output of
$rec->extent attributes below.

$rect = $shpObject->bounds;
$dx = abs(($rect->maxx - $rect->minx) * 0.1); $dy = abs(($rect->maxy -
$rect->miny) * 0.1); echo "BEFORE: $rect->minx, $rect->miny,
$rect->maxx, $rect->maxy"; // BEFORE: -47898.6578075, -3394254.84527,
-47397.1956946, -3393854.31115
$rect->setExtent( $minx - $dx, $miny - $dy, $maxx + $dx, $maxy + $dy );	
echo "AFTER: $rect->minx, $rect->miny, $rect->maxx, $rect->maxy";
AFTER: -50.1462112868, -40.0534118076, 50.1462112868, 40.0534118076
$oMap->setExtent($rect->minx, $rect->miny, $rect->maxx, $rect->maxy);

Hope you might come with some help.
TIA/
\Swapan/

-----Original Message-----
From: Paul Spencer [mailto:pagameba at magma.ca] 
Sent: 24 June 2004 01:47 PM
To: Swapan Mazumdar
Cc: maplab-users at lists.maptools.org
Subject: Re: [maplab-users] PhpMapScript- setExtent problem - URGENT

$dx = abs(($rect->maxx - $rect->minx) * 0.1);
$dy = abs(($rect->maxy - $rect->miny) * 0.1);
$rect->setExtent( $minx - $dx, $miny - $dy, $maxx + $dx, $maxy + $dy );

this should work (untested)

Cheers,

Paul

Swapan Mazumdar wrote:

> I am trying to implement zoom to feature. Infact I can easily do that.

> But the problem is the zoom to (Polygon feature) fits the map extent 
> full and no breathing space is left around it. How can I implement
this. 
> Pl. look at the code:
> 
>  
> 
> $shpObject = $layerObj->getShape(-1, 
> intval($http_form_vars["searchIndex"]));       //returns chape object
> 
> $rect = $shpObject->bounds; //returns enclosing rectangle
> 
> $oMap->setExtent($rect->minx, $rect->miny, $rect->maxx, $rect->maxy);
// 
> HERE I NEED SOME HELP.
> 
>  
> 
> What calculations are needed to zoom out by 10%. Unfortunately map 
> object's nZoomFactor doesn't take values in fractions.
> 
> Your quick pointers will help me a lot, its kindda urgent.
> 
>  
> 
> TIA
> 
> Swapan Mazumdar
> 
> Durban, South Africa
> 
> 
>
------------------------------------------------------------------------
> 
> _______________________________________________
> Maplab-users mailing list
> Maplab-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/maplab-users

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






More information about the Maplab-users mailing list