[mapserver-users] Mapscipt error querying wfs layer

Daniel Morissette dmorissette at mapgears.com
Thu Jul 3 06:10:04 PDT 2014


My first suggestion would be to enable debug and look at the logs for 
possible hints. See http://mapserver.org/optimization/debugging.html

You may also want to remove the "@" in your various function calls when 
debugging to make sure you do not hide error messages that MapScript may 
be reporting.

It's been a while since I touched that code, but it may be that you need 
to $layer->open() before you can read features from the layer.

Daniel


On 14-07-01 11:44 AM, Olivier Bedel wrote:
> 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.
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


-- 
Daniel Morissette
T: +1 418-696-5056 #201
http://www.mapgears.com/
Provider of Professional MapServer Support since 2000


More information about the mapserver-users mailing list