[ka-Map-users] Problem with spatial query
Bistrais, Bob
Bob.Bistrais at maine.gov
Mon Feb 9 17:47:46 EST 2009
I've been customizing some of the Ka-Map Search code. These are
modifications of the kaSearch .php and .js. I have a tool that allows a
user to enter a parcel number into a text box, and zoom to that parcel
automatically. That part of the process works. I can get the extent of
the selected parcel and the map will zoom to it.
Here's where I'm having trouble- now that I have the extent of the
desired parcel, I would like to automatically run a query a zoning
layer, and return the zoning polygons that the selected parcel
intersects. I tried Query by Point, Rectangle, and Shape, I'm sure the
coordinates area valid, but when I run the tool, it returns zone
polygons from an area far away from where I am querying. It doesn't
even seem to matter what parcel I use for input- it always returns the
same zoning polygons. As a matter of fact, it looks as though it's
returning results for the same poly, over and over again. In any case,
it's definitely far from the selected parcel polygon.
I've pasted some code below. Does anyone have any suggestions?
Thanks,
Bob
This code is part of my kaSearchParcel.php, which selects a parcel and
zooms to it. The code below is the query that tries to return the
intersecting zoning polygons:
$zoneLayer = $oMap->getLayer(3);
//Layer 3 is the zoning data
$oMap->preparequery();
$results = @$oMap->queryByShape($oShape); //$oShape is
the parcel that was selected earlier in the php file
if ($results == MS_SUCCESS){
$r = $zoneLayer->getNumResults();
for ($d=0; $d<$r; $d++) {
$zoneLayer->open();
$result = $zoneLayer->getResult(0);
echo $r . " results found<br>";
$shape = $zoneLayer->getFeature($result->shapeIndex,
$result->tileindex);
foreach ($shape->values as $key => $value) {
echo $key. " = " .$value . "index =" .$result->shapeIndex .
"<br>";
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20090209/c870e0ab/attachment.htm
More information about the ka-Map-users
mailing list