Number of Layer Features

Tamas Szekeres szekerest at GMAIL.COM
Thu Apr 12 03:10:15 EDT 2007


In addition one can use the whichShapes, nextShape methods to iterate
the available shapes within a rect.

Or alternatively the Layer.GetFeatureCount in the GDAL/OGR C# API can
also be used.

Best regards,

Tamas


2007/4/12, Delfos, Jacob <Jacob.Delfos at maunsell.com>:
> Fabio,
>
> Be aware that numitems returns the number of attributes, NOT the number of objects. Is that what you meant with "layer features"?
> I don't think there is a way to get the number of objects, unless you do it outside mapserver/mapscript. Only shapefiles can get an object count within mapscript.
> Depending on the circumstances, you *could* do a query, and get the number of results from the query.
>
> Regards,
>
> Jacob
>
>
>
>
> » -----Original Message-----
> » From: UMN MapServer Users List
> » [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Fabio
> » Leme de Almeida
> » Sent: 12 April 2007 02:43
> » To: MAPSERVER-USERS at LISTS.UMN.EDU
> » Subject: Re: [UMN_MAPSERVER-USERS] Number of Layer Features
> »
> » Tamas,
> »
> » I'm using the following:
> »
> » for (int i = 0; i < map.numlayers; i++)
> » {
> »       layerObj Layer = map.getLayer(i);
> »       numFeatures = Layer.numitems;
> » }
> »
> » Like I have said, numFeatures always returns zero.
> » As you can see, I don't call the Layer.Open(); method. At
> » this example, is
> » it necessary ?
> » When execute "layerObj Layer = map.getLayer(i);" the method
> » "Open()" is not
> » internally called ?
> »
> » Thank's again,
> »
> » Fabio
> »
> » Fabio Leme de Almeida
> » GeoJá Mapas Digitais
> » http://www.geoja.com.br
> »
> »
> » -----Original Message-----
> » From: Tamas Szekeres [mailto:szekerest at gmail.com]
> » Sent: quarta-feira, 11 de abril de 2007 14:35
> » To: Fabio Leme de Almeida
> » Cc: MAPSERVER-USERS at lists.umn.edu
> » Subject: Re: [UMN_MAPSERVER-USERS] Number of Layer Features
> »
> » Have you called layerObj.open() ?
> »
> » Best regards,
> »
> » Tamas
> »
> » 2007/4/10, Fabio Leme de Almeida <fabio at geoja.com.br>:
> » >
> » >
> » >
> » >
> » > Hello All,
> » >
> » >
> » >
> » > I'm using PostGres/Posgis.
> » >
> » >
> » >
> » > How can I get the number of features existing at one
> » specific Layer ?
> » >
> » >
> » >
> » > I'm trying to use the attribute layerObj.numitems but it
> » always returns 0
> » > (zero items).
> » >
> » >
> » >
> » > Help-me please !!  ;o)
> » >
> » >
> » >
> » > Thank's,
> » >
> » >
> » >
> » > Fabio
> » >
> » >
> »
>
> This email and any attachments are intended solely for the named recipient and are confidential. The copying or distribution of them or any information they contain by anyone other than the named recipient is prohibited. If you have received this document in error, please notify the sender and delete all copies from your computer system and destroy all hard copies. It is the recipient's responsibility to check this email and any attachments to this email for viruses before use.
>



More information about the mapserver-users mailing list