[mapserver-users] queryUsingPoint seg fault on demo maps

Daniel Morissette morissette at dmsolutions.ca
Wed Aug 8 12:55:29 EDT 2001


Jim Burnett wrote:
> 
> OK, Now I downgraded to php-4.0.5 also.

Going back to PHP 4.0.5 was not necessary since you're using Mapscript
3.5... the message you get is not a bug... it's a normal error message
saying that nothing was found.


> I still get
> Warning: MapServer Error in msQueryByPoint(): No matching record(s) found.
> in /drives/storage1/homes/htdocs/maptest/php/test.php on line 71
> 
> I can not seem to pull any data from the ms_demo data files.
> Here is my code and map file.
> 
> Zooming, and Panning work fine, just cant query for some reason. What am I
> missing?
> 
> $mapObj = ms_newMapObj("/home/htdocs/maptest/romney.map");
>  $ptClicked = ms_newPointObj();
>  $ptClicked->setXY($x,$y);
>  $queryObj = $mapObj->queryByPoint( $ptClicked,MS_MULTIPLE,-1 );
> 

Are $x and $y in pixel coordinates?

The query functions expect the search location in map coordinates...
here's an example of code that should (hopefully ;) convert from pixel
to map coordinates:

 $pix_x = ...; // click location in pixel units
 $pix_y = ...; 
 $mapext = $mapObj->extent;
 $w = $mapObj->width;
 $h = $mapObj->height;
 $georef_x = $mapext->minx + ($pix_x/$w)*($mapext->maxx-$mapext->minx);
 $georef_y = $mapext->maxy - ($pix_y/$h)*($mapext->maxy-$mapext->miny);

-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.




More information about the mapserver-users mailing list