React on query error

Stefan Schwarzer stefan.schwarzer at GRID.UNEP.CH
Wed May 17 07:38:55 PDT 2006


>> Hi, my application offers the possibility to preselect countries  
>> that  should be displayed on the map. Thus, instead of having all   
>> countries, I get only these preselected ones mapped; the others  
>> are  grayed out. But if a user now uses the query tool and clicks  
>> on one  of those not-preselected countries, than an mapscript  
>> error occurs  (naturally). Is there a way to react on such an  
>> error warning and  continue at another point, so that this  
>> "problem" is just ignored and  the application can continue to  
>> work? 		if (!$imgbox)
>> 			$map -> queryByPoint($click_pt, MS_MULTIPLE, -1); // here is  
>> then  the error
>> 		else
>> 			$map -> queryByRect($click_rt); "Warning: [MapServer Error]:  
>> msQueryByPoint(): No matching record(s)  found. in /www/ 
>> geodataportal/htdocs/mod_map/etc/php/query.php on line  42" Thanks  
>> for any help!
>
> Stefan,
> Being that is just a warning message you should be able to set a  
> variable to the result of the queryByPoint and then test for  
> MS_SUCCESS or MS_FAILURE and react accordingly.
> Lowell

Thanks for that. I did it now the following way:

		//Query the Map at the point clicked
		if (!$imgbox)
			@ $a = $map -> queryByPoint($click_pt, MS_MULTIPLE, -1);
		else
			@ $a = $map -> queryByRect($click_rt);
		
		if ($a == MS_SUCCESS)
		{
			xxxx
		}



More information about the MapServer-users mailing list