Query Question
Thomas Hammerlund
tom at MAPLINK.JP
Fri Jun 2 04:06:23 PDT 2006
Thank you for your help.
Tom
----- Original Message -----
From: "Tamas Szekeres" <szekerest at gmail.com>
To: "Thomas Hammerlund" <tom at maplink.jp>
Cc: <MAPSERVER-USERS at lists.umn.edu>
Sent: Friday, June 02, 2006 6:09 PM
Subject: Re: [UMN_MAPSERVER-USERS] Query Question
> You may have to open the layer before reading the items.
>
> Best Regards,
>
> Tamas
>
> 2006/6/2, Thomas Hammerlund <tom at maplink.jp>:
>>
>>
>>
>> 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
>
More information about the MapServer-users
mailing list