Obtaining attribute names

Eric Bridger eric at GOMOOS.ORG
Tue Oct 4 05:59:13 PDT 2005


On Sat, 2005-10-01 at 15:38, Erik Konijnenburg wrote:
> Is it possible to obtain the attribute names from a shapeObj returned by
> the layer->getShape. I am able to obtain the attribute values but I want
> the attribute names. Is there a solution?

I think you need to use layer->getItem(int i)
E.g. in a query context:

$qshape = $layer->getFeature($qid, $tid);
for($i = 0; $i < $qshape->{numvalues}; $i++)
{
  $val = $qshape->getValue($i);
  $name =  $layer->getItem($i);
}

See also:
http://zcologia.com/mapserver/querying-howto#resulting-features



More information about the MapServer-users mailing list