<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7653.38">
<TITLE>Problem with spatial query</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">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. </FONT></P>
<P><FONT SIZE=2 FACE="Arial">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.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">I've pasted some code below. Does anyone have any suggestions?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Thanks,</FONT>
<BR><FONT SIZE=2 FACE="Arial">Bob</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">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:</FONT></P>
<BR>
<P><FONT SIZE=2 FACE="Arial">$zoneLayer = $oMap->getLayer(3); //Layer 3 is the zoning data</FONT>
<BR><FONT SIZE=2 FACE="Arial">$oMap->preparequery();</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">$results = @$oMap->queryByShape($oShape); //$oShape is the parcel that was selected earlier in the php file</FONT></P>
<P><FONT SIZE=2 FACE="Arial">if ($results == MS_SUCCESS){</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $r = $zoneLayer->getNumResults();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> for ($d=0; $d<$r; $d++) {</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $zoneLayer->open();</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $result = $zoneLayer->getResult(0);</FONT>
<BR><FONT SIZE=2 FACE="Arial"> echo $r . " results found<br>";</FONT>
<BR><FONT SIZE=2 FACE="Arial"> </FONT>
<BR><FONT SIZE=2 FACE="Arial"> $shape = $zoneLayer->getFeature($result->shapeIndex, $result->tileindex);</FONT>
<BR><FONT SIZE=2 FACE="Arial"> foreach ($shape->values as $key => $value) {</FONT>
<BR><FONT SIZE=2 FACE="Arial"> echo $key. " = " .$value . "index =" .$result->shapeIndex . "<br>";</FONT>
<BR><FONT SIZE=2 FACE="Arial"> }</FONT>
<BR><FONT SIZE=2 FACE="Arial"> }</FONT>
</P>
</BODY>
</HTML>