queryByPoint on a Postgis layer...

Julien-Samuel Lacroix jlacroix at DMSOLUTIONS.CA
Thu Jun 16 07:28:46 PDT 2005


Hi,

Is your layer queryable? To do so, it should be "STATUS ON" and have a 
template (TEMPLATE "dummy"). You can also set the tolerance to accept 
clicks that are a little beside the point you tried to click. For more 
information about those parameters, check the mapfile documentation:

http://mapserver.gis.umn.edu/doc44/mapfile-reference.html#layer

You can also check the gmap demo if you need an example.
http://dl.maptools.org/dl/gmap-ms40.tar.gz

Julien

On 06/16/2005 04:29 AM, Philippe Gondek wrote:
> Hi list,
> 
> I have a problem. I want to use the function queryByPoint in Mapscript
> to know the item I clicked.
> 
> 	      	$qx = $HTTP_POST_VARS["mapa_x"];
> 		$qy = $HTTP_POST_VARS["mapa_y"];
> 		$point = ms_newpointOBj();
> 		$point->setXY($qx, $qy);
> 		$layerq = $map->getLayerByName("communes");
> 		$data = $layerq->queryByPoint($point, MS_SINGLE, -1);
> 
>        >>>>>>>>>> I have no result... maybe I must do the connection
> to Postgis by myself... any suggestions???
> 
> 		echo nl2br("\n data : $datadata_val");
> 		$result = $layerq->getResult(0);
> 		echo nl2br("\n result : $result");
> 		$layerq->open();
> 		$items = $layerq->getitems();
> 		echo nl2br("\n items : $items");
> 		$shape =$layerq->getShape($result->tileindex, $result->shapeindex);
> 		$layerq->close();
> 		$data_val = $shape->values;
> 		echo nl2br("\n data_val : $data_val");
> 
> Thanks and have a nice day...
> 
> Philippe
> 
> 

-- 
------------------------------------------------------------
Julien-Samuel Lacroix            jlacroix at dmsolutions.ca
DM Solutions Group               http://www.dmsolutions.ca/
------------------------------------------------------------



More information about the MapServer-users mailing list