[Mapserver-users] PHP/MapScript question: How to return values when map is clicked?

Krung Saengpole krung at cad.go.th
Sat Sep 13 17:56:44 EDT 2003


I'm not sure with getLayerByName.  Try quote name in map file. eg.
LAYER
  NAME "state"
  ....

getLayer() take parameter as
$layer=$myMap->getLayer(layer_index);

Your warning stated that it couldn't find the point you clicked. You can avoid this message by prefixing the function with '@' (PHP aspect) as
@$myMap->queryByPoint(...);

What is your layer's type in map file?  It should be POLYGON if you want to click inside its boundary.

HTH
Krung.
---------- Original Message ----------------------------------
From: har mar <shaz_bot42 at yahoo.com>
Date:  Fri, 12 Sep 2003 06:46:37 -0700 (PDT)

>Thanks, that and the examples linked to helped.  However, I am running into an error wen I use getLayer or getLayerByName.  If I use getLayerByName it tells me it failed (getLayerByName failed for : state)
> 
>I have checked my .map file, and in my .map fil it is indeed called state
> 
>LAYER
>  NAME state
> 
>However if I use $layer = $myMap->getLayer, I get the following error
> 
>Warning: [MapServer Error]: msQueryByPoint(): No matching record(s) found.
> 
>Yet I clicked in a state, so I would assume it would have to return the statename (and everything else in the dbf file) to me.  
> 
>I wonder what is going on.  
> 
>Thankyou
> 
>Har
>





More information about the mapserver-users mailing list