[mapserver-users] Mapscript php5 zoomtopoint() Mapserver 6.0.1
Paul Maddock
Paul.Maddock at ijus.net
Wed Mar 21 14:33:15 PDT 2012
Dear all,
I am currently stuck in a rut when trying to make a php mapscript that makes it possible to zoom into a map multiple times. I have it so that when the user clicks on the image it sends to my php script a set of coordinates based on where an <img> is clicked using the ismap attribute. The href is self referencing and reopens the same .php document the tags are in. Now my problem comes in where once I've zoomed in once by a factor of 2, the next time the user clicks on the image and zoomtopoint()is called again, it is still referencing the same extent it did for the first call to zoomtopoint(). How do I carry over the values from the extent generated after the first zoom to any zoomtopoint() call from there on out.
Here is my mapscript:
<?php
$map_path="/usr/lib/cgi-bin/";
$map = ms_newMapObj($map_path."blah_test.map");
if (count($_GET)) {
$map_path="/usr/lib/cgi-bin/";
$map = ms_newMapObj($map_path."blah_test.map");
$map_height=$map->height;
$map_width=$map->width;
$map_extent=$map->extent;
$x1=$map_extent->minx;
$y1=$map_extent->miny;
$x2=$map_extent->maxx;
$y2=$map_extent->maxy;
$e= array($x1, $y1, $x2, $y2);
print_r($e);
$coords = array_keys($_GET);
$coords = explode(',', $coords[0]);
$x = $coords[0];
$y = $coords[1];
$zoom_point=new pointObj();
$zoom_point->setXY($x,$y);
$zoomFactor=2; //set zoomFactor to positive or negative depending on the user's input via button
$map_extent=$map->extent;
$map->zoompoint($zoomFactor,$zoom_point,$map_width,$map_height,$map_extent);
$map_extent=$map->extent;
$x1=$map_extent->minx;
$y1=$map_extent->miny;
$x2=$map_extent->maxx;
$y2=$map_extent->maxy;
$e= array($x1, $y1, $x2, $y2);
print_r($e);
}
$image=$map->draw();
$image_url=$image->saveWebImage();
?>
Here is the image tag:
<div id="map">
<a href="blahtest.php" name="img"> // here is the self referencing href
<img type="image" name="img" id="map" ismap="ismap" type="image" src=<?php echo $image_url; ?> width="<?php echo $map_width; ?>" height="<?php echo $map_height; ?> "border=0 alt="Map Image">
</a>
</div>
Any help is appreciated!
-Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120321/07006cce/attachment.htm>
More information about the MapServer-users
mailing list