perl shapeobj values

Simpson asimpson at I-55.COM
Fri Jun 3 07:36:22 PDT 2005


There is a shapeObj 'values' attribute in documentation at
http://mapserver.gis.umn.edu/doc44/phpmapscript-class-guide.html#ShapeObj

Drew.

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
Behalf Of Eric Bridger
Sent: Friday, June 03, 2005 6:10 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] perl shapeobj values


No ''values' attribute of a shapeObj is exposed in the SWIG Mapscript API.
Just numvalues and the getValue method.

See: http://zcologia.com/mapserver/mapscript#shapeobj

At 04:11 AM 06/03/2005 -0500, Simpson wrote:
>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