You may have to open the layer before reading the items.
Best Regards,
Tamas
2006/6/2, Thomas Hammerlund <[EMAIL PROTECTED]>:
Hi, I'm trying to query a layer via mapscript but I can't get a count above
0 for numitems on the layer object or numvalues off the feature object. Is
there a mapfile configuration or mapscript method i'm missing?
Thank you,
Tom
mapscript code : -------------------------------------
my $map = new mapscript::mapObj($mfpath);
my $lobj = $map->getLayerByName($lyr);
my $ret = $lobj->queryByRect($map,$robj);
my $numRec = $lobj->getNumResults();
my $results = $lobj->getResults();
for($i=0;$i<$numRec;$i++){
$result = $results->getResult($i);
$feature = $lobj->getFeature( $result->{shapeindex} , $result->{tileindex}
);
# #$att1 = $feature->getValue( 1 );
# #$att2 = $feature->getValue( 2 );
print $lobj->{numitems} . " " . $result->{shapeindex} . " " .
$result->{tileindex} . " " .$feature->{numvalues} ." <br>";
output:
----------------------------------------------------
0 4443 -1 0
0 4446 -1 0
0 4452 -1 0
0 4455 -1 0
0 4471 -1 0
0 4472 -1 0
0 4477 -1 0
0 4479 -1 0
0 4483 -1 0
MAPFILE --------------------------------------
LAYER
NAME m_stores
TEMPLATE "http://192.168.10.33/php/qtemp.html"
TYPE QUERY
DATA bgshp/m_store_4612
END