mapscript - queryByAttributes: Aborted

Sean Gillies sgillies at FRII.COM
Sun Oct 9 08:55:00 PDT 2005


On Oct 9, 2005, at 3:44 AM, Jachym Cepicky wrote:

> Ok, I get this error no more. Anyway, it does not work, how I would
> expect:
>
>     my $layerObj = $mapObj->getLayerByName("landuse");
>     $layerObj->queryByAttributes($mapObj, 'number', '10850', 
> $mapscript::MS_SINGLE);
>     my $resultCacheObj = $layerObj->getResults();
>
>
>     # but there is no $resultCacheObj defined
>
>     print $resultCacheObj,"\n";
>     # Use of uninitialized value in print at ./mapserv2.pl line 70.
>
>
> How to perform the attribute query with mapscript?
>
> Thanks
>
> Jachym
>

Do you have a template set for your layer? See section 2.2 in 
http://zcologia.com/mapserver/querying-howto. This is one of 
mapscript's worst quirks.

The second argument of queryByAttributes becomes a temporary layer 
filteritem, and the third argument becomes a temporary layer filter. 
See

     http://ms.gis.umn.edu/docs/howto/msexpressions/howto_view

If you don't actually have a 'number' item in the layer, then the query 
will fail and getResults() will return NULL.

Sean

--
Sean Gillies
sgillies at frii dot com
http://zcologia.com



More information about the MapServer-users mailing list