[Mapserver-users] mapscript - queryByPoint help, simple Q

Eric Bridger eric at gomoos.org
Thu Aug 28 09:32:46 EDT 2003


$layerObj = @$map->queryByPoint ($ptClicked, ms_single, 1000);

The above is wrong. That sets $layerObj to MS_SUCCESS, but you still
need the LayerObject for:
$results = $layerObject->{results};
etc.

On Thu, 2003-08-28 at 16:28, jose.quintal at cfe.gob.mx wrote:
> 
> I follow without being able to make the Querybypoint to layer dynamic
> I have inside  the loop
>  if($layerObj->addFeature($shp) == -1)
>  { echo  "addFeature failed";
>   }
> is this the loop
> 
> while($reg=mysql_fetch_array($p))
> {
>      $a=$reg['id'];
>      $b=$reg['cor_x'];
>      $c=$reg['cor_y'];
> 
>      //set the X Y values of the point object
> 
>      $pointObj->setXY($b,$c);
>      $line = ms_newLineObj();
>      $line ->add($pointObj);
>      $shp = ms_newShapeObj(MS_SHAPE_POINT);
>      $shp->add($line);
>      //$shp->setBounds();
>      $shp->{text} = $a;
>      $shp->{index} = $i;
>      if($layerObj->addFeature($shp) == -1){
>              echo  "addFeature failed";
>          }
>      $point_lookup[$i] = $a;
>      $i++;
> 
>      $pointObj->draw($map, $layerObj, $image, 0, $a);
>  }
> 
> 
> 
>  and the Querybypoint asi I put it:
> $layerObj = @$map->queryByPoint ($ptClicked, ms_single, 1000); It returns
> perfect MS_SUCCESS,
>  but
> //     this is an index into the point lookup table.
>      $record = $rslt->{shapeindex};
> 
>  It returns to me -1
> 
> Why?
> 
> 
> José Antonio Quintal Castillo
> Sistemas
> Tel 9243128  O  9243136
> 
 





More information about the mapserver-users mailing list