[mapserver-users] RE: QuerybyAttributes examples

Hankley, Chip Chip.Hankley at gasai.com
Thu Oct 10 14:57:40 EDT 2002


...following up on Puneet's suggestions, the way to do the 'zoom to
selected' follows:

remember the issue of base 1 and base 0 row ids...

-------------------------

  $shapeExtObj = $nShpFile->getExtent($row_id);
  $minx = $shapeExtObj->minx;
  $miny = $shapeExtObj->miny;
  $maxx = $shapeExtObj->maxx;
  $maxy = $shapeExtObj->maxy;

  //make the extent to zoom to 
  // a buffer of some value around
  // the extent of the selected
  // objects.
  $border = 10000;

  $minx = $minx - $border;
  $miny = $miny - $border;
  $maxx = $maxx + $border;
  $maxy = $maxy + $border;

  $map->setExtent($minx, $miny, $maxx, $maxy);

-------------------------

Note that if you returned multiple records, you would want to modify the
first part of this so that you would loop through the returned records,
determining the extent of each, and coming up with a summary extent that was
inclusive of all the records.

Chip


-----Original Message-----
From: YC Nyon [mailto:ycnyon at pd.jaring.my]
Sent: Wednesday, October 09, 2002 10:36 PM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] RE: QuerybyAttributes examples


I have a massive business directory in MySQL database. Using PHP, dynamic
queries can be made. What i want to implement is for the user to click "View
Map" button on the results and zoom to the location of the business.
Currently, i have MS-PHP running doing the zoom/pan stuff.

Looking at the documentation, QuerybyAttributes seems to be the method to
use. In Mysql, I can add a column to store the record-id which can be passed
to MS-PHP. Not too sure how to go about it. Can someone share their code
snippets on this function.

TIA
Nyon

   



More information about the mapserver-users mailing list