QueryByPoint in php mapscript - 0 results
Didrik Pinte
dpinte at ITAE.BE
Wed Oct 17 00:14:30 PDT 2007
On Tue, 2007-10-16 at 12:31 -0700, cool frenz wrote:
> Hi,
> I am trying to perform querybypoint but have been unable to get any
> result.
> The procedure that i am following:
> 1) Get clicked pixel points.
> 2) convert to georef coordinates. (Got them correct)
> 3) Querying the layer with this point.
> 4) Checking for results : Found none
>
> Code Snippet:
> $mypoint =ms_newPointObj();
> $mypoint->setXY(17.94031626 , 79.29237528); // To check i directly
> put a point though i tried with clicked point as well
> $check=@$map->queryByPoint($mypoint,MS_MULTIPLE, 20);
> $layer1=$map->getlayerbyname("cotton");
> if( $check == MS_SUCCESS)
> {
> $count_results = $layer1->getNumResults();
> print "NO = ".$count_results." ";
> }
> Earlier i wasnt using any template then i used a dummy template
> (completely blank) to make it work but still it gave no result.
>
> Please let me know where i am mistaken ?
Hi Piyush,
Some hints to debug the problem.
Have you tested by querying the layer directly and not the all map ?
$layer1 = $map->getlayerbyname("cotton");
$check = $layer1->queryByPoint($mypoint,MS_MULTIPLE, 20);
What about the toleranceunits of the layer ?
$layer1->set("toleranceunits",MS_METERS);
Remove the @ so that you does not hide errors coming from the queryByPoint method.
Are you sure they are some points under your fake click ?
Here is a link with a working example : http://www.itae.be/gis/querying-dynamic-point-layer-with-php-mapscript.html
--
Didrik <dpinte at itae.be>
Information Technologies for the Agro-Environment
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20071017/fd6fd0c5/attachment.sig>
More information about the MapServer-users
mailing list