perl shapeobj values

Lowell Filak lfilak at MEDINACO.ORG
Fri Jun 3 11:42:38 PDT 2005


The following message was sent by Simpson <asimpson at I-55.COM> on Fri, 3
Jun 2005 13:38:16 -0500.

> OK, I'll use the method Eric so kindly posted.
> 
> It would be nice to get at the column names from the shapeObj and be
able to
> getValue() by index or by column name.
> 
> Thanks for the info,
> Drew.
> 
> -----Original Message-----
> From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
> Behalf Of Lowell Filak
> Sent: Friday, June 03, 2005 1:02 PM
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-USERS] perl shapeobj values
> 
> 
> The following message was sent by Simpson <asimpson at I-55.COM> on Fri, 3
> Jun 2005 12:42:48 -0500.
> 
> > It looks like its of data type 'character' in the documentation at
> > http://mapserver.gis.umn.edu/doc40/perlmapscript-reference.html and at
> > http://mapserver.gis.umn.edu/doc44/swigmapscript-reference.html
> >
> > Is the shapeObj->{values} in Perl not the same as the one in PHP?
> >
> > Thanks,
> > Drew.
> >
> >
> > -----Original Message-----
> > From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
> > Behalf Of Simpson
> > Sent: Friday, June 03, 2005 9:36 AM
> > To: MAPSERVER-USERS at LISTS.UMN.EDU
> > Subject: Re: [UMN_MAPSERVER-USERS] perl shapeobj values
> >
> >
> > 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

Drew,

You can still do that by including the XBase module.

HTH

Lowell



More information about the MapServer-users mailing list