[mapserver-users] Mapscipt error querying wfs layer

Olivier Bedel o.bedel at alkante.com
Tue Jul 1 08:44:07 PDT 2014


Hi all,

We are using mapserver as a WFS client and we are facing a problem using 
PHP-Mapscript to fetch the results of a queryByShape on the WFS layer.
The count of the results is correct but we cannot get the content of any 
particular results.

Here is what our code looks like :

$oMap = ms_newMapObj($mapfile);
$shpObj = ms_shapeObjFromWkt($shapeStr);
$layer = $oMap->getLayerByName($layerName);
$res = (@$layer->queryByShape($shpObj)==MS_SUCCESS );
if ($res) {
   $count = $layer->getNumResults();
    for ($i=0;$i<$count;$i++) {
       $resObj = @$layer->getResult($i);
       $feat = @$layer->getFeature($resObj->shapeindex, $resObj->tileindex);
       // some computation...
     }
}

the $feat object is equals to "false" and a var_dump of the $resObj 
gives the following :
stdClass Object
(
     [shapeindex] => 0
     [tileindex] => 0
     [classindex] => 0
)

We are using MapServer version 5.6.7.

Has anyone already faced this problem ? Are we doing things wrong or 
could it be a mapscript bug ?
Thanks in advance for any help or advice.

Olivier.



More information about the mapserver-users mailing list