perl shapeobj values
Simpson
asimpson at I-55.COM
Fri Jun 3 02:11:08 PDT 2005
Thanks, this very nice example will get the job done.
Out of curiosity, how would one use the 'values' attribute of shapeObj.
I saw lots of PHP examples like $shape->values["Population"].
Dumper($shape->{values}) was giving me something cryptic like "\bless( do
{...},'_p2p_..')".
The server for this project has Mapserver 4.01 and the layers are from SDE.
Thanks again,
Drew.
-----Original Message-----
From: Eric Bridger [mailto:eric at gomoos.org]
Sent: Thursday, June 02, 2005 9:25 PM
To: Simpson; MAPSERVER-USERS at lists.umn.edu
Subject: Re: [UMN_MAPSERVER-USERS] perl shapeobj values
At 07:51 PM 06/02/2005 -0500, Simpson wrote:
>Hello,
>
>Could someone please tell me how to use the values attribute of shapeObj in
>Perl.
>I saw lots of examples in PHP, but no Perls.
>
>Thanks,
>Drew.
Here's some perl code.
if ( !$layerObj->queryByPoint( $map, $click, $mapscript::MS_MULTIPLE, 0 ) )
{
my $rslts = $layerObj->getResults();
if ($rslts)
{
for (my $i = 0; $i < $rslts->{numresults}; $i++)
{
my $rslt = $layerObj->getResult($i);
my $qid = undef;
$qid = $rslt->{shapeindex};
my $tid = $rslt->{tileindex};
$layerObj->open();
my $qshape = $layerObj->getFeature($qid, $tid);
if($qshape)
{
for(my $i = 0; $i < $qshape->{numvalues}; $i++)
{
my $val = $qshape->getValue($i);
my $col = $layerObj->getItem($i);
# do something with them.
}
}
$layerObj->close();
}# end for results
}
} # end if queryByPoint
See also: http://zcologia.com/mapserver/querying-howto
More information about the MapServer-users
mailing list