QueryByRect problem in PHPmapscript
Bill Thoen
bthoen at GISNET.COM
Wed Oct 31 12:58:14 PDT 2007
I'm trying to understand how to do querying via PHP mapscript, and I
don't understand the results I'm getting. Basically I'm querying a
polygon layer of US States with a rectangle that intersects 8 states in
the upper midwest. It fully encloses two of these. The following script
seems to find only one result and it says the shapeindex is 42. Now I
know this is the answer to the meaning of life, the universe and
everything, but how do I use this to get a list of the state names that
were found (and why is it only returning 1 found?)
What I want to do eventually is display these states on the map in a
highlighting color to show they were selected. If I'm going about this
all wrong, could somebody clue me in?
$rect = ms_newRectObj();
$rect->setextent(-50000, -50000, 50000, 50000);
$lyr = $map->getLayer(1); // states layer
$results = $lyr->queryByRect($rect);
if ($results == MS_FAILURE) {
echo "Nothing found.<br />";
} else {
echo "Found " . $lyr->getNumResults()."<br />";
for ($i=0; $i<$lyr->getNumResults(); $i++) {
$rcache = $lyr->getResult($i);
echo " shapeindex: ".$rcache->shapeindex;
}
}
$rect->free();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20071031/c3756a78/attachment.htm>
More information about the MapServer-users
mailing list