Sorry don't know that :-(<br><br>On Thu, Nov 6, 2008 at 2:32 PM, Jochen Wagner <<a href="mailto:jochen.wagner8@googlemail.com">jochen.wagner8@googlemail.com</a>> wrote:<br>> thanks, works fine and fast for each layer:<br>
><br>> $layer->open();<br>> $myitems = $layer->getItems();<br>><br>> foreach($myitems as $item) {<br>> echo $item."<br>";<br>> }<br>> $layer->close();<br>><br>> but how can I get the numer of records without a query?<br>
> Jo<br>><br>><br>> 2008/11/6 Umberto Nicoletti <<a href="mailto:umberto.nicoletti@gmail.com">umberto.nicoletti@gmail.com</a>>:<br>>> You can use the items array on the layer object to get the field names<br>
>><br>>> On Thu, Nov 6, 2008 at 12:10 PM, Jochen Wagner<br>>> <<a href="mailto:jochen.wagner8@googlemail.com">jochen.wagner8@googlemail.com</a>> wrote:<br>>>> Hi list,<br>>>> I would like to list from any layer ($ qlayer) only the field names of<br>
>>> the attribute tables and the number of objects in the table.<br>>>><br>>>> With this code it works already:<br>>>><br>>>> //loading mapfile<br>>>> $map= ms_newMapObj($mapfilepath.'\<br>
>>> demo.map');<br>>>><br>>>> //set layer<br>>>> $layer = $map->getLayerByName($qlayer);<br>>>><br>>>> //rectquery via mapextent<br>>>> @$datQuery = $layer->queryByRect($map->extent);<br>
>>><br>>>> //if query is successful<br>>>> if ($datQuery == MS_SUCCESS) {<br>>>> //number of objects<br>>>> $resnum = $layer->getNumResults();<br>>>> echo 'Anzahl: '.$resnum.'<br>';<br>
>>><br>>>> $layer->open();<br>>>> $result = $layer->getResult(0);<br>>>> $shpobj = $layer->getShape($result->tileindex,$result->shapeindex);<br>>>><br>>>> //read attribute table<br>
>>> $attr = $shpobj->values;<br>>>> foreach($attr as $name=>$wert) {<br>>>> echo 'Feld: '.$name.'<br>';<br>>>> }<br>>>> }<br>>>> $shpobj->free();<br>
>>> $layer->close();<br>>>><br>>>> However, this method has the disadvantage using a layers with many<br>>>> records the script takes a very long time, I guess because I have a<br>>>> query about the whole issue run.<br>
>>> Has someone an approach for me, getting<br>>>> 1. the field names of the table and<br>>>> 2. the number of objects in the table<br>>>> performantly using MapScript ?<br>>>> thanks<br>
>>> Jo<br>>>> _______________________________________________<br>>>> mapserver-users mailing list<br>>>> <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
>>> <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>>>><br>>><br>><br><br>