[mapserver-users] ---> Creating a new map-extent of a queried point fails <---
Azimuth, Erwin Perik
perik at azimuth.nl
Tue Dec 18 01:47:49 PST 2001
Hi All,
I seem to have a problem zooming to a queryd point. Getting the object is
not a problem, but cannot create a new map-extent so the object is zoomed in.
Getting the extents of the queryd object (point) produces 2 identical
coords. I create a box around that point and set the extents to that 'box'.
Queryd Layer is OFF by default, but switching that ON later. Not the problem.
Any one a idea? Totally stuck. Have used it before on a polygon-shape
without any problems, but doing this for a point is not working.
It produces a circle (from class) in the center of the new created map.
Below i have a description of how i have it set up. I use MS3.5 and PHP
(Win98).
Thanks in advance,
Erwin
********************************
MAIN ROUTINE (snippit):
********************************
GLOBAL $gpoMap;
GLOBAL $value;
// Search for shapeobject, using a distance of eg. 50 to create a box
around the found extent
// As the object is a point the extent consists of 2 identical coordinates.
// That's why i make a box around the 'point' using:
BoxAroundPoint("C:\phpdev\www\aweb\imagemap\data\city", $value -1, 50);
$img = $gpoMap->Draw();
$url = $img->saveWebImage($img, 0, 0, -1);
echo"<INPUT TYPE=image SRC=$url BORDER=0 WIDTH=600 HEIGHT=450 NAME=zoommap>";
// Create new extent using givven distance
function BoxAroundPoint($shpFileName, $shpIndex, $distance )
{
global $gpoMap;
$shapeFileObj = ms_newShapeFileObj($shpFileName, -1 );
// ** getting extent
$shapeExtObj = $shapeFileObj->getExtent( $shpIndex );
// ** new extent using 'distance'
$minx = ( $shapeExtObj->minx ) - $distance;
$miny = ( $shapeExtObj->miny ) - $distance;
$maxx = ( $shapeExtObj->maxx ) + $distance;
$maxy = ( $shapeExtObj->maxy ) + $distance;
// ** seting the new extents of the map object
$gpoMap->SetExtent( $minx, $miny, $maxx, $maxy );
}
********************************
MAP-LAYER:
********************************
LAYER
NAME 'city-search' # for searching city
TYPE POINT
DATA city
STATUS OFF
CLASS
NAME 'mykey'
SYMBOL "circle"
SIZE 12
END
CLASSITEM "mykey" # Namas item from dbase file
END
More information about the MapServer-users
mailing list