Personal tools
You are here: Home Documentation References PHP/Mapscript Class Reference Classes ResultCacheMemberObj

4.19. ResultCacheMemberObj

Document Actions
Up one level
Constructor and members.
  • Constant names and class member variable names are case-sensitive in PHP.
  • Several MapScript functions (all those that access files in the back end such as ms_newMapObj(), drawMap(), etc.) will affect the value of the current working directory (CWD) in the PHP environment. This will be fixed eventually but in the meantime you should be careful about these side-effects.
Constructor:

  Instances of ResultCacheMemberObj are always obtained through 
  layerObj's getResult() method.

Members:

  int    shapeindex    (read-only)
  int    tileindex     (read-only)
  int    classindex    (read-only)
by Jeff McKenna last modified 2008-07-15 10:14

how would I use this ?

Posted by John Churchill at 2007-06-13 15:05
I am trying to get at the values in each feature of my shapefile. I have arrived here (at ResultCachMemberObj) using $layer->getResult($i)
and can loop through the result
from ...
(
[shapeindex] => 0
[tileindex] => -1
[classindex] => 0
)
... to [shapeindex] => 222 (the number of records in the shapefile)
Is there any way to extract the value of a field from this or am i stuck ? What is the missing method that I'm not seeing in the API ?

retrieving shapes

Posted by Yahya Mohammad at 2007-06-14 07:12
you need to use the layer's getShape method:
for ($i = 0; $i < $layer->getNumResults(); $i++) {
$result = $layer->getResult($i);
$shape = $layer->getShape($result->tileindex, $result->shapeindex);
print_r($shape->values);
}

Powered by Plone