[mapserver-users] Itemquery in Mapscript(PHP)
Stephen Lime
steve.lime at dnr.state.mn.us
Mon Sep 10 09:32:07 PDT 2001
The "zoom in" feature is specific to the mapserv CGI. You'd have to re-create that
code in PHP to achieve functionality. Remember that with queries a result set is
build and then drawn. During that first step is when shapes are first processed and
their extents can be looked at. With the setup you have below that first step doesn't
happen, that is, the extent is provided (probably in your mapfile) BEFORE the
expressions are even evaluated.
How to fix? Well you can do a true attribute query using the layer FILTER parameter
and the queryByAttribute method or you can use other tools like the various .dbf
modules and interact with the attribute table that way.
Steve
Stephen Lime
Internet Applications Analyst
Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> "Obe, Regina DND\MIS" <Regina.Obe.PFD at ci.boston.ma.us> 09/10/01 07:58AM >>>
I'm trying to simulate the item query functionality that is in mapserve in
PHP mapscript. I followed another example I found on this list serv and
that worked fine except I can't get it to zoom in. It highlights the area
but doesn't zoom in and wondering if this is possible without having to
query a table that has the list of extents for each feature.
This is what my code looks like
$map = ms_newMapObj("bosstreets.map");
$lzone = $map->getlayerbyname("zones"); //get neighborhood layer
$lzone->set("status", MS_ON);
$qclass = $lzone->getClass(0);
$qclass->setexpression("Dorchester");
$acolor = $map->addColor(255,40,250);
$qclass->set("color", $acolor);
$img = $map->draw() or die('Unable to draw map');
$url = $img->saveWebImage(MS_GIF, 0, 0, -1);
This is the portion of my map file that I think is relevant
LAYER
NAME "zones"
DATA Pdnad83_region
STATUS DEFAULT
TYPE POLYGON
CLASSITEM "NAME"
CLASS
NAME "NAME"
OUTLINECOLOR 50 230 0
END
END
(I'm using mapscript for PHP 3.5 (pre-alpha) (Jul 20,2001) on PHP 4.0.6
running on top of IIS)
Thanks. I'm really impressed with Mapscript and the Mapserv CGI exe so far.
Never thought mapping could be this easy.
Regina Obe
Senior Programmer
Department Of Neighborhood Development
City of Boston
More information about the MapServer-users
mailing list