[Mapserver-users] query

Eric Bridger eric at gomoos.org
Mon Mar 10 04:29:58 EST 2003


The point you create for queryByPoint() must be in map coordinates, not
image coordinates:
$mappointq->setXY($map->width / 2,$map->height / 2); 
is using pixels, not decimal degrees.  

I'm not sure where to find a PHP example, but there is an excellent Perl
mapscript example mapquakes.pl here:
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PerlMapScriptExamples35ex2

see the set_extent() function.


On Sat, 2003-03-08 at 03:10, Srinivas Reddy wrote:
 
> 
> for the above layer i written this code for geting the result
> if ( isset($map_x) && isset($map_y) && strcmp($zoomdir, "QUERY_POINT") ==
> 0 )
> {
>  echo "your at the query entery point just enter<br>";
> 
>  for ($ilayer=0; $ilayer<=$map->numlayers; $ilayer++)
>  {
>    $selLayer = $map->GetLayer($ilayer);
>   // Pointing the map point to where the user clicked
>    $mappointq = ms_newpointObj();
>   $mappointq->setXY($map_x,$map_y);
>    echo $map_x. "<br>" . $map_y;
>    //$selLayer->{template} = "bogus.html";
> 
>    $mappointq->setXY($map->width / 2,$map->height / 2);
> 
>    $queryResult = $selLayer->queryByPoint($mappointq, MS_MULTIPLE, -1);
>    // here i am geting this error message " PHP Warning:  MapServer Error in
> msQueryByPoint(): No matching record(s) found"
>  echo $queryResult;
> }
> }
 




More information about the mapserver-users mailing list