[Mapserver-dev] layerObj resultcache?
Daniel Morissette
dmorissette at dmsolutions.ca
Mon Apr 12 14:06:10 EDT 2004
Howard Butler wrote:
>
> The problem right now with the new changes is that SDE for Coverages is
> causing all kinds of breakage because it looks like a duck but barks
> like a dog. I am changing some of the calls that I make with the new
> code to be sensitive to SDE for Coverages and work around it, but when I
> updated to the newest mapscript Friday, all of my mapscript test code
> broke. I rolled back to pre-change SDE code and am still getting the
> same errors in my test code, so I suspect that something has changed.
>
> Sean's latest mapscript docs
> <http://users.frii.com/sgillies/projects/mapscript/mapscript.html> say
> nothing about resultcache or resultcache object any more, and that is
> where my code is hanging (query the layer for an attribute and set the
> map extent to the bounds of the resultcache).
>
Looking at the current implementation of the SWIG MapScript getResult(),
I see that it returns NULL when you get to the last result. So it would
be safe to do something like the following (in PHP syntax) to get your
code to work:
for($i=0; $i<$map->numlayers;$i++)
{
$layer = $map->getLayer($i);
$resultId = 0;
$result = $layer->getResult($resultId);
while($result != null)
{
// Do something with the results...
...
// Look for next result...
$resultId++;
$result = $layer->getResult($resultId);
}
}
I think the nest would still be to add a $layer->getNumResults() call
like we have in PHP MapScript. Then you would be able to tell the
number of results before you start iterating.
Actually, I think I'll add getNumResults() to mapscript.i now.
Daniel
--
------------------------------------------------------------
Daniel Morissette dmorissette at dmsolutions.ca
DM Solutions Group http://www.dmsolutions.ca/
------------------------------------------------------------
More information about the mapserver-dev
mailing list