[Mapserver-users] Zoom to Selected Feature
woodbri at swoodbridge.com
woodbri at swoodbridge.com
Fri Mar 28 19:11:57 PST 2003
Patrick,
Here is how I do it when I generate a route and want to zoom to the
extents of the route. You check it out at
http://imaptools.com/demos1/?tab=2
Here is my PHP code:
$router = ms_newShapefileObj($shapefile, -1);
$ext = $router->bounds;
/* increase bounds by 5%, do the math */
$rminx = 1.025*$ext->minx - 0.025*$ext->maxx;
$rmaxx = 1.025*$ext->maxx - 0.025*$ext->minx;
$rminy = 1.025*$ext->miny - 0.025*$ext->maxy;
$rmaxy = 1.025*$ext->maxy - 0.025*$ext->miny;
$map->setExtent($rminx, $rminy, $rmaxx, $rmaxy);
$router->free();
-Steve
On 28 Mar 2003 at 21:23, Patrick Rouse wrote:
> I've scoured the archives and seen this question asked before, but I
> didn't seem to see any clear cut answers, so here it goes again. I
> have a layer of weather stations and I would like to allow the user to
> input an ID and have the map zoom to that point. It would be similar
> to Steve Lime's 'find' tool on the MDNR browser, but would not launch
> a popup with one or many hyper link query results, it would
> automatically zoom to the point. I am sure this can be done, so I
> guess my real question is having one can assist with some sample code.
>
> Thank you
>
> Patrick Rouse
> Senior GIS Analyst
> The Weather Channel
>
>
More information about the MapServer-users
mailing list