queryByRect

Daniel Morissette dmorissette at DMSOLUTIONS.CA
Thu Oct 28 15:33:52 EDT 2004


N Zhou wrote:
>
>  $ms = ms_newMapObj($map);
>  $aRect = ms_newRectObj();
>  $aRect->setextent(minx, miny, maxx, maxy);//the extent of georeference
>  $selectLayer = $ms->getLayerByName(layer_name);
>  $q_success = $selectLayer->queryByRect($aRect);
>   if ($q_success == MS_SUCCESS) {
>      $numResult = $selectedLayer->getNumResults();
>      $results = $selectLayer->getResult(0);//get the first query result
>   }
>
> The queryByRect is success. But I got an error message of the
> getNumResults():
>
>    Fatal error: Call to a member function on a non-object in myscript.php
> on line 26
>

The error tells you that $selectedLayer is not an object and you cannot
call a method on it... that's because the $selectedLayer variable is not
set... it's a typo, it should be $selectLayer.

--
------------------------------------------------------------
  Daniel Morissette               dmorissette at dmsolutions.ca
  DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------



More information about the mapserver-users mailing list