Number of records

Lowell Filak lfilak at MEDINACO.ORG
Thu May 12 05:02:18 PDT 2005


The following message was sent by Johan Hallgren
<johan.e.hallgren at WMDATA.SE> on Thu, 12 May 2005 05:43:56 -0500.

> How can I return the total number och records in a layer.
>
> I have the following lines in my code and I want to go throu all records
> in the layer. How can I get the number of records so I can bild my for
> (...) loop.
>
> mapObj m_obj = new mapObj(m_StrMapFile);
> layerObj oLayerObj = m_obj.getLayerByName(strName);
>
> I have tryed the following but I think it's waste of resources
> oLayerObj.queryByRect(m_obj, oLayerObj.getExtent());
> resultCacheObj oResultCacheObj = oLayerObj.getResults();
> oLayerObj.open();
> if (oResultCacheObj.numresults > 0)
> {}
>
> Any proposals?

Johan,

shapefileObj->{numshapes} will also return the number of records if the
layer is based on a shapefile.

HTH

Lowell



More information about the MapServer-users mailing list