Number of records

Johan Hallgren johan.e.hallgren at WMDATA.SE
Thu May 12 03:43:56 PDT 2005


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?

Regards
Johan



More information about the MapServer-users mailing list