getShape index offset in OGR

Delfos, Jacob Jacob.Delfos at MAUNSELL.COM
Thu Sep 7 20:44:33 EDT 2006


Hi List,

I'm trying to obtain the attributes for a layer in php_mapscript, 

         $oShape = $oLayer->getShape(-1, 0);
         $fieldnames =  array_keys ($oShape->values);

That should work, and does for shapefiles. However, when using a personal geodatabase (and maybe other OGR sources), the index seems to refer to the internal index of the MDB (the 'OBJECTID' as reported in ArcGIS). So to get the first object is a challenge. Currently I'm doing:

         $oShape = $oLayer->getShape(-1, 0);
         $increasedIndex=1;
            while ((!($oShape)) && ($increasedIndex<100))
            {
            $oShape = $oLayer->getShape(-1, $increasedIndex);
            $increasedIndex++;
            }

This is 'messy', and probably not the proper way to go. Can someone tell me how to find the lowerbound (and maybe upperbound) of an OGR layer?

Thanks in advance,

Jacob


JACOB DELFOS
GIS ANALYST
Maunsell Australia Pty Ltd
629 Newcastle Street, Leederville, WA 6007
PO Box 81, Leederville, WA 6902
Western Australia
ABN 20 093 846 925

Tel     + 61 8 9281 6185
Fax    + 61 8 9281 6297
jacob.delfos at maunsell.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060908/a23d7c19/attachment.html


More information about the mapserver-users mailing list